I am using TileStache to serve my own vector tiles using a postgis datasource. First I re-projected the shapefiles I had using ArcMap ( reprojected to Web Mercator (Auxilary Sphere)) and loaded them in Postgres using shp2pgsql (SRID:900913).
I am able to generate the Tiles using this config file:
{ "cache": { "name": "test", "path":"/tmp/stache", "umask": "0000" }, "layers": { "tpl": { "allowed origin":"*", "projection": "spherical mercator", "provider": { "class": "TileStache.Goodies.VecTiles:Provider", "kwargs":{ "dbinfo": { "host":"localhost", "user":"postgres", "password":"postgres", "database":"tpl" }, "queries": { "7":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm WHERE priority IN (5,4) -- zoom 7+", "8":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm WHERE priority IN (5,4)", "9":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm WHERE priority IN (5,4)", "10":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm WHERE priority IN (5,4)", "11":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm WHERE priority IN (5,4,3,2)", "12":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm WHERE priority IN (5,4,3,2)", "13":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm WHERE priority IN (5,4,3,2)", "14":"SELECT geom AS __geometry__,name, priority FROM isl_roads_sm -- zoom 14+" } } }, "preview":{"ext":"json"} } } }
I am rendering the tiles generated using Leaflets TileLayer.GeoJSON. The problem I have is that the tiles dont overlay with the basemap, there is pretty large gap between my tiles and the features on the basemap.
When I use WGS84 as the projection in the config file (using data in WGS84) I get empty tiles, no other errors.
How can I get the tiles to overlay correctly? Why does WGS84 not work?
+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
. Or check with a qry:SELECT * FROM geometry_columns
, see if srid is indeed 900913900913
. I tried it with SRID3857
as well (after chaging the projection to 3857 in QGIS) but that just gives me an error saying that tilestache doesn't work with mixed SRIDs.