"mapbox_vector_tile" error when trying to collect stop sign coordinates

I am trying to collect stop sign data from the downtown Chicago area. All I need is the coordinates of stop signs in said area. But, I am currently experiencing an error from “mapbox_vector_tile”. The error is as follows:

Warning (from warnings module):
  File "C:\Users\"myusername"\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mapbox_vector_tile\decoder.py", line 24
RuntimeWarning: Unexpected end-group tag: Not all data was converted

The code I am running is as follows:

import mercantile, mapbox_vector_tile, requests, json
from vt2geojson.tools import vt_bytes_to_geojson

# define an empty geojson as output
output= { "type": "FeatureCollection", "features": [] }

# Mapillary access token -- user should provide their own
access_token = 'MLY|XXX'

# a bounding box in [west_lng,_south_lat,east_lng,north_lat] format
west, south, east, north = [-87.6565881940041,41.867095746832085, -87.62416489250167,41.89259531146177]

# get the list of tiles with x and y coordinates which intersect our bounding box
# MUST be at zoom level 14 where the data is available, other zooms currently not supported
tiles = list(mercantile.tiles(west, south, east, north, 14))

# loop through list of tiles to get tile z/x/y to plug in to Mapillary endpoints and make request
for tile in tiles:
    tile_url = 'https://tiles.mapillary.com/maps/vtp/mly_map_feature_traffic_sign/2/{}/{}/{}?access_token={}'.format(tile.z,tile.x,tile.y,access_token)
    response = requests.get(tile_url)
    data = vt_bytes_to_geojson(response.content, tile.x, tile.y, tile.z)
    # push to output geojson object if yes
    for feature in data['features']:

# save a local geojson with the filtered data
with open('stop_signs.geojson', 'w') as f:
    json.dump(output, f)

This in turn leaves the data variable as " {‘type’: ‘FeatureCollection’, ‘features’: []} " with no actual data regarding traffic signs. Looking online the only thing I can find regarding this issue states that the error comes from the data being pulled being incorrect or corrupted.

Thank you for your time.

1 Like

Hi there,

I am facing the same issue. It is because response.content containts no actual data but an error message stating “You are not loged in. Please log in”.

Requesting from https://graph.mapillary.com is working indeed.

What went wrong?


1 Like

I started getting the same error. Is it because they limit the amount of api hits?

I am using a multithreading strategy to process large quantities of tiles.

1 Like

I think so; most probably, yes! I too am using a multithreaded approach and get similar errors