Permalink
Browse files

Replaces L.GeoJSON.AJAX with L.geoJson

  • Loading branch information...
1 parent 580e598 commit 7fc6bfb45e5ea10dae4a534b9a84eef337674acc @mollietaylor committed Mar 5, 2014
Showing with 25 additions and 7 deletions.
  1. +9 −2 index.html
  2. +13 −2 parks.geojson → parks.js
  3. +2 −2 trails.html
  4. +1 −1 trails.geojson → trails.js
View
@@ -12,7 +12,7 @@
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
- <script type="text/javascript" src="http://mollietaylor.com/files/leaflet.ajax.js"></script>
+ <script src="parks.js"></script>
<style type="text/css">
#map {
height: 500px;
@@ -86,7 +86,14 @@
// console.log(getDistance(feature.geometry.coordinates[1],feature.geometry.coordinates[0], 33.75, -84.38) + ' km'); // substitute second pair with current location
};
- var hikeLayer = new L.GeoJSON.AJAX("parks.geojson", {
+ // var photos = L.geoJson(photoList, {
+ // onEachFeature: onPhoto,
+ // pointToLayer: function(feature, latlng) {
+ // return L.marker(latlng, {icon: photoIcon});
+ // }
+ // });
+
+ var hikeLayer = L.geoJson(parksList, {
onEachFeature: onEachHike,
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: hikingIcon});
View
@@ -1,6 +1,17 @@
-{
+parksList = {
"type": "FeatureCollection",
"features": [
+ // {
+ // "type": "Feature",
+ // "properties": {
+ // "name": "",
+ // "distance": ""
+ // },
+ // "geometry": {
+ // "type": "Point",
+ // "coordinates": []
+ // }
+ // },
{
"type": "Feature",
"properties": {
@@ -418,7 +429,7 @@
"distance": "~1 mile"
},
"geometry": {
- "type": "LineString",
+ "type": "Point",
"coordinates": [-84.351619,33.802711]
}
},{
View
@@ -13,7 +13,7 @@
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
- <script type="text/javascript" src="http://mollietaylor.com/files/leaflet.ajax.js"></script>
+ <script type="text/javascript" src="trails.js"></script>
<style type="text/css">
#map {
height: 500px;
@@ -66,7 +66,7 @@
layer.bindPopup(feature.properties.name + "<br>Length of hike: " + feature.properties.distance);
};
- var hikeLayer = new L.GeoJSON.AJAX("trails.geojson", {
+ var hikeLayer = L.geoJson(trails, {
onEachFeature: onEachHike,
style: {color: '#3498db',
opacity: 1},
@@ -1,4 +1,4 @@
-{
+trails = {
"type": "FeatureCollection",
"features": [
{

0 comments on commit 7fc6bfb

Please sign in to comment.