May 2017
Beginner to intermediate
328 pages
7h 17m
English
The Leaflet GeoJSON layer does not retrieve the data automatically and therefore we need to obtain it ourselves. Once data is present, we can load it with the following code:
loadGeoJSON: function(map){ Ext.Ajax.request({ cors: true, url: 'http://10.0.0.19:8080/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename= mastering_postgis:earthquakes&' + 'outputFormat=application/json&srsname=EPSG:4326&' + 'bbox=-180,-90,180,90,EPSG:4326' }).then(function(response){ L.geoJson(Ext.JSON.decode(response.responseText).features, { pointToLayer: function (feature, latlng) { return L.circleMarker(latlng, { radius: feature.properties.mag * 5, fillColor: '#993366', weight: 1 }); } }).addTo(map); ...Read now
Unlock full access