Hello All,

I'm just starting out with Mapnik and having an issue trying to duplicate
the mercator projection used in Google Maps.

I've taken the Hello World example from the map and modified it to use a
different projection:

 #!/usr/bin/env python
> from mapnik import *
> projection = '+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 [EMAIL PROTECTED] +no_defs +over'
> m = Map(600,300,projection)
> m.background = Color('steelblue')
> m.srs = projection
> s = Style()
> r = Rule()
> r.symbols.append(PolygonSymbolizer(Color('#f2eff9')))
> r.symbols.append(LineSymbolizer(Color('rgb(50%,50%,50%)'),0.1))
> s.rules.append(r)
> m.append_style('My Style',s)
> lyr = Layer('world')
> lyr.datasource = Shapefile(file='shapefiles/world_borders')
> lyr.styles.append('My Style')
> lyr.srs = '+proj=latlong +datum=WGS84'
> m.layers.append(lyr)
> p = Projection(projection)
> lower_left_xy = p.forward(Coord(-180.0, -45.0))
> upper_right_xy = p.forward(Coord(180.0, 80.0))
> bbox = Envelope(lower_left_xy,upper_right_xy)
> m.zoom_to_box(bbox)
> render_to_file(m,'images/world.png', 'png')
>

I've attached the output -- as you can see, it's only rendering a subset of
the countries, and I can't find any rhyme or reason why only those countries
are showing up.

I've also switched and used the TM world borders shapefile [1] -- which
renders exactly the same with the exception of also rendering the US. If I
go back to using the latlong projection, this problem disappears.

I'm guessing there's something basic I'm missing here, so I appreciate any
one taking the time out to help a newbie :)

thanks!

-filipe

[1] http://thematicmapping.org/downloads/world_borders.php

<<attachment: world.jpg>>

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

Reply via email to