[GIS] Could not create datasource

mapniktilecache

I'm fighting with an error I can't figure out where it is coming from.
Tried to compile all the things and used the latest unstable/stable ppa repositories as well, can't find the issue where it is comeing from.

Servers Setup is:

  • Postgres 9.1
  • Postgis 2.0 (2.1)
  • Mapnik 2.0
  • TileCache latest

    An error occurred: Could not create datasource. No plugin found for type ' postgis
    ' (searched in: /usr/local/lib/mapnik/input) (encountered during parsing of layer 'landuse_gen0' in map '/var/mapnik/osm.xml')
    File "/usr/local/lib/python2.7/dist-packages/TileCache-2.11-py2.7.egg/TileCache/Service.py", line 343, in cgiHandler
    format, image = service.dispatchRequest( params, path_info, req_method, host )
    File "/usr/local/lib/python2.7/dist-packages/TileCache-2.11-py2.7.egg/TileCache/Service.py", line 208, in dispatchRequest
    return self.renderTile(tile, params.has_key('FORCE'))
    File "/usr/local/lib/python2.7/dist-packages/TileCache-2.11-py2.7.egg/TileCache/Service.py", line 138, in renderTile
    data = layer.render(tile, force=force)
    File "/usr/local/lib/python2.7/dist-packages/TileCache-2.11-py2.7.egg/TileCache/Layer.py", line 436, in render
    image = self.renderMetaTile(metatile, tile)
    File "/usr/local/lib/python2.7/dist-packages/TileCache-2.11-py2.7.egg/TileCache/Layer.py", line 396, in renderMetaTile
    data = self.renderTile(metatile)
    File "/usr/local/lib/python2.7/dist-packages/TileCache-2.11-py2.7.egg/TileCache/Layers/Mapnik.py", line 39, in renderTile
    mapnik.load_map(m,self.mapfile)

Best Answer

It sounds like you first tried a source install of Mapnik. At this time input plugins were properly installed into the default directory at /usr/local/lib/mapnik/input. But the postgis plugin was not built because you did not have the pg_config program available and/or the postgres-devel package. If you followed http://github.com/mapnik/mapnik/wiki/UbuntuInstallation correctly this would not happen.

So, they way to fix this would be to do: sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 postgresql-9.1-postgis and then re-configure and re-install Mapnik like:

cd 
./configure && sudo make install

But above you also said you tried the latest unstable/stable ppa repositories as well.... First of all: do not mix a source install with ppa installs. If you want to switch to using the PPA packages then go uninstall the Mapnik you source compiled like:

cd 
sudo make uninstall
Related Question