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);