[OSM-dev] PostGIS & Mapnik problem

Colm McMullan colm.mcmullan at gmail.com
Thu Jan 14 18:18:16 GMT 2010


Hey Andy,

Thanks for the help.  That was sound advice, working backwards from
generate_image.py and the osm.xml was quick and easy.  Definitely a good
approach.

I think the two problems I had were that the datasource is spherical
mercator so I changed the srs of the layer but also I think that I needed to
use the m.zoom_to_box(bbox)function in the code, otherwise I'm guessing it
tries to render a whole world view so my little insignificant streets in
London wouldn't even register at pixel level :)

Works a charm now it seems.

Thanks Andy!
Colm

On Wed, Jan 13, 2010 at 13:57, Andy Allan <gravitystorm at gmail.com> wrote:

> On Wed, Jan 13, 2010 at 1:12 PM, Colm McMullan <colm.mcmullan at gmail.com>
> wrote:
>
> > <Map bgcolor="#ffffff" srs="+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 +no_defs -tl
> -r">
> >     <Style name="line style 2">
> >         <Rule>
> >                 <LineSymbolizer>
> >                         <CssParameter
> name="stroke">#000000</CssParameter>
> >                         <CssParameter
> name="stroke-width">3.0</CssParameter>
> >                 </LineSymbolizer>
> >         </Rule>
> >     </Style>
> >     <Layer name="layer 4" srs="+proj=latlong +ellps=WGS84 +datum=WGS84
> > +no_defs" status="on">
> >         <StyleName>line style 2</StyleName>
> >         <Datasource>
> >             <Parameter name="type">postgis</Parameter>
> >             <Parameter name="host">localhost</Parameter>
> >             <Parameter name="user">postgres</Parameter>
> >             <Parameter name="dbname">gis</Parameter>
> >             <Parameter name="estimate_extent">true</Parameter>
> >             <Parameter name="table">planet_osm_roads</Parameter>
> >         </Datasource>
> >     </Layer>
> > </Map>
>
> >
> > So I'm a bit stumped, what am I missing?  Has anyone got any suggestions?
>
> My rule of thumb with Mapnik is "it's always a projection problem".
> Are you sure that your db is in latlong? By default osm2pgsql is in
> spherical mercator.
>
> If that's not it, I'd suggest starting with the generate_image.py and
> the osm.xml from OSM SVN, and get that working with all the defaults
> as described on the wiki. You can then step through changes one at a
> time (e.g. changing your db to latlong instead of spherical mercator,
> using your own style instead of osm.xml and so on.
>
> Cheers,
> Andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100114/f3791936/attachment.html>


More information about the dev mailing list