Skip to content

Instantly share code, notes, and snippets.

@geog4046instructor
Last active April 18, 2017 12:48
Show Gist options
  • Save geog4046instructor/66727bf4b79e1a2c8bc9 to your computer and use it in GitHub Desktop.
Save geog4046instructor/66727bf4b79e1a2c8bc9 to your computer and use it in GitHub Desktop.
Leaflet - Get external GeoJSON
/* Get GeoJSON data from an external website using jQuery's getJSON function.
*
* function: getJSON
* documentation: http://api.jquery.com/jquery.getjson/
*
* See the Leaflet documentation on using GeoJSON
* http://leafletjs.com/examples/geojson/
*/
jQuery.getJSON( "http://example.com/layer1.geojson", function( geojsonFeature ) {
// code to do something with geojsonFeatures goes here, such as the L.geoJson function with the onEachFeature option
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment