[Mapnik-users] Mapnik database indepenent layer

Andreas Volz lists at brachttal.net
Thu Jun 28 23:30:25 CEST 2007


Am Thu, 28 Jun 2007 09:56:41 +0100 schrieb Artem Pavlenko:

Hello,

> > Is's a In-Car live GPS application. Currently I've not yet a route
> > calculation.
> > So my first step is to display the destination point on
> > the map. I've a GPS position at the destination position and like to
> > display a little flag or something else on the map. At the moment I
> > would like to give this destionation GPS position with a input  
> > dialog at
> > runtime.
> >
> 
> In this case memory_datasouce is probably the best fit.
> You can try something like this:

Thanks for your help. But perhaps you could support me a little more.

> std::auto_ptr<mapnik::datasource> ds (new memory_datasource)

OK

> // create your features and push them into datasource.
> feature_ptr f;
> f.set_geometry(...) ;  // create geometry, have a look in any  
> concrete datasource implementations e.g shape.input

OK

> f['attr1'] =123;

Looks like Python API. Is this correct for C++?

std::map <string, value> fprops = f->props ();
fprops["attr"] = 123;

I'm not sure if I did all correct with the reference.

> ....
> ds->push(f);

The datasource class has no function push(). How would I do this?

> Layer lyr("your layer");
> lyr.set_srs("+proj=...");
> lyr.add_style("your style");
> lyr.set_datasource(mapnik::datasource_ptr(ds.release()));
> 
> map->addLayer(lyr);

OK.

regards
Andreas



More information about the Mapnik-users mailing list