cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <html>

<head>
  <title>I Want My GeoJson on the Map</title>
    <!-- Load Leaflet CSS from CDN.  More info at: http://leafletjs.com/examples/quick-start.html-->
  <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
   <!-- Load the Leaflet from CDN. More info at: http://leafletjs.com/examples/quick-start.html-->
  <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
   <!-- Load jQuery from CDN. jQuery is used to put the GeoJSON points on the map-->
  <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
   <!-- Load the Esri Leaflet plugin from CDN.  For more info: https://esri.github.io/esri-leaflet/examples/ -->
  <script src="//cdn.jsdelivr.net/leaflet.esri/1.0.0/esri-leaflet.js"></script>

</head>

<body>
<!--  The following is the div that is acting as a container to hold the map-->
  <div id="map"></div>


</body>

</html>
            
          
!
            
                      /*  CSS to style the whole html page*/
        
        body {
          margin: 0;
          padding: 0;
        }
        /*  CSS to style the map*/
        
        #map {
          position: absolute;
          top: 0;
          bottom: 0;
          right: 0;
          left: 0;
        }
            
          
!
            
              //Check out more Sample code and API reference at https://esri.github.io/esri-leaflet/examples/

//Adds the map control and sets the center point to Durham and zoom scale to 10. For more info on the Leaflet map control check out: http://leafletjs.com/reference.html#map-class
var map = L.map('map').setView([35.9886, -78.9072], 10); 

//Adds a basemap to the map.  To see all the available basemaps: https://esri.github.io/esri-leaflet/api-reference/layers/basemap-layer.html
L.esri.basemapLayer('NationalGeographic').addTo(map);

// load GeoJSON from an external file.  
//Replace URL below to point to your GeoJSON
$.getJSON("https://s3-us-west-2.amazonaws.com/s.cdpn.io/131702/north_carolina_bicycle_crash_data_heatmap__(1).geojson", function(data) {
  //Create bike icon to style points
    var bikeIcon = L.icon({
      //Replace URL on the next line to point to your icon
    iconUrl: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/131702/bikeCrash.png',
    iconSize: [60,50]
  });
  // add GeoJSON layer to the map once the file is loaded
   L.geoJson(data,{
 pointToLayer: function(feature,latlng){
   //Create Bike Icon Marker
  var marker = L.marker(latlng,{icon: bikeIcon});
    //To show the fields in your data, replace the field names in the {} to match your data
  marker.bindPopup(feature.properties.crash_date + '<br/>' + feature.properties.bike_sex + '<br/>' + feature.properties.crash_type);
  return marker;
}
     //add data layer containing bike crash data to the map
  }).addTo(map);
});


            
          
!
999px
Loading ..................

Console