0

I'm using Mapbox's Geocoding (search box) and was wondering if there's a way that it would only reference my Tileset data rather than the generic global address search?

Looks like Mapbox has a "Supplement geocoding search results from another data source", however the example is referencing geographic coordinates rather than addressing.

I'm still not sure if this is possible?

Basically I want to enter an address in the Geocoding search box and to have a particular polygon selected from my dataset on the map.

1

Cross posted at https://stackoverflow.com/questions/49114648/mapbox-gl-js-geocoding-to-only-reference-tileset/49119921

The example you linked to shows how to supplement search results with a local source, not a remote source in the https://github.com/mapbox/mapbox-gl-geocoder.

Currently Mapbox doesn't provide a Geocoding API against your own data however depending on how large your dataset is (and assuming it's a Mapbox Dataset and not just a Mapbox Tileset) you could use the Datasets API to read in every feature into the client with https://github.com/mapbox/mapbox-sdk-js/blob/master/API.md#listfeatures and use the results of that to power the mapbox-gl-geocoder search like https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder-local-geocoder/

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.