[GRASS5] v.in.ogr behaviour

marcos boullón magán marcosboullon at gmail.com
Thu Mar 23 11:10:45 EST 2006


Hello again,

If you are still receiving a segfault with GRASS 6.1 cvs version in
file lib/gis/key_value1.c, line 107, as said in a previous email, you
can try the following patch (attached) to gather more information on
the error conditions (but don't apply the Chos's patch!).

The patch containts code to show the comparing strings process while
running in G_find_key_value() function. Patch and compile as
necessary, then in GRASS try v.out.ogr/v.in.ogr and compare your
results with the attached ones:

$ cd grass6/lib/gis
$ patch < key_vect1.patch
...
GRASS 6.1.cvs (spearfish60):~/cvsgrass/grass6 > v.out.ogr in=soils
type=area dsn=/tmp/ olayer=soils 2> v.out.ogr.stderr.txt
GRASS 6.1.cvs (spearfish60):~/cvsgrass/grass6 > md5sum /tmp/soils.shp
24a6c8a36089cfd661b417807546f8ba  /tmp/soils.shp
GRASS 6.1.cvs (spearfish60):~/cvsgrass/grass6 > v.in.ogr
dsn=/tmp/soils.shp out=test1 2> v.in.ogr.stderr.txt

If not succesfully finished, v.in.ogr.stderr.txt containts the
"trace". Compare with mine and report.

Good luck,

M.

2006/3/23, marcos boullón magán <marcosboullon at gmail.com>:
> Hi Stephan,
>
> Sorry, but it seems that Cho's patch is not correct.
>
> In file lib/proj/convert.c, line 227, the definition of
> GPJ_osr_to_grass() states that fourth parameter is type
> "OGRSpatialReferenceH", not "OGRSpatialReferenceH *" (a value, not a
> pointer to the value):
>
> int GPJ_osr_to_grass(struct Cell_head *cellhd, struct Key_Value **projinfo,
>                      struct Key_Value **projunits, OGRSpatialReferenceH hSRS,
>                      int interactive)
>
> In file vector/v.in.ogr/main.c, line 384, the cvs code does a correct
> use of this function:
>
>         if ( GPJ_osr_to_grass( &cellhd, &proj_info,
>                                &proj_units, Ogr_projection, 0) < 0 )
>
> The patch incorrectly sends a pointer to the Ogr_projection variable
> (of type OGRSpatialReferenceH) insted of the actual value as fourth
> parameter:
>
>         if ( GPJ_osr_to_grass( &cellhd, &proj_info,
>                                &proj_units, &Ogr_projection, 0) < 0 )
>
> When the patch is applied --wrong datatype is used--
> GPJ_osr_to_grass() fails to identify the reference system: file
> lib/proj/convert.c, line 248 (no Geographic coord system, nor
> Projected, then it assumes coord system is Projected XY) and you get
> the error message "ERROR: Projection of dataset does not appear to
> match current location. [...] cellhd.proj = 0 (unreferenced/unknown)".
>
> In conclussion, patch is incorrect.
>
> If you still get segfaults with GRASS cvs version, I'm afraid the
> problem is not related to this. (Try an interative debugging to find
> in which function it fails, then check which parameter produces the
> crash and follow back its assignements).
>
> Hope you can solve it. Regards,
>
> M.
>
> 2006/3/23, Stephan Holl <holl at gdf-hannover.de>:
> > Hello marcos,
> >
> > On Thu, 23 Mar 2006 13:01:54 +0100 "marcos boullón magán"
> > <marcosboullon at gmail.com> wrote:
> >
> > > Hello Stephan,
> > >
> > > After applying the patch, the output is:
> > >
> > > marcos at venux:~/cvsgrass$ cd grass6/vector/v.in.ogr/
> > > marcos at venux:~/cvsgrass/grass6/vector/v.in.ogr$ patch < ~/cho.patch
> > > marcos at venux:~/cvsgrass/grass6/vector/v.in.ogr$ make
> > > marcos at venux:~/cvsgrass/grass6/vector/v.in.ogr$ cd ../..
> > > marcos at venux:~/cvsgrass/grass6/vector/v.in.ogr$ su
> > > venux:/home/marcos/cvsgrass/grass6/vector/v.in.ogr# make install
> > > marcos at venux:~/cvsgrass/grass6/vector/v.in.ogr$ grass61
> > >
> > > GRASS 6.1.cvs (spearfish60):~/cvsgrass/grass6/vector/v.in.ogr >
> > > v.out.ogr in=soils type=area dsn=/tmp/ olayer=soils
> > > Exporting 737 areas (may take some time) ...
> > >  100%
> > > 737 features written
> > > WARNING: 1 features without attributes written
> > >
> > > GRASS 6.1.cvs (spearfish60):~/cvsgrass/grass6/vector/v.in.ogr >
> > > v.in.ogr dsn=/tmp/soils.shp out=test1
> > > ERROR: Projection of dataset does not appear to match current
> > > location.
> > >
> > >        LOCATION PROJ_INFO is:
> > >        name: UTM
> > >        datum: nad27
> > >        nadgrids: conus
> > >        proj: utm
> > >        ellps: clark66
> > >        a: 6378206.4000000004
> > >        es: 0.0067686580
> > >        f: 294.9786982000
> > >        zone: 13
> > >
> > >        cellhd.proj = 0 (unreferenced/unknown)
> > >
> > >        You can use the -o flag to v.in.ogr to override this check.
> > >        Consider to generate a new location with 'location' parameter
> > > from input data set.
> >
> > [...]
> >
> > This is what I recognize as well. So where to look for the error now?
> >
> > Perhaps someone with more knowledge about the projection/datum-stuff
> > could investigate the code?
> >
> > Thank you
> >
> >         Stephan
> >
> > --
> > GDF Hannover - Solutions for spatial data analysis and remote sensing
> > Hannover Office      -     Mengendamm 16d      -     D-30177 Hannover
> > Internet: www.gdf-hannover.de      -      Email: holl at gdf-hannover.de
> > Phone : ++49-(0)511.39088507       -        Fax: ++49-(0)511.39088508
> >
>
> --
> -- marcos boullón magán
>

--
-- marcos boullón magán
-------------- next part --------------
A non-text attachment was scrubbed...
Name: key_value1.zip
Type: application/zip
Size: 8347 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20060323/d7e2ad56/key_value1.zip


More information about the grass-dev mailing list