[GRASS-user] Read GRASS vector data from mapnik

Hi all,

I'm trying to use mapnik to generate figures from a GRASS mapset
though OGR[0], but it seems that the GRASS format is not supported.
If I try:

{{{
#!python
import mapnik

schools = mapnik.Ogr(base='/data/gis/nc_basic_spm_grass7/PERMANENT/vector/schools',
                     file='head',
                     layer='1')
}}}

I got:

{{{
RuntimeError: OGR Plugin: connection failed:
/data/gis/nc_basic_spm_grass7/PERMANENT/vector/schools/head was not
found or is not a supported format
}}}

In theory OGR support the vector format of GRASS[1].
There is someone that use mapnik and GRASS that know how to solve it?

Best regrads.

Pietro

[0] https://github.com/mapnik/mapnik/wiki/OGR
[1] http://www.gdal.org/ogr/drv_grass.html

Hi,

2013/4/16 Pietro <peter.zamb@gmail.com>:

In theory OGR support the vector format of GRASS[1].
There is someone that use mapnik and GRASS that know how to solve it?

is your OGR library compiled with GRASS support?

ogrinfo --formats

Note that GDAL-GRASS driver needs to be updated for GRASS 7 [1].

Martin

[1] http://trac.osgeo.org/gdal/ticket/2953

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Tue, Apr 16, 2013 at 11:10 AM, Martin Landa <landa.martin@gmail.com> wrote:

In theory OGR support the vector format of GRASS[1].
There is someone that use mapnik and GRASS that know how to solve it?

is your OGR library compiled with GRASS support?

ogrinfo --formats

No, my OGR library was not compiled with GRASS support! :slight_smile:
sorry...

Note that GDAL-GRASS driver needs to be updated for GRASS 7 [1].
[1] http://trac.osgeo.org/gdal/ticket/2953

What exactly should I do?

I've downloaded the last version of gdal-svn and configured it, with:
{{{
./configure --prefix=/home/pietro/.local/ \
     --with-grass=/home/pietro/docdat/src/gis/grass/grass_trunk/dist.x86_64-unknown-linux-gnu
\
     --with-netcdf \
     --with-libtiff \
     --with-sqlite3 \
     --with-geotiff \
     --with-python=/usr/bin/python2 \
     --without-libtool --with-curl \
     --with-hdf5 \
     --with-geos \
     --with-png
}}}

But compiling I got:
{{{
grass57dataset.cpp:50:38: error: declaration of C function ‘char*
GPJ_grass_to_wkt(Key_Value*, Key_Value*, int, int)’ conflicts with
          int esri_style, int prettify);
                                      ^
In file included from
/home/pietro/docdat/src/gis/grass/grass_trunk/dist.x86_64-unknown-linux-gnu/include/grass/gprojects.h:91:0,
                 from grass57dataset.cpp:45:
/home/pietro/docdat/src/gis/grass/grass_trunk/dist.x86_64-unknown-linux-gnu/include/grass/defs/gprojects.h:17:7:
error: previous declaration ‘char* GPJ_grass_to_wkt(const Key_Value*,
const Key_Value*, int, int)’ here
char *GPJ_grass_to_wkt(const struct Key_Value *, const struct
Key_Value *, int, int);
       ^
ogrgrassdatasource.cpp: In member function ‘int
OGRGRASSDataSource::Open(const char*, int, int, int)’:
ogrgrassdatasource.cpp:191:28: error: ‘GV_FATAL_PRINT’ was not
declared in this scope
     Vect_set_fatal_error ( GV_FATAL_PRINT ); // Print error and continue
                            ^
ogrgrassdatasource.cpp:191:43: error: ‘Vect_set_fatal_error’ was not
declared in this scope
     Vect_set_fatal_error ( GV_FATAL_PRINT ); // Print error and continue
                                           ^
make[2]: *** [../o/grass57dataset.o] Error 1
make[2]: Leaving directory `/home/pietro/docdat/src/gis/gdal/frmts/grass'
make[1]: *** [grass-install-obj] Error 2
make[1]: Leaving directory `/home/pietro/docdat/src/gis/gdal/frmts'
make: *** [frmts-target] Error 2
make: *** Waiting for unfinished jobs....
make[3]: *** [../o/ogrgrassdatasource.o] Error 1
make[3]: Leaving directory
`/home/pietro/docdat/src/gis/gdal/ogr/ogrsf_frmts/grass'
make[2]: *** [grass-target] Error 2
make[2]: Leaving directory `/home/pietro/docdat/src/gis/gdal/ogr/ogrsf_frmts'
make[1]: *** [sublibs] Error 2
make[1]: Leaving directory `/home/pietro/docdat/src/gis/gdal/ogr'
make: *** [ogr-target] Error 2
}}}

Any hints?

Pietro

On Tue, Apr 16, 2013 at 12:48 PM, Pietro <peter.zamb@gmail.com> wrote:

On Tue, Apr 16, 2013 at 11:10 AM, Martin Landa <landa.martin@gmail.com> wrote:

In theory OGR support the vector format of GRASS[1].
There is someone that use mapnik and GRASS that know how to solve it?

is your OGR library compiled with GRASS support?

ogrinfo --formats

No, my OGR library was not compiled with GRASS support! :slight_smile:

I recommend to use the plugin rather than direct compilation:
http://grasswiki.osgeo.org/wiki/Compile_and_install_GDAL-GRASS_plugin

Markus