Opened 7 years ago

Closed 6 years ago

#5642 closed enhancement (fixed)

MITAB driver - add per-layer bounding box

Reported by: trentcsc Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: mitab
Cc:

Description

The accuracy of coordinates in a MapInfo? TAB file is inversely proportional to the size of the layer bounding box (i.e. the bigger the bounding box, the less accurate the data stored in the file).

The default 2000 x 2000 degree bounding box for geographic projections is too coarse for the application I'm working, but the OGR API doesn't supply any means of communicating the bounding box to the MapInfo? Driver.

To get around this we have added a BOUNDS string option to the MapInfo? Layer creator, allowing callers to specify a custom layer bounding box.

In practice, the call site looks something like this

// assuming a datasource ds has already been created
OGRSpatialReference srs;
srs.SetWellKnownGeogCS("WGS84");
char* layer_ops[] = { "BOUNDS=-180,-90,180,90", nullptr };
auto l = ds->CreateLayer("test", &srs, wkbUnknown, layer_ops);

Attachments (1)

mitab_bounds.patch (1.9 KB) - added by trentcsc 7 years ago.
MapInfo? File Bounds patch

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by trentcsc

Attachment: mitab_bounds.patch added

MapInfo? File Bounds patch

comment:1 Changed 7 years ago by Even Rouault

Something really close functionnaly has been integrated recently in trunk. See http://trac.osgeo.org/gdal/changeset/27564

comment:2 in reply to:  1 Changed 7 years ago by trentcsc

Replying to rouault:

Something really close functionnaly has been integrated recently in trunk. See http://trac.osgeo.org/gdal/changeset/27564

Hmm, interesting. While that feature would probably be enough for the use case I have I can think of at least one that would find it really awkward.

Imagine writing multiple files with tight bounds on each; you would have to write a file with the bounding box to disk and then load it back in for each file. Not to mention that you would be modifying a global setting to solve a local problem, and heaven help anyone else using the MapInfo? driver at the same time.

But in all truth that's not what we actually need, and we can probably modify our client-side code to use a the projection table approach that has already been committed.

Having two ways to do essentially the same thing - especially two ways that may interact in unpredictable ways - is probably a bad idea, so I'm happy to have this tossed out if you prefer.

comment:3 Changed 7 years ago by Even Rouault

Component: defaultOGR_SF
Keywords: mitab added
Milestone: 2.0

trunk r27694 "MITAB: add BOUNDS layer creation option (based on patch by trentcsc, #5642)"

comment:4 Changed 6 years ago by Even Rouault

Milestone: 2.0

Removing obsolete milestone

comment:5 Changed 6 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Batch closing of MITAB tickets fixed in GDAL. They were kept open because not merged into MITAB separate repository, but the latter one is inactive, so let's close them definitely.

Note: See TracTickets for help on using tickets.