[Mapnik-users] Mapnik database indepenent layer

Artem Pavlenko artem at mapnik.org
Thu Jun 28 10:56:41 CEST 2007


Hi Andreas,

On 26 Jun 2007, at 21:05, Andreas Volz wrote:

> Am Tue, 26 Jun 2007 09:22:29 +0100 schrieb Artem Pavlenko:
>
>>
>> On 24 Jun 2007, at 23:20, Andreas Volz wrote:
>>
>>> Hello,
>>>
>>> I like to insert some stuff on my Mapnik map that isn't in the
>>> database. For example start and stop points, marked ways, and other
>>> live generated POI. So how could I create a new layer and insert
>>> this with a given GPS position?
>>>
>>> regards
>>> Andreas
>>
>> Opps.. the rest is here:)
>>
>> The right approach depends on where and how you're storing your
>> POIs. You can implement data-source interface or you can create
>> features on- fly and feed them into memory_datasource for example.
>> Could you provide more details and I'll try to help.
>


> 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:

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

// 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
f['attr1'] =123;
....
ds->push(f);
..
Layer lyr("your layer");
lyr.set_srs("+proj=...");
lyr.add_style("your style");
lyr.set_datasource(mapnik::datasource_ptr(ds.release()));

map->addLayer(lyr);
...

Cheers,
Artem

> regards
> Andreas
> _______________________________________________
> Mapnik-users mailing list
> Mapnik-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/mapnik-users
>

Artem Pavlenko
http://mapnik.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.berlios.de/pipermail/mapnik-users/attachments/20070628/4c5f7e5c/attachment.html>


More information about the Mapnik-users mailing list