Opened 17 years ago

Last modified 16 years ago

#1484 closed defect

NHD (ESRI) geodatabase reading problems — at Version 4

Reported by: rkgeorge@… Owned by: Mateusz Łoskot
Priority: normal Milestone:
Component: OGR_SF Version: 1.4.0
Severity: normal Keywords: PGeo "ESRI Geodatabase"
Cc: Jeff McKenna, springmeyer, MarkHirschi

Description (last modified by warmerdam)

The USGS NHD data is in ESRI geodatabase mdb format. Example cmd line:

ogr2ogr -f PostgreSQL PG:"user=user dbname=NHD host=localhost password=pass port=5432" NHDH0104.mdb

The above cmd line creates a set of PostGIS tables, but some of the tables' wkb_geometry fields are empty - for example NHDARea, HYDRO_NET_Junctions. The NHD shape fields appear to have type 19 for polygons and type 9 for points which are unknown types, to me. The shape object signatures appear to match PolygonM, 25, and PointM, 21, but since the types do not match measure features the Mmin, Mmax, Marray may mean something different.

thanks

Change History (4)

comment:1 by Mateusz Łoskot, 17 years ago

Randy,

I can not find the NHD data set.
I tried to find some samples on the NHD Data website:
http://nhd.usgs.gov/data.html
but it seems the FTP is down:
ftp://nhdftp.usgs.gov/SubRegions/

Could you provide me with the NHDH0104.mdb file, so I can try to reproduce your problems and fix it?

Thanks

comment:2 by Mateusz Łoskot, 17 years ago

Frank,
I'm re-assigning this bug to myself, as it's on my TODO list.

comment:3 by Mateusz Łoskot, 17 years ago

Description: modified (diff)
Status: newassigned

Frank, I have a few considerations about NHD database support in the OGR that I'd like to discuss before I start fixing it.

1) Incomplete geometry types coverage

In OGRPGeoTableLayer::Initialize(), switch block decoding SHPT_* values to OGRwkbGeometryType does not include surface types like Polygon or MultiPolygon. There are only Point, LineString and MultiPoint types decoded.

Is this intentional and correct or something is not finished here?

2) OGR geometry type is not set

The type decoded in point 1) is not set for PGeo layer. The poFeatureDefn->SetGeomType() call in ogr/ogrsf_frmts/pgeo/ogrpgeotablelayer.cpp:188 is commented and has no effect. It results in setting wkbUnknown type for all layers in PGeo database.

There is a comment that seems to explain it:

So for now we just always return wkbUnknown.

but I'm not sure if it should apply to all geometry types or it is supposed to apply only to linear types.

Anyway, setting geometry to wkbUnknown, for PGeo->PG translation, results in setting PostGIS geometry type to GEOMETRY.

3) Reading Shape of unknown type

AFAI debugged and analysed the problem correctly, the main reason of empty geometries transfer to PostGIS is that PGeo Shape features are incorrectly recognized in OGR, and these geometries are not transfered to PostGIS.

For example - layer NDHArea

  • PGeo features include geometry
  • layer NHDArea reports Shape type = 19 which value does not exist in Shapefile types (shapefil.h:152).
  • OGRPGeoLayer::createFromShapeBin() returns NULL geometry

What is the geometry of ShapeType = 19 ? Does list of Shape types defined in Shapelib cover all types from ESRI Personal Geodatabase, or are there extensions to Shapefile types possible in PGeo?

4) Commented blocks of PGeo driver

Why the code reading MultiPoint geometries in createFromShapeBin() function is commented? Also, there is code reading surface geometries, but as I'm writing in point 1) above, these types like Polygon and MultiPolygon are not set anywhere.

I think these issues above should be reviewed and solved in order to fix geometry transfer problem.

comment:4 by warmerdam, 17 years ago

Cc: warmerdam added
Description: modified (diff)
Keywords: geodatabase added
Milestone: 1.4.1
Priority: highesthigh
Summary: ogr2ogr translation of NHD geodatabase to PostGIS is incompleteNHD (ESRI) geodatabase reading problems

There seem to be potentially serious issues with the geodatabase driver. I have moved this to 1.4.1 milestone, and I will review the points that Mateusz has raised.

Note: See TracTickets for help on using tickets.