3

I am attempting to add a single search button to look through geoJSON layers. They will look through the field "name". Unfortunately, my method of creating a layer group is not working. What am I missing? Or how do I group together geoJSON files to make this work?

var searchControl = new L.Control.Search({
      layer: [syriaLayer, countryBoundary],
      zoom: 7.5,
      propertyName: 'Sheet_Numb',
      circleLocation: false
  });
  • This works fine for GeoJSON markers only but doesn't work for GeoJSON polygons. How to put multiple GeoJSON markers and polygons in one search box? – Rabie Ben Jan 6 '16 at 19:34
  • you should ask a new question referencing this discussion - few will see this because you've posted it as an answer – toms Jan 6 '16 at 21:36
3

Group the layers within a layerGroup or a featureGroup as described in the docs

layer: L.featureGroup([syriaLayer, countryBoundary]),
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.