简体   繁体   中英

how to add search/filter in mapbox with custom data

I am using mapbox for my website. It has 96 institues which i am populating from database and showing on map. i want to add search filter (search by institute name) so that a user can search from these specific 96 institues. So far i have used Geocoding but i am stuck as the search also filter data out of my institues name (it should ony show institute names, not any other data) i have follow this example

https://docs.mapbox.com/mapbox-gl-js/example/forward-geocode-custom-data/

I am also attaching a picture for a better understanding

map showing institute details when i click on marker

can you explain a bit more what your are trying to achieve? Do you only want to search your list of 96 features, and not ever query the Mapbox Geocoder at all?

In that case you wouldn't want to use the mapbox geocoder control at all, but code up your own controller with only the local search implemented. You can add implement your own controller using the IControl interface https://docs.mapbox.com/mapbox-gl-js/api/markers/#icontrol

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM