Andreas,

Thats great. So do you know if the `mapnik::memory_datasource` is  
exposed in the python bindings?

Dane


On Aug 17, 2008, at 11:58 AM, Andreas Volz wrote:

> Am Thu, 07 Aug 2008 11:15:02 +0200 schrieb Ric S:
>
>> 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 [EMAIL PROTECTED] +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've done that some time ago. Worked well. But then I deactivated the
> code for some reason. Not sure if it works at the moment:
>
> void MapnikSource::insertDataPoint (double x, double y, const char  
> *key, const char *value, const char* layer)
> {
>  /*Layer lyr (layer);
>  datasource_ptr ds (new mapnik::memory_datasource);
>  feature_ptr f (feature_factory::create (keyID));
>
>  geometry_ptr point (new point_impl (-1));
>  point->move_to (x, y);
>
>  f->set_geometry(point);
>
>  transcoder tr ("utf-8");
>  (*f)[key] = tr.transcode (value);
>
>        if (ds)
>        {
>                mapnik::memory_datasource *mem = dynamic_cast  
> <mapnik::memory_datasource*> (ds.get ());
>
>                if (mem)  // check if cast is ok!
>                {
>                        // do something with memory_datasource e.g.  
> push some features
>                        mem->push(mapnik::feature_ptr(new  
> mapnik::Feature(-1)));
>                        mem->push (f);
>    }
>        }
>
>  lyr.set_srs ("+proj=latlong +datum=WGS84");
>  lyr.add_style ("enigator");
>  lyr.set_datasource(mapnik::datasource_ptr(ds));
>  map->addLayer (lyr);
>
>  keyID++;*/
> }
>
> This is how I called it:
>
> m_mapnikSource.insertDataPoint (x, y, "enigator", "wptred",  
> "enigator");
>
> This is the reference in the XML file:
>
>  <Style name="enigator">
>    <Rule>
>      <MaxScaleDenominator>50000</MaxScaleDenominator>
>      <Filter>[enigator]='wptred'</Filter>
>      <PointSymbolizer file="/home/andreas/src/svn/enigator/trunk/ 
> data/symbols/wptred.png" type="png" width="32" height="32" />
>    </Rule>
>  </Style>
>
> Search the history of this list with my name and around 10-12 month  
> ago or so.
> Maybe this helps you...
>
> regards
> Andreas
> _______________________________________________
> 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