Opened 12 years ago

Closed 12 years ago

#4832 closed defect (fixed)

FileGDB has broken extents when features with no geometries are present.

Reported by: cdestigter Owned by: Robert Coup
Priority: normal Milestone: 1.9.2
Component: OGR_SF Version: 1.9.1
Severity: normal Keywords:
Cc:

Description

I have a CSV with 100 geometries, some of which are empty/null.

When I convert to FileGDB:

    ogr2ogr -nlt POLYGON -f FileGDB csv2gdb.gdb null-geoms-head2.csv

I get a broken extent (note the (0, 0):

ogrinfo -so -al csv2gdb.gdb/
Warning 1: Empty Spatial Reference
INFO: Open of `csv2gdb.gdb/'
      using driver `FileGDB' successful.

Layer name: null_geoms_head2
Geometry: Multi Polygon
Feature Count: 99
Extent: (0.000000, 0.000000) - (2437341.000000, 5683455.000000)
Layer SRS WKT:
(unknown)
FID Column = OBJECTID
Geometry Column = SHAPE
WKT: String (0.0)
id: String (0.0)

the CSV and GDB are in this zip (~100kb):

https://dl.dropbox.com/u/2649727/null-geoms.zip

With one much bigger layer, I also get some -MAXINT bits in my extent, but so far I haven't been able to reproduce that with a small enough sample to share here:

Feature Count: 1051140
Extent: (-2147483648.000000, -2147483648.000000) - (2496130.000000, 6223157.000000)

I tried shapefile and mapinfo tab and both are fine, appears this is FGDB specific.

Using gdal from ubuntugis - 1.9.1-2~precise4

Attachments (1)

4832-proposed.1.patch (5.8 KB ) - added by Robert Coup 12 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Robert Coup, 12 years ago

Owner: changed from warmerdam to Robert Coup

comment:2 by cdestigter, 12 years ago

aha, with the filegdb api 1.2 I get something even crazier:

Layer name: null_geoms_head2
Geometry: Multi Polygon
Feature Count: 99
Extent: (0.000000, 0.000000) - (2437340.380162, 17599482270366625991174440508157674004685900733593819351200808903984042008327394057038596299010613444608.000000)
Layer SRS WKT:
(unknown)
FID Column = OBJECTID
Geometry Column = SHAPE
WKT: String (0.0)
id: String (0.0)

comment:3 by Robert Coup, 12 years ago

Status: newassigned

I've done some digging into this today - it seems that NULL/Empty geometry handling causes all sorts of weirdness with the FileGDB API - extents are broken, geometries are mysteriously duplicated, and IsEmpty() doesn't seem to round-trip.

There's also several ways to do things (geometryNull, shapeNull, shapeNull+SetEmpty(), SetNull("myGeomField")) so I need to find out which are the "right" ways to deal with these values.

comment:5 by Robert Coup, 12 years ago

My proposed patch:

  • turn EMPTY geometries into NULL
  • set NULL geometries via Row.SetNull(geometryFieldName)
  • tests for the above

I'll wait until I hear from ESRI before I commit it.

by Robert Coup, 12 years ago

Attachment: 4832-proposed.1.patch added

comment:6 by Robert Coup, 12 years ago

[25078] commits this fix to trunk.

comment:7 by Robert Coup, 12 years ago

Committed to 1.9 in [25080]

comment:8 by Even Rouault, 12 years ago

Milestone: 1.9.2
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.