node-mapnik-sample-code icon indicating copy to clipboard operation
node-mapnik-sample-code copied to clipboard

In-memory data source for non-point geometries

Open guigrpa opened this issue 6 years ago • 5 comments

Is there an example of an in-memory data source with non-point geometries? I couldn't find any. Is this even possible? I noticed from the code that there are plans to support WKT format, but it's not yet implemented.

On the other side, since standard Datasource objects always read data from file, is there a work-around for injecting non-point geometries into Mapnik programmatically?

guigrpa avatar Dec 01 '17 11:12 guigrpa

Yes, see https://github.com/mapnik/node-mapnik/issues/779 and also https://github.com/mapnik/node-mapnik/issues/779

springmeyer avatar Dec 01 '17 16:12 springmeyer

Is there an example for using this inline geojson string?

guigrpa avatar Dec 01 '17 17:12 guigrpa

Yes, sorry one of the links above was meant to be to https://github.com/mapnik/python-mapnik/issues/126#issuecomment-326819222. There you can see a link other code which offers an example.

springmeyer avatar Dec 01 '17 17:12 springmeyer

Thanks a lot! I'll have a look

guigrpa avatar Dec 01 '17 17:12 guigrpa

Inlining GeoJSON works perfectly, and in my experiment runs >10x faster than via the OGR plugin. Thanks a lot for the insight!

Any similar solution for rasters? Is it possible in general to create a Mapnik.Datasource with an arbitrary type and suitable inline fields?

guigrpa avatar Dec 04 '17 08:12 guigrpa