Wednesday, 4 May 2016

Filtering GeoJSON data to include in Leaflet map


I am trying to filter through my geojson polygons and get all data entries with a specific attribute.


I have a layer of polygons describing parks around the city parks.json. I want the user to click on a button and see parks that have picnic areas. I have GeoJson data in the following format:


{"type":"Feature", "geometry":{ "type":"Polygon", "coordinates":[[[long1, lat1],[long2, lat2],[long3, lat3]]]}, "properties": { "Playground": Yes, "Picnic":Yes, "ParkName":"Barr Lake", "ParkStatus":"Open"}


How do I retrieve all of the polygons where "Picnic" = "Yes" and map them?


I tried this with no luck:


var picnic_parks = $("parks.json").filter(' "picnic":"Yes" ').addTo(map);





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...