Ben,

It would be helpful if you could paste your whole XML or python script. That 
way I could see issues more clearly like: are you remembering to set the layer 
'srs' value? When loaded via XML a layer without an 'srs' value set will 
default to the map 'srs'. But in python a layer created from scratch (since it 
is not part of any map yet) will default to EPSG:4326 (+proj=longlat 
+ellps=WGS84 +datum=WGS84 +no_defs).

Also, spherical mercator, or the google projection you want is likely:

+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 
+units=m +nadgrids=@null +wktext +no_defs +over

The +nadgrids=@null is the key part you are missing.

Dane

On Jun 27, 2011, at 3:49 AM, Ben Crane wrote:

> Hi all,
> 
> I've installed and got mapnik working for shape, tab and postgis and am 
> making good progress...but I have a question regarding projections :
> 
> My shape file is in WGS84. I reference a particulare area of the world file 
> in standard lat/long notation in the python script eg:
> 
> bbox = mapnik.Envelope(mapnik.Coord(-180.0, -75.0), mapnik.Coord(180.0, 90.0))
> 
> What I was wondering is that if I change the projection of the python 
> script/XML styles to EPSG: 3857 (Popular Visualizations) and the shape file 
> remains in WGS84 is that going to cause a conflict in terms of which 
> projection is used? The reason I ask is that I altered the projection to: 
> srs="+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 
> +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
> 
> and then altered the Envelope clause to bbox = 
> mapnik.Envelope(mapnik.Coord(-2022737, 476045), mapnik.Coord(3223267, 
> 5458042)) (focussing on Spain) but no joy - I get a white png image and no 
> errors which makes be think it's just taken a snapshot of nothing since 
> lat/long isn't in this range.
> 
> So either I cannot override the shape file projection, or I am doing it 
> incorrectly...is this possible
> 
> Many thanx,
> 
> BC
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to