Skip to content

Instantly share code, notes, and snippets.

@ustroetz
Created January 2, 2017 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ustroetz/7e4c4f699f9604972f512ddd3bdd1a0d to your computer and use it in GitHub Desktop.
Save ustroetz/7e4c4f699f9604972f512ddd3bdd1a0d to your computer and use it in GitHub Desktop.
import mapbox_vector_tile
import requests
tile_id = 'allryder.ama_districts-staging'
url = 'https://a.tiles.mapbox.com/v4/' + tile_id + '/10/531/341.vector.pbf'
querystring = {"access_token":"pk.eyJ1IjoiYWxscnlkZXIiLCJhIjoidWs5cUFfRSJ9.t8kxvO3nIhCaAl07-4lkNw"}
response = requests.request("GET", url, params=querystring)
data = mapbox_vector_tile.decode(response.content)
feature_properties = data['ama_districts-staging']['features'][0]['properties']
print feature_properties['name']
print feature_properties['parent_id']
print feature_properties['type']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment