#3853 closed defect (fixed)
Data types change converting from MID/MIF to SHP
Reported by: | zoltan | Owned by: | chaitanya |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.1 |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | MITAB |
Cc: | warmerdam, Daniel Morissette, aboudreault, lpercich |
Description (last modified by )
When converting a SHP to a MID-MIF format, the data precision is lost. EG: Integer (10) becomes Integer [not Integer (10) to show longint] in the MIF file. On return from MID-MIF to Shape, I force the MIF file to contain Integer (10) in the schema, and it arrives in SHP as a Real value. Note that it is a technical requirement from our client that the Integer Length is reflected as 10 (and not zero), if it is "10" in the MIF file.
This is holding up a delivery dataset to a client, but I do understand if this cannot be solved soon.
3 Attachments (viewed via qgis 1.5.0)
original_SHP_schema.jpg is original client data.
After exporting from QGIS as midmif, the resulting MIF file contains:
Columns 25 FEAT_TYPE_ Integer OPERATIONA Integer . . GID Integer
etc....[note no "5" or "10" after the "Integer"]
re_read_midmif.jpg Is as the midmif files are opened by QGIS 1.5.0
shp_from_midmif.jpg After saving above midmif as SHP, exiting, then re-opening QGIS to read the resulting SHP file. Note that they are all "Integer 10" instead of some being "Integer 5", as our client is insisting.
Thanks & regards, Zoltan
Attachments (4)
Change History (14)
by , 13 years ago
Attachment: | shp_from_midmif.jpg added |
---|
by , 13 years ago
Attachment: | re_read_midmif.jpg added |
---|
by , 13 years ago
Attachment: | original_SHP_schema.jpg added |
---|
comment:1 by , 13 years ago
Cc: | added |
---|---|
Description: | modified (diff) |
Keywords: | MITAB added |
Milestone: | → 1.8.0 |
Owner: | changed from | to
Severity: | blocker → normal |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Note that most, if not all code in the ogr/mitab directory comes from the upstream mitab library and the changes need to be applied there. Reopening in case that has not occurred.
comment:4 by , 12 years ago
I see that Daniel is cc'ed to this ticket. Daniel, Can you pass this up to the mitab library?
by , 11 years ago
Attachment: | ogr_mitab_width.diff added |
---|
Fix: MapInfo max decimal field width is 20
comment:5 by , 11 years ago
Hi all,
changeset [24136] introduced a problem: MapInfo (at least up to version 7.5) only supports a maximum width of 20 and a maximum precision of 16 in decimal fields. If we convert a shapefile having a decimal(30,15) field in mapinfo TAB format, MapInfo crashes in the attempt to open that file. This anomalous TAB file can be opened with OGR-based tools like QGIS.
I attached a patch to add a check for maximum allowed width. It fixes the problem for me, and I could run the tests successfully.
One workaround (without applying the fix) is exporting in MIF format: the MIF is imported without problems in MapInfo, and the width of the decimal field is set to 20.
comment:6 by , 11 years ago
Cc: | added |
---|
comment:7 by , 11 years ago
The MIF format doesn't allow the syntax "Integer (10)". It has been reported to me that files mif/mid with this syntax produced by GDAL 1.9.x are rejected by MapInfo.
This will require more investigation and testing...
comment:9 by , 10 years ago
Milestone: | 1.8.1 → 1.11.1 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Chaitanya,
Please work on this promptly. Disregard the shapefile aspects - I believe they are already adequately addressed. The key is to ensure that OGR recognises the field width for integer fields, and treats Decimal(n,0) as integer, not real.
I think the provided dataset demonstrates Integer(n) fields. I will email you with a dataset containing Decimal(n,0) fields for you to test with.
I imagine changes will need to go upstream to MITAB though I presume the issue is primarily with the OGRLayer wrapper for MITAB. Work with Alan and/or Daniel on mitab updates.
Please manufacture a small test for the test suite to verify corrections one you have them.