Skip to content

Instantly share code, notes, and snippets.

@amarinelli
Last active August 29, 2015 14:17
Show Gist options
  • Save amarinelli/ac52f8ba003d8ca9ac31 to your computer and use it in GitHub Desktop.
Save amarinelli/ac52f8ba003d8ca9ac31 to your computer and use it in GitHub Desktop.
Leaflet GeoJSON (esri): Leaflet AJAX // source http://jsbin.com/debolatopa
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=1024, user-scalable=no">
<style>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0;}
#map{ height: 100% }
</style>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script type="text/javascript" src="https://rawgit.com/calvinmetcalf/leaflet-ajax/master/dist/leaflet.ajax.js"></script>
<title>Leaflet AJAX</title>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var m = L.map('map').setView([37.35, -112.99], 10);
var osmDataAttr = 'Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
var osm = L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:osmDataAttr});
osm.addTo(m);
var geojson = new L.GeoJSON.AJAX("http://services.arcgis.com/AtfpSdJcsnQiIRhL/arcgis/rest/services/Ranger/FeatureServer/0/query?where=1%3D1&outFields=*&outSR=4326&f=geojson", {});
geojson.addTo(m);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment