0
votes

I try to get the buildings geometry coordinates polygons from features, but i cant seem to find a way for this to work without the javascript method queryRenderedFeatures or SourceFeatures. This question Getting building information from mapbox api uses the javascript method, but i want something to work with a link, that i can fetch a json from.

I have managed to come close with something like this: https://api.mapbox.com/v4/mapbox.mapbox-streets-v8/tilequery/27.598505,47.162098.json?radius=30&layers=road,poi_label,building,geometry&access_token=ACCESS_TOKEN_HERE. But this has a major flaw: It only returns geometry as a point:

{"type":"FeatureCollection","features":[{"type":"Feature","id":235028771,"geometry":{"type":"Point","coordinates":[27.598497434198464,47.16209573500234],"type":"building"...}}

You can observe that it returns a point even though it is a building. Is there a way to do this? The queryRenderedFeatures method DOES return a polygon. Somehow the information reaches the Map object that i query but how can i fetch through an api that info?

1

1 Answers

0
votes

What you're trying to do is not possible. Mapbox doesn't provide complete polygon datasets. At best, there are ways of retrieving polygons from vector tilesets (such as query-remote-tiles, which does something similar to TileQuery). But these will only retrieve the part of the polygon within a given vector tile, which may not be what you want. (queryRenderedFeatures has the same issue).