I have a vector tileset (e.g. all the countries in the world).
Separately, I am running a query that gets a count for each country (e.g. how many times has X occurred in a given country).
Using the query response data, I create a choropleth of the result by correlating the country ids in the query with the country ids in the tiles.
Oftentimes, only a handful of countries are styled (other countries have a zero count). I would like to initialize the viewport to only those countries that have been styled, however...
I do not know how to obtain the geographic data (e.g. bounding box) of the countries that have been styled. The query only responds with the country codes and a count (no geographic data).
Is it possible to get the geographic data from the vector tiles themselves?
UPDATE:
I added the bounding box data to each feature in the vector tileset, but I'm still not sure how I would query the tiles to get the list of relevant bounding boxes (e.g. get a list of all features that have a count > 0).
Maybe with something like queryRenderedFeatures...? (not clear how to use this within the context of react-map-gl
)