|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Printing a track over mapHello everybody,
First of all, sorry for my poor english. I'm rendering a map loading osm.xml, but I want to print over the map a track (route, or whatever). This route are in a GML file, so there is a way to do this? I'm using the example code: from mapnik import * import sys, os if __name__ == "__main__": try: mapfile = os.environ['MAPNIK_MAP_FILE'] except KeyError: mapfile = "osm.xml" map_uri = "image.png" #--------------------------------------------------- # Change this to the bounding box you want # ll = (-6.5, 49.5, 2.1, 59) #--------------------------------------------------- z = 10 imgx = 500 * z imgy = 1000 * z m = Map(imgx,imgy) load_map(m,mapfile) 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 +nadgrids=@null +no_defs +over") 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) im = Image(imgx,imgy) render(m, im) view = im.view(0,0,imgx,imgy) # x,y,width,height view.save(map_uri,'png') I read that rendering maps follow the painter's algorithm. So, in case that I could print the route over the map, this code will be previos render(m,im) line? Thanks, _______________________________________________ Mapnik-users mailing list Mapnik-users@... https://lists.berlios.de/mailman/listinfo/mapnik-users |
|
|
Re: Printing a track over mapHi Alejandro,
On May 25, 2009, at 3:53 AM, Alejandro Perea wrote: > Hello everybody, > > First of all, sorry for my poor english. > > I'm rendering a map loading osm.xml, but I want to print over the > map a track (route, or whatever). This route are in a GML file, so > there is a way to do this? > Are you running mapnik 0.6.0 on mac or linux? If so you can use the OGR driver (built it with INPUT_PLUGINS=all) to create and render the GML file directly. http://trac.mapnik.org/wiki/OGR The OGR plugin is very similar to the other Mapnik datasource plugins except that you need to supply the <layer> parameter. The name of OGR Layers can be found by running the 'ogrinfo' tool on your GML file like: $ ogrinfo <your_file.gml> -s0 -al > > I read that rendering maps follow the painter's algorithm. So, in > case that I could print the route over the map, this code will be > previos render(m,im) line? > Just put the xml to create this datasource at the bottom off your osm.xml and it should render on top of your map. Dane _______________________________________________ Mapnik-users mailing list Mapnik-users@... https://lists.berlios.de/mailman/listinfo/mapnik-users |
| Free embeddable forum powered by Nabble | Forum Help |