Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector: superfluous layer 0 reported for a polygon layer #46

Open
florisvdh opened this issue Jun 15, 2024 · 1 comment
Open

vector: superfluous layer 0 reported for a polygon layer #46

florisvdh opened this issue Jun 15, 2024 · 1 comment

Comments

@florisvdh
Copy link

Contrary to a point vector layer, for a polygon vector layer an extra layer "0" is reported as the first layer, containing linestrings and no attributes.

The examples below use vector data sources in the GRASS GIS 'North Carolina basic dataset', downloaded from https://grass.osgeo.org/download/data/.

ogrinfo polygons example (has the problem)
$ ogrinfo -so -al /home/floris/grassdata/nc_basic_spm_grass7/PERMANENT/vector/zipcodes/head
Warning 1: GRASS warning: GISBASE environment variable was not set, using:
/usr/lib/grass83
INFO: Open of `/home/floris/grassdata/nc_basic_spm_grass7/PERMANENT/vector/zipcodes/head'
      using driver `OGR_GRASS' successful.

Layer name: 0
Geometry: Line String
Feature Count: 158
Extent: (610047.866451, 196327.520901) - (677060.680666, 258102.572146)
Layer SRS WKT:
PROJCRS["unknown",
    BASEGEOGCRS["grs80",
        DATUM["North American Datum 1983",
            ELLIPSOID["Geodetic_Reference_System_1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]],
            ID["EPSG",6269]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["unnamed",
        METHOD["Lambert Conic Conformal (2SP)",
            ID["EPSG",9802]],
        PARAMETER["Latitude of false origin",33.75,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8821]],
        PARAMETER["Longitude of false origin",-79,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8822]],
        PARAMETER["Latitude of 1st standard parallel",36.1666666666667,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8823]],
        PARAMETER["Latitude of 2nd standard parallel",34.3333333333333,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8824]],
        PARAMETER["Easting at false origin",609601.22,
            LENGTHUNIT["metre",1],
            ID["EPSG",8826]],
        PARAMETER["Northing at false origin",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8827]]],
    CS[Cartesian,2],
        AXIS["easting",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["northing",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
Data axis to CRS axis mapping: 1,2

Layer name: zipcodes
Geometry: Polygon
Feature Count: 48
Extent: (610047.866451, 196327.520901) - (677060.680666, 258102.572146)
Layer SRS WKT:
PROJCRS["unknown",
    BASEGEOGCRS["grs80",
        DATUM["North American Datum 1983",
            ELLIPSOID["Geodetic_Reference_System_1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]],
            ID["EPSG",6269]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["unnamed",
        METHOD["Lambert Conic Conformal (2SP)",
            ID["EPSG",9802]],
        PARAMETER["Latitude of false origin",33.75,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8821]],
        PARAMETER["Longitude of false origin",-79,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8822]],
        PARAMETER["Latitude of 1st standard parallel",36.1666666666667,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8823]],
        PARAMETER["Latitude of 2nd standard parallel",34.3333333333333,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8824]],
        PARAMETER["Easting at false origin",609601.22,
            LENGTHUNIT["metre",1],
            ID["EPSG",8826]],
        PARAMETER["Northing at false origin",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8827]]],
    CS[Cartesian,2],
        AXIS["easting",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["northing",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
Data axis to CRS axis mapping: 1,2
cat: Integer (0.0)
OBJECTID: Integer (0.0)
WAKE_ZIPCO: Real (0.0)
PERIMETER: Real (0.0)
ZIPCODE_: Real (0.0)
ZIPCODE_ID: Real (0.0)
ZIPNAME: String (0.0)
ZIPNUM: Real (0.0)
ZIPCODE: String (0.0)
NAME: String (0.0)
SHAPE_Leng: Real (0.0)
SHAPE_Area: Real (0.0)
ogrinfo points example (is OK)
$ ogrinfo -so -al /home/floris/grassdata/nc_basic_spm_grass7/PERMANENT/vector/schools/head
Warning 1: GRASS warning: GISBASE environment variable was not set, using:
/usr/lib/grass83
INFO: Open of `/home/floris/grassdata/nc_basic_spm_grass7/PERMANENT/vector/schools/head'
      using driver `OGR_GRASS' successful.

Layer name: schools
Geometry: Point
Feature Count: 167
Extent: (619215.133883, 203559.011362) - (671714.551108, 248159.844411)
Layer SRS WKT:
PROJCRS["unknown",
    BASEGEOGCRS["grs80",
        DATUM["North American Datum 1983",
            ELLIPSOID["Geodetic_Reference_System_1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]],
            ID["EPSG",6269]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["unnamed",
        METHOD["Lambert Conic Conformal (2SP)",
            ID["EPSG",9802]],
        PARAMETER["Latitude of false origin",33.75,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8821]],
        PARAMETER["Longitude of false origin",-79,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8822]],
        PARAMETER["Latitude of 1st standard parallel",36.1666666666667,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8823]],
        PARAMETER["Latitude of 2nd standard parallel",34.3333333333333,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8824]],
        PARAMETER["Easting at false origin",609601.22,
            LENGTHUNIT["metre",1],
            ID["EPSG",8826]],
        PARAMETER["Northing at false origin",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8827]]],
    CS[Cartesian,2],
        AXIS["easting",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["northing",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
Data axis to CRS axis mapping: 1,2
cat: Integer (0.0)
TAG: String (0.0)
NAMESHORT: String (0.0)
NAMELONG: String (0.0)
CORECAPACI: Real (0.0)
MOBILEUNIT: Real (0.0)
MOBILECAPA: Real (0.0)
GLEVEL: String (0.0)
LOGRADE: String (0.0)
HIGRADE: String (0.0)
CALENDAR: String (0.0)
HASBASE: String (0.0)
ISMAGNET: String (0.0)
PHONE: String (0.0)
ADDRNUMBER: String (0.0)
ADDRPREFIX: String (0.0)
ADDRROOT: String (0.0)
ADDRTYPE: String (0.0)
ADDRSUFFIX: String (0.0)
ADDRCITY: String (0.0)
ADDRZIPCOD: String (0.0)
SPED: Real (0.0)
STATUS: String (0.0)
NODEID: String (0.0)
CAPACITYTO: Real (0.0)
ESL: String (0.0)
BOARDDIS2: String (0.0)
PROJ_CAP: Real (0.0)
NOTES: String (0.0)

System specs:

$ ogrinfo --version
GDAL 3.8.4, released 2024/02/08
$ 
$ apt policy libgdal-grass
libgdal-grass:
  Installed: 1:1.0.2-7+jammy3
  Candidate: 1:1.0.2-7+jammy3
  Version table:
 *** 1:1.0.2-7+jammy3 500
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status
     3.4.1-3 500
        500 http://ftp.belnet.be/ubuntu jammy/universe amd64 Packages
$ 
$ inxi -Sxxx
System:
  Host: xxx Kernel: 5.15.0-112-generic x86_64 bits: 64 compiler: gcc
    v: 11.4.0 Desktop: Cinnamon 6.0.4 tk: GTK 3.24.33 wm: muffin vt: 7
    dm: LightDM 1.30.0 Distro: Linux Mint 21.3 Virginia
    base: Ubuntu 22.04 jammy
florisvdh added a commit to rsbivand/rgrass that referenced this issue Jun 16, 2024
vect() supports a missing layer argument, so supporting this too for GDAL-GRASS driver.

Also, for efficiency reasons, this commit only requests layer names in case
of polygons, to work around OSGeo/gdal-grass#46.
@florisvdh
Copy link
Author

We also discovered that the census dataset suffers the same problem (providing a layer "0" and a layer "census"); however this time the "0" layer has geometry 'unknown'.

$ ogrinfo -so -al /home/floris/grassdata/nc_basic_spm_grass7/PERMANENT/vector/census/head | head -7
Warning 1: GRASS warning: GISBASE environment variable was not set, using:
/usr/lib/grass83
INFO: Open of `/home/floris/grassdata/nc_basic_spm_grass7/PERMANENT/vector/census/head'
      using driver `OGR_GRASS' successful.

Layer name: 0
Geometry: Unknown (any)
Feature Count: 6393
Extent: (628769.374393, 212125.562878) - (645837.437393, 230963.640878)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant