[GRASS-dev] [bug #4898] (grass) g.proj -p segfaults because of missing datum name

this bug's URL: http://intevation.de/rt/webrt?serial_num=4898
-------------------------------------------------------------------------

Subject: g.proj -p segfaults because of missing datum name

Platform: GNU/Linux/x86
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: cvs_head_20060724

Trying to use the "Use georeferenced file" for new location definition in the start-up screen I get a segfault.
Searching for the cause, I find that it's in the call to g.proj, as calling g.proj -p on the file gives the following:

g.proj -p UrbAdm_Mu.shp

Trying to open with GDAL...ERROR 4: `UrbAdm_Mu.shp' not recognised as a supported file format.

Trying to open with OGR......succeeded.
WARNING: Datum 'unnamed' not recognised by GRASS and no parameters found.
         Datum transformation will not be possible using this projection
         information.
Segmentation fault

The warning comes from GPJ_osr_to_grass() which is in lib/proj/convert.c. I don't know why it segfaults, though.

Do we absolutely need a datum name as the information contained in the .prj file seems to be sufficient to create a location ?

ogrinfo gives the following on the file:

$ ogrinfo -so UrbAdm_Mu.shp UrbAdm_Mu
INFO: Open of `UrbAdm_Mu.shp'
using driver `ESRI Shapefile' successful.

Layer name: UrbAdm_Mu
Geometry: Polygon
Feature Count: 19
Extent: (141192.712000, 161464.403000) - (158005.472000, 178169.335000)
Layer SRS WKT:
PROJCS["Belge 1972 / Belgian Lambert 72",
    GEOGCS["unnamed",
        DATUM["unnamed",
            SPHEROID["International_1924",6378388,297.0000000000601]],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",51.16666723333333],
    PARAMETER["standard_parallel_2",49.8333339],
    PARAMETER["latitude_of_origin",90],
    PARAMETER["central_meridian",4.367486666666666],
    PARAMETER["false_easting",150000.013],
    PARAMETER["false_northing",5400088.438],
    UNIT["Meter",1]]
MUID: Real (20.0)
POLID: Real (20.0)
REID: Real (20.0)
MUNC: String (5.0)
MU3C: String (3.0)
MUDN: String (24.0)
MUDNIN: String (2.0)
MUFN: String (24.0)
MUFNIN: String (2.0)

Moritz

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=4898
-------------------------------------------------------------------------

Subject: g.proj -p segfaults because of missing datum name

Platform: GNU/Linux/x86
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: cvs_head_20060724

Trying to use the "Use georeferenced file" for new location definition in the start-up screen I get a segfault.
Searching for the cause, I find that it's in the call to g.proj, as calling g.proj -p on the file gives the following:

g.proj -p UrbAdm_Mu.shp

Trying to open with GDAL...ERROR 4: `UrbAdm_Mu.shp' not recognised as a supported file format.

Trying to open with OGR......succeeded.
WARNING: Datum 'unnamed' not recognised by GRASS and no parameters found.
         Datum transformation will not be possible using this projection
         information.
Segmentation fault

The warning comes from GPJ_osr_to_grass() which is in lib/proj/convert.c. I don't know why it segfaults, though.

Do we absolutely need a datum name as the information contained in the .prj file seems to be sufficient to create a location ?

I tried introducing the datum name into the prj file and now I get:

A datum name bel72 (Reseau_National_Belge_1972) was specified without transformation parameters.
Note that the GRASS default for bel72 is towgs84=-99.1,53.3,-112.5,0.419,-0.830,1.885,-1.00.
Segmentation fault

Moritz