Dane,

Thanks for your comments. I checked out your 'memory_datasource_polygon' 
example script. It is no problem to have the geometry I want to add in wkt/wkb 
as it probably would be anyway coming from shapely or GDAL. So this solution 
looks good.

It sounds like I have a few choices for generating dynamic layers/geometry in 
Mapnik:

1 - Upgrade to mapnik2 (trunk) from 1.7.1, figure out how to compile it on 
windows, and use wkt to create features in a memory data source.
2 - Have Mapnik read a temporary file of JSON/GML/whatever on disk.
3 - Add a sqlite/spatialite layer to Mapnik and adjust the layer to hold the 
correct features as needed.

Does this sound right?

I noticed you mention I could create two mapnik images (say base mapping and 
dynamic mapping) and blend them together (mapnik.Image.blend()). Is there a 
performance advantage to doing this versus including all layers in one main 
image?

Thanks for the help.

Angus


--- On Thu, 9/23/10, Dane Springmeyer <[email protected]> wrote:

> From: Dane Springmeyer <[email protected]>
> Subject: Re: [Mapnik-users] Mapnik for desktop applications
> To: "Angus Dickey" <[email protected]>
> Cc: [email protected]
> Received: Thursday, September 23, 2010, 4:52 PM
> 
> On Sep 23, 2010, at 8:15 PM, Angus Dickey wrote:
> 
> > Hi,
> > 
> > I am new to Mapnik and was thinking about using Mapnik
> as the mapping solution for a desktop GIS application. My
> initial thoughts were to use:
> > 
> > - Python
> > - wxPython
> > - Mapnik
> > 
> 
> Sounds fun!
> 
> > With other packages (OGR/GDAL, Shapely, pyproj, etc.)
> if needed.
> 
> Yep.
> 
> > 
> > I have looked at the Mapnik samples and API and I know
> it can make a great looking map, what I am not sure about is
> the ability to add a temporary/dynamic layer.
> 
> You have full access in Python for dynamically constructing
> both styles and layers. I recommend creating your own
> container for them, then pushing them into a mapnik.Map once
> you are ready to render.
> 
> You can also have a base set of styles+layers in a
> mapnik.Map that is not temporary and then render temp layers
> to a different mapnik.Image, then blend the two together
> using im.blend().
> 
> > What I would like to be able to do is have Mapnik set
> up with static background mapping data and add markup (or
> temp layers) to Mapnik made up of geometry
> (points/lines/polys) calculated elsewhere.
> 
> Sort of. It is not yet exposed in Mapnik properly to push
> geometries straight into a memory Datasource (only points
> are wrapped via PointDatasource), so its easier to read from
> disk (even if you create all definitions of the layer on the
> fly).
> 
> > Is this possible in Mapnik? I see there are some
> provisions for a "Memory Datasource" but it looks like it
> only supports points?
> 
> Right. Basically we've been waiting on a proper wkt/wkb
> parsing support.
> 
> However, you can actually do this right now if you have
> shapely installed, see:
> 
> http://code.google.com/p/mapnik-utils/source/detail?r=1049
> 
> NOTE: depends on Mapnik trunk.
> 
> > 
> > Anyone have any thoughts on how this might be done? I
> thought about having a text based OGR layer (GeoJSON?) added
> to Mapnik and changing this file on disk; doesn't really
> seem like a good idea though...
> 
> Its a fine idea and one that is used by nikweb. But yes, it
> would feel nicer to push them in dynamically and for now see
> the above script and let me know your comments. Alberto
> Valverde was the clever Mapnik developer that added the
> shapely wkb reading support, which I think is meant to be
> temporary but works nicely from my limited tests.
> 
> Dane
> 
> > 
> > Any info or thoughts are appreciated.
> > 
> > Thanks,
> > 
> > ~Angus
> > 
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > 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