Is PythonDatasource supported in Mapnik 3?

96 views
Skip to first unread message

Matt Terry

unread,
Jul 5, 2017, 5:42:49 PM7/5/17
to mapnik
Hi,

I'm in the process of upgrading from Mapnik 2.2 to 3.  I use Mapnik through the Python bindings, primarily through PythonDatasource.  Is PythonDatasources still supported in Mapnik 3?

Mapnik 2.1 introduced a Python plugin ([1], [2]) that enabled python data sources.  That is, libmapnik would call back into Python to get the features for a given bounding box.  One would use this via `mapnik.Python` [3] and `mapnik.PythonDatasource` [4].  This function/class is still defined in the Python bindings, but the supporting code in mapnik appears to have been removed when the Python bindings were split into their own repo.

When I run the following code (simplified from an example on the wiki [5])

import mapnik                                                                   
                                                                                
class TestDatasource(mapnik.PythonDatasource):                                  
    def features(self, query):                                                  
        return []                                                               
                                                                                
ds = mapnik.Python(factory='TestDatasource')

I get the following error:

RuntimeError: Could not create datasource for type: 'python' (searched for datasource plugins in '/var/lib/conda/envs/nextdoor/lib/mapnik/input') 

I'm building libmapnik & python-mapnik from source, so it is possible that I've built them incorrectly.  That said, this looks like PythonDatasource is no long supported and `mapnik.Python` and `mapnik.PythonDatasource` are vestigial.  Can someone more familiar with the guts of Mapnik confirm that this is indeed the case?

-matt

PS I have conda builds for libmapnik and python-mapnik if anyone is interested in reproducing my error. [6]

[6] conda install -c mrterry python-mapnik

Matt Terry

unread,
Jul 7, 2017, 1:29:55 PM7/7/17
to mapnik
The Python input plugin has been moved to a separate repo.  Quoting talaj from github:

Some plugins have been moved from Mapnik repo to https://github.com/mapnik/non-core-plugins. See mapnik/mapnik#2773.
Reply all
Reply to author
Forward
0 new messages