python-mapnik
python-mapnik copied to clipboard
python datasource input plugin missing
I am trying to make my own python datasource (and add docs for it). All code seems to be present in the python-mapnik repository, except for the python input plugin. But it's also not present in the mapnik repository afaiks.
I made a class in geopandas_datasource.py
named GeopandasDatasource
and then thought I needed to register it like this:
mapnik.register_plugins(str(Path('.').resolve()))
l.datasource = mapnik.Python(factory='geopandas_datasource:GeoPandasDataSource', gdf=frame)
but I get an error:
RuntimeError: Could not create datasource for type: 'python' (searched for datasource plugins in '/home/dolfandringa/Documents/GPS tracks, /usr/local/lib/mapnik/input')
And now that I dig deeper, in /usr/local/lib/mapnik/input
I only see the following:
csv.input
geojson.input
pgraster.input
raster.input
sqlite.input
gdal.input
ogr.input
postgis.input
shape.input
topojson.input
no python.input. And in the mapnik code there is also no code for one. But I can't find any code for it either in the python-mapnik. What am I missing here?
actually you would need to create a c++ plugin that wraps those. I don't know of any python plugin. All those other plugins are c++ libraries.
So you might be able to do this, but it would be a bit more complicated.
I would think of something like this:
- create a c++ mapnik plugin like the others
- the plugin loading of mapnik is as followed: load
.input
file and look for a symboldatasource_name
and call it. This gets the name for the plugin under which it will be registered. Now, here it gets tricky: You would need to register e.g. a plugin called python which in turn have own bindings to load data from python calls (e.g. geopandas)
The symbols for plugins might change with upcoming mapnik v4