[GRASS-dev] [GRASS GIS] #3750: Grass 7.7.svn (r74061): GUI location widget cannot read .prj file for new location

GRASS GIS trac at osgeo.org
Sat Feb 9 09:00:22 PST 2019


#3750: Grass 7.7.svn (r74061): GUI location widget cannot read .prj file for new
location
-----------------------+---------------------------------------
  Reporter:  rshepard  |      Owner:  grass-dev@…
      Type:  defect    |     Status:  new
  Priority:  normal    |  Milestone:
 Component:  wxGUI     |    Version:  svn-trunk
Resolution:            |   Keywords:  locaton wizard, .prj file
       CPU:  x86-32    |   Platform:  Linux
-----------------------+---------------------------------------

Comment (by neteler):

 {{{
 # write out user's WKT string as .prj file
 echo
 'PROJCS["NAD_1983_UTM_Zone_11N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-117],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]'
 > bla.prj

 # attempt to generate a new location from it:
 grass77 -c bla.prj  ~/grassdata/mylocation
 Starting GRASS GIS...
 Creating new GRASS GIS location <mylocation>...
 ERROR: ERROR 4: `bla.prj' not recognized as a supported file format.
 ERROR: Unable to read georeferenced file <bla.prj> using GDAL library
 }}}


 I checked further and found a difference between g.proj and
 gdalsrsinfo opening files:

 general/g.proj/input.c, line 271 :
 (inofficially: https://github.com/GRASS-GIS/grass-
 ci/blob/master/general/g.proj/input.c#L271)

 {{{
         if ((gdal_ds = GDALOpen(geofile, GA_ReadOnly))) {
 }}}

 apps/gdalsrsinfo.cpp, line 306
 https://github.com/OSGeo/gdal/blob/master/gdal/apps/gdalsrsinfo.cpp#L306

 {{{
     poGDALDS = static_cast<GDALDataset *>(GDALOpenEx( pszInput, 0,
 nullptr, nullptr, nullptr ));
 }}}


 It seems that GDALOpenEx() is more flexible concerning the input (it
 exists since GDAL 2.0):
 https://www.gdal.org/classGDALDataset.html#a9cb8585d0b3c16726b08e25bcc94274a

 Perhaps g.proj could be updated accordingly?

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3750#comment:2>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list