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

GRASS GIS trac at osgeo.org
Sat Feb 9 09:52:32 PST 2019


#3750: Grass 7.7.svn (r74061): CLI location creation: 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 mmetz):

 Replying to [comment:4 mmetz]:
 > Replying to [comment:2 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):
 >
 > No, the trick is here:
 >
 https://github.com/OSGeo/gdal/blob/a0e1932541cb4edc6d2e254d7af6f64cd0dc0806/gdal/apps/gdalsrsinfo.cpp#L334
 >
 > If `GDALOpenEx()` fails, it checks if it is a *.prj file

 Please try trunk r74072

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



More information about the grass-dev mailing list