[Mapnik-users] Draw GPS Points to Map/Image

Ric S burj-al-arab at gmx.de
Thu Aug 7 11:15:02 CEST 2008


Hi folks,

I have successfully setup mapnik. Generating a map already works.
Now I would like to draw gps points into the map, I was searching the 
net for a few hours to get some info, unfortunately
I still have now clue yet how this can be done with mapnik.
I assume I have to create a layer and add points to it. I could not find 
an example how to draw points.

I would like to set gps points in my map. Could you please show me how to
add a single gps point to this map/layer. The code from generate_image 
which I used:
...
    z = 10
    imgx = 100 * z
    imgy = 100 * 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')
...

Thanks in advance, Richard




More information about the Mapnik-users mailing list