Skip to content

Instantly share code, notes, and snippets.

View cbeddow's full-sized avatar

Christopher Beddow cbeddow

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"version": 8,
"sources": {
"mapillary-source": {
"tiles": [
"http://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt"
],
"type": "vector"
}
},
var images = ["Ul-D12gQYR4RKKtcqmqsDQ","uAhuDQSHVSXRCmP5eqHmGg","_vXXqJhvPKbhyMCDyFsA3Q", "A-3lBUJhPkAwqlFnIMW1hg", "xO6DsVNqMt9Tv1bVTe8UGA","5PBPwFgmu_HvQLMPda0qgg","J_KPdrHAbv7yngT43w0qrg","xLNC-Awp85IPj79OPg4fUg","AP9myH8OEMh0rtuvaRdrSg","W1s_IT_WlQ3myQ3GOpbUfQ","YG8pa7KP5LAwCX_Jhhw8fg","RGbdNKEVHf-GLj8BNp8tlg","3xxrrl04fsqF262pFDzHyg"];
var basemap = ["satellite"]
var project_title = "Exploring the World"
var project_subtitle = "A selection of beautiful Mapillary sequences from across the world"
var titles = ["Utah", "British Columbia", "California", "South Dakota", "Wyoming","California","Chile","New Zealand","Sri Lanka","Iceland","Georgia","South Africa","Nepal"]
var content = ["The capital city of Utah, Salt Lake City is situated at the foot of the Wasatch Mountains and the Great Salt Lake. The city is close to a variety of environments, ranging from alpine peaks to pine forest to red desert. It was also the host of the 2002 Winter Olympics, and is the center of the Church of Jesus Christ of Latter Day
from stac_interact import get_collection_ids, get_item_dict, get_items_within
# desired collection ID
collection = 'sentinel-s2-l2a'
# get first item in desired collections
data = get_item_dict(collection)
assets = data['assets']
keys = assets.keys()
@cbeddow
cbeddow / download_apiv4.py
Last active June 13, 2023 22:59
Python script for downloading data from Mapillary API v4 in a bounding box
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": [] }
# vector tile endpoints -- change this in the API request to reference the correct endpoint
tile_points = 'mly_map_feature_point'
tile_traffic_signs = 'mly_map_feature_traffic_sign'
tile_coverage = 'mly1_public'
@cbeddow
cbeddow / tilesplitter.js
Created July 13, 2021 00:12
Tilesplitter example
interface TileCoords {
x: number;
y: number;
z: number;
}
const getParentTileCoords = (childTile: TileCoords, parentLevel: number): TileCoords => {
const deltaZ = childTile.z - parentLevel;
const scale = Math.pow(2, deltaZ);
return {
'x': Math.floor(childTile.x / scale),
@cbeddow
cbeddow / mapillary_image_download.py
Created July 20, 2021 20:39
Download Mapillary images with API v4
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": [] }
# empty list of image keys
images = []
# vector tile endpoints -- change this in the API request to reference the correct endpoint
@cbeddow
cbeddow / mapillary_sequence_download.py
Last active January 18, 2022 21:28
Download Mapillary sequence lines as geojson
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": [] }
# vector tile endpoints -- change this in the API request to reference the correct endpoint
tile_coverage = 'mly1_public'
# tile layer depends which vector tile endpoints:
@cbeddow
cbeddow / mapillary_image_download.py
Last active March 14, 2024 13:07
Download all Mapillary images in a bounding box - API v4
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": [] }
# vector tile endpoints -- change this in the API request to reference the correct endpoint
tile_coverage = 'mly1_public'
# tile layer depends which vector tile endpoints:
@cbeddow
cbeddow / mapillary_jpg_download.py
Last active March 18, 2024 06:08
Download Mapillary images a JPGs
import mercantile, mapbox_vector_tile, requests, json, os
from vt2geojson.tools import vt_bytes_to_geojson
# define an empty geojson as output
output= { "type": "FeatureCollection", "features": [] }
# vector tile endpoints -- change this in the API request to reference the correct endpoint
tile_coverage = 'mly1_public'
# tile layer depends which vector tile endpoints: