reproject lon/lat in wgs84 to target projection using tilestache/modestmaps?

918 views Asked by At

The documentation for tilestache is a little sparse. Is there a way to transform a point (lon/lat) in wgs84 to a target projection?

Where:

target_srid = 3095
target_proj4_str = '+proj=utm +zone=54 +ellps=bessel +towgs84=-146.414,507.337,680.507,0,0,0,0 +units=m +no_defs'

I've noticed that there is a tranform object in ModestMaps at:

ModestMaps.Geo.Transform()

But I'm not clear on how it can be used.

2

There are 2 answers

2
Michal Migurski On

Your best bet is the Proj4Projection class under “Goodies”:

http://tilestache.org/doc/TileStache.Goodies.Proj4Projection.html

I’m currently only including WGS84 and Spherical Mercator in the core of TileStache, but the contributed module above should help you. Be aware that you need to figure out a transformation in addition to a projection, explained in this excellent guide from Per Liedman: http://blog.kartena.se/local-projections-in-a-world-of-spherical-mercator/

0
allthesignals On

Proj4Projection has a dependency (pyproj). I'm not sure what specifically you're trying to do, but if you're trying to make data compatible with what TileStache is expecting, I would just use ST_Transform in the actual SQL queries to have PostGIS project to 4326. It's not the cleanest way to do it, but it would at least prevent data redundancy.

Also see this: http://vis4.net/blog/posts/no-more-mercator-tiles/