Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python datasource input plugin missing #253

Open
dolfandringa opened this issue Feb 26, 2022 · 1 comment
Open

python datasource input plugin missing #253

dolfandringa opened this issue Feb 26, 2022 · 1 comment

Comments

@dolfandringa
Copy link

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?

@mathisloge
Copy link
Collaborator

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:

  1. create a c++ mapnik plugin like the others
  2. the plugin loading of mapnik is as followed: load .input file and look for a symbol datasource_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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants