Skip to content

Instantly share code, notes, and snippets.

View apollolm's full-sized avatar

Ryan Whitley apollolm

View GitHub Profile
@tmcw
tmcw / xyz_vs_tms.md
Last active March 14, 2024 17:56
The difference between XYZ and TMS tiles and how to convert between them

The difference between XYZ and TMS tiles and how to convert between them

Lots of tile-based maps use either the XYZ or TMS scheme. These are the maps that have tiles ending in /0/0/0.png or something. Sometimes if it's a script, it'll look like &z=0&y=0&x=0 instead. Anyway, these are usually maps in Spherical Mercator.

Good examples are OpenStreetMap, Google Maps, MapBox, MapQuest, etc. Lots of maps.

Most of those are in XYZ. The best documentation for that is slippy map tilenames on the OSM Wiki, and Klokan's Tiles a la Google.

@RandomEtc
RandomEtc / tile.js
Created November 9, 2010 01:25
shape rendering in nodejs with LearnBoost's node-canvas
// node.js geo polygon map tile rendering!
// requires https://github.com/learnboost/node-canvas and GeoJSON data files
// e.g.
// data from naturalearthdata.com converted to GeoJSON with GDAL's ogr2ogr
// or from datasf.org, reprojected too:
// ogr2ogr -f GeoJSON sfbay.js sfbay.shp -t_srs EPSG:4326
var Canvas = require('./vendor/node-canvas/lib/canvas'),
http = require('http'),
fs = require('fs');