V
V
Vladislav D2015-08-05 20:53:32
Geolocation
Vladislav D, 2015-08-05 20:53:32

Handling exception in openlayers 3 when loading GeoJSON, how?

How to catch an Exception in Openlayers 3 when loading GeoJSON from the server... for example, if the server suddenly became unavailable or the geojson was formed clumsily, or the database fell off .... in short, so that you can spit the error. Nowhere did I find an answer to the question.

var vs = new ol.source.Vector({
    url:'geojson.php',
    format: new ol.format.GeoJSON() 
});
var vl = new ol.layer.Vector({
    source:vs,
    style:styleFunction
});
map.addLayer(vl);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question