Thanks for yours response. 

I have tried the first option, it is more easy :) and it works
perfectly.

I was trying with the following srs but it didn't work.

+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 +nadgri...@null +no_defs +over

The end xml is:

<Map bgcolor="transparent" 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 +nadgri...@null
+wktext +no_defs">
   <Style name="texto">
     <Rule>
      <TextSymbolizer name="nombre" face_name="DejaVu Sans Book"
size="10" fill="#66f" dy="-10" halo_radius="1"
wrap_width="0"/>          
     </Rule>
  </Style>
  
  <Layer name="objetos" status="on" srs="+proj=longlat +ellps=WGS84
+datum=WGS84 +no_defs">
    <StyleName>texto</StyleName>
    <Datasource>
      <Parameter name="type">postgis</Parameter>
      <Parameter name="user">sigpob</Parameter>
      <Parameter name="dbname">sigpobserver</Parameter>
      <Parameter name="table">mobjetos</Parameter>
    </Datasource>
  </Layer>
</Map>

The .py:

#!/usr/bin/env python
import mapnik
from mapnik import *
mapfile = "test_mapnik.xml"
m = Map(1400, 800)
mapnik.load_map(m, mapfile)
ll = (-100, -70, 100, 70)
prj = 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 +nadgri...@null +wktext
+no_defs")
c0 = prj.forward(Coord(ll[0],ll[1]))
c1 = prj.forward(Coord(ll[2],ll[3]))
bbox = Envelope(c0.x,c0.y,c1.x,c1.y)
m.zoom_to_box(bbox)
mapnik.render_to_file(m, 'test_mapnik.png', 'png')

Thanks for yours help.

Best regards, Ramón.



El mié, 22-07-2009 a las 21:31 +0100, Artem Pavlenko escribió:
> Hi Ramón,
> 
> This is definitely possible. All you need to do is to specify
> SRS(spatial ref system) for the resulting map (srs attribute in Map
> element) as :
> 
> +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 +nadgri...@null +wktext +no_defs
> 
> 
> Regards,
> Artem
> 
> 
> 2009/7/22 Ramón Pérez <[email protected]>:
> > Hi,
> >
> > I am newest in mapnik. Sorry for the question!
> >
> > It is possible reproject geometry 4326 in 900913 through mapnik??
> >
> > I have all data in srs 4326 in a postgis database and i would like
> > project it in 900913 directly with mapnik, but i don't know how. I want
> > to show osm data with custom data in openlayer.
> >
> >
> > Thanks for all.
> > Ramon.
> >
> > _______________________________________________
> > 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