[GRASS-dev] [GRASS-user] Unable to read .prj file

Markus Metz markus.metz.giswork at gmail.com
Sat Feb 9 09:18:05 PST 2019


On Sat, Feb 9, 2019 at 12:05 PM Markus Neteler <neteler at osgeo.org> wrote:
>
> (adding grass-dev)
>
> On Sat, Feb 9, 2019 at 11:14 AM Markus Neteler <neteler at osgeo.org> wrote:
> > On Sat, Feb 9, 2019 at 10:57 AM Helmut Kudrnovsky <hellik at web.de> wrote:
> > >
> > > >Just the GRASS GIS logics (still) prevent from accepting a .prj file
as
> > > input.
> > >
> > > at least in the GUI and the location wizzard you can use a .prj-file
to
> > > create a new location.
> >
> > Yes but not on the beloved command line:
> >
> > 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

g.proj wkt=bla.prj -p
works

>
> 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 should be updated accordingly?

Easy to implement, please open a ticket such that it does not get forgotten.

Markus M
>
> Markus
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20190209/592e79a6/attachment.html>


More information about the grass-dev mailing list