Skip to content

Instantly share code, notes, and snippets.

@ustroetz
ustroetz / mexico-city_mexico.geojson
Created May 29, 2015
Mexico City regions polygon
View mexico-city_mexico.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pt_lisbon_lis.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ustroetz
ustroetz / mvt.sql
Last active Sep 8, 2017
Get MVT from Postgis
View mvt.sql
SELECT ST_AsMVT('test', 4096, 'geom', q)
FROM (
SELECT
ST_AsMVTGeom(
geom,
TileBBox(z, x, y, 3857), /* https://github.com/mapbox/postgis-vt-util/blob/master/src/TileBBox.sql */
4096,
0,
false
) geom
View de_muehlheim-main_fra.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View uk_furness_bwf.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ustroetz
ustroetz / index.html
Created Jul 12, 2017
Spike to use custom Mapbox Vector Tiles
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.38.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.38.0/mapbox-gl.css' rel='stylesheet' />
<style>
View it_brescia.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View de_duesseldorf.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View mapbox_vetor_tiles_validate.py
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)
View mapbox_vetor_tiles_validate.py
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)