This is a static archive of our old OSM Help Site. Please post any new questions and answers at community.openstreetmap.org.

Mapnik with British Coordinates

0

I am trying to create a slippy map of the area of Wrexham, but using the British Coordinate System (by following http://wiki.openstreetmap.org/wiki/Mapnik_GB_Projection)

I can produce the maps in the standard spherical projection, using osm2psql to upload the vectors in a box (-b -3.4,52.85,-2.7,53.15) to PostgreSQL, and create the tiles defining the same box in generate_tiles.py.

I then change the coordinate system in PostgreSQL with PostGIS extension using the command sudo osm2pgsql -v -H localhost -P 5433 -U gisuser -W -C 4096 -b -3.4,52.85,-2.7,53.15 -S /home/m/bin/welsh.style united_kingdom.osm.bz2

Checking the data in Qgis shows everything looks fine and the coordinates are what would be expected. For mapnik, I have changed the srs attribute in osm.xml to +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894 +units=m +nodefs

In generate_tiles.py what coordinate system should bbox be in? Both bbox = (300000,300000,335449,351718) and bbox = (-2.0,52.043,-0.896,54.047) just give me blank tiles.

asked 31 Mar '11, 20:27

pingu512's gravatar image

pingu512
1111
accept rate: 0%

edited 31 Mar '11, 23:56

Harry%20Wood's gravatar image

Harry Wood
9.5k2588128


One Answer:

1

This question is pretty ancient, but I'm hoping the answer might be useful to someone!

You might want to try using my Python script print-osgb.py, which I wrote for this purpose. You set various options at the top of the Python file rather than providing arguments when running the script.

IIRC, the data in PostGIS can be in whatever projection you like as long as this is reflected in the section of the Mapnik XML file that defines the data source. However, the srs at the top of the XML file should reflect the OSGB projection. I normally just use srs="+init=epsg:27700" for this.

answered 05 Jan '17, 20:17

Greg's gravatar image

Greg
141238
accept rate: 50%