[gdal-dev] Ogr2ogr, Mapinfo, Spatialite and mixed line
geometrytypes
Luca Sigfrido Percich
sigfrido at tiscali.it
Thu Jan 19 04:05:31 EST 2012
Hi Jukka,
unfortunately MapInfo does not have the ability to enforce the geometric
type of a table, to the extent that you could also mix polygons, points
and linestrings in the same table!
Moreover, MapInfo does not make a formal distinction between linestring
and multilinestring, nor between polygon and multipolygon. And in
MapInfo tab format, once you get a poligon with more than one ring you
cannot immediately say which ring is a hole and which is a polygon
exterior ring, so you have to write code to figure out if a given
polygon is single or multi.
Lacking this support in the TAB format, the problem creeps into ogr. The
only way to figure out which geometries are you dealing with is reading
all the features and analyzing them.
I usually use -nlt option to force to multilinestring or multipolygon,
and then post-process data in PostGIS.
Hope this helps
All the best
Sig
Il giorno mer, 18/01/2012 alle 20.25 +0000, Jukka Rahkonen ha scritto:
> Hi,
>
> I received an Mapinfo TAB file which contains both linestings and
> multilinestrings. Addind data into Spatialite as a new layer with the following
> command fails
>
> ogr2ogr -f SQLite -update -gt 2048 -t_srs epsg:3067 tab_test.sqlite l_jrata.TAB
>
> Error is
> ERROR 1: sqlite3_step() failed:
> SQL logic error or missing database
> ERROR 1: ROLLBACK transaction failed: cannot rollback - no transaction
> is active
>
> ERROR 1: Terminating translation prematurely after failed
> translation of layer l_jrata (use -skipfailures to skip errors)
>
> Conversion is successful if I set the geometrytype of the new layer into
> multilinestring with the -nlt option. However, this is not necessary when having
> a mixture of polygons and multipolygons. In that case the conversion succeeds
> and the result is a Spatialite table of general geometry type.
>
> Orginfo lists with this dataset that the geometrytype is Line String. Are there
> other means for detecting the multilinestrings beforehand than list all features
> with ogrinfo and pipe them through find/grep?
>
> A small dataset is available here for testing
> http://latuviitta.org/documents/L_JRATA.ZIP
>
> Regards,
>
> -Jukka Rahkonen-
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list