Unable to read .prj file

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to read .prj file

Rich Shepard
Environment: Slackware-14.2, Grass 7.7.svn (r74061).

Trying to create a new location using a shapefile .prj. GRASS tells me it
cannot read the file using gdal. There are five mapsets I want to import and
they all have the same .prj file:

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]]

Do I look for the appropriate EPSG code or am I doing something incorrectly?

Advice appreciated,

Rich


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Unable to read .prj file

Markus Neteler
On Fri, Feb 8, 2019 at 11:24 PM Rich Shepard <[hidden email]> wrote:
>
> Environment: Slackware-14.2, Grass 7.7.svn (r74061).
>
> Trying to create a new location using a shapefile .prj. GRASS tells me it
> cannot read the file using gdal.

I also find that a bit annoying. Indeed, you need to specify the .shp
file and not the .prj file (which doesn't make much sense).

> There are five mapsets I want to import and they all have the same .prj file:
> 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]]
>
> Do I look for the appropriate EPSG code or am I doing something incorrectly?

Using the "testepsg" script from GDAL I could verify your file:

testepsg bla.prj
Validate Succeeds.
WKT[bla.prj] =
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]]

Simplified WKT[bla.prj] =
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]]

Old Style WKT[bla.prj] =
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]]
ESRI'ified WKT[bla.prj] =
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]]
PROJ.4 rendering of [bla.prj] = +proj=utm +zone=11 +ellps=GRS80
+units=m +no_defs

Also GDAL is happy:

gdalsrsinfo bla.prj

PROJ.4 : +proj=utm +zone=11 +datum=NAD83 +units=m +no_defs

OGC WKT :
PROJCS["NAD_1983_UTM_Zone_11N",
    GEOGCS["GCS_North_American_1983",
        DATUM["North_American_Datum_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]]


Just the GRASS GIS logics (still) prevent from accepting a .prj file as input.

Please open a ticket for it, IMHO this should be improved.
(for now use the .shp file)

Markus
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Unable to read .prj file

Helmut Kudrnovsky
>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.



-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
best regards
Helmut
Reply | Threaded
Open this post in threaded view
|

Re: Unable to read .prj file

Helmut Kudrnovsky
In reply to this post by Markus Neteler
>> Trying to create a new location using a shapefile .prj. GRASS tells me it
>> cannot read the file using gdal.
>
>I also find that a bit annoying. Indeed, you need to specify the .shp
>file and not the .prj file (which doesn't make much sense).

just tried it here with winGRASS 7.6 and winGRASS 7.7.svn, defining and
creating a new location with Rich's prj-file works here.

(Sat Feb 09 11:12:03 2019)                                                      
g.proj -j                                                                      
+proj=utm
+no_defs
+zone=11
+a=6378137
+rf=298.257222101
+towgs84=0.000,0.000,0.000
+to_meter=1
(Sat Feb 09 11:12:03 2019) Befehl ausgeführt (0 Sek)                            
(Sat Feb 09 11:12:22 2019)                                                      
g.proj -w                                                                      
PROJCS["UTM Zone 11, Northern Hemisphere",
    GEOGCS["grs80",
        DATUM["North_American_Datum_1983",
           
SPHEROID["Geodetic_Reference_System_1980",6378137,298.257222101]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    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]]





-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
best regards
Helmut
Reply | Threaded
Open this post in threaded view
|

Re: Unable to read .prj file

Markus Neteler
In reply to this post by Helmut Kudrnovsky
On Sat, Feb 9, 2019 at 10:57 AM Helmut Kudrnovsky <[hidden email]> 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

Exiting...


Markus
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Unable to read .prj file

Markus Neteler
(adding grass-dev)

On Sat, Feb 9, 2019 at 11:14 AM Markus Neteler <[hidden email]> wrote:

> On Sat, Feb 9, 2019 at 10:57 AM Helmut Kudrnovsky <[hidden email]> 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

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?

Markus
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Unable to read .prj file

Rich Shepard
In reply to this post by Helmut Kudrnovsky
On Sat, 9 Feb 2019, Helmut Kudrnovsky 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.

Helmut,

I was using the GUI's location wizard rather than the command line. I will
enter in trac a requiest to clarify the language.

I've used the GUI's location wizard before without having the .prj file
rejected as unreadable. It's been a couple of months since I last imported a
shapefile and I well might have pointed to the .shp files before. As Markus
wrote, specifing a .prj file certainly looks appropriate when the widget
askes for a well-known projection file.

Regards,

Rich

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user