[gdal-dev] ogr2ogr - geojson to mapInfo - size of .dat become too big
Even Rouault
even.rouault at spatialys.com
Tue Sep 22 11:47:58 PDT 2015
Le mardi 22 septembre 2015 16:07:56, Maxime Demers a écrit :
> Hi,
>
> I have notice something bad when converting a geojson to mapInfo tab with
> ogr2ogr. The .dat which contain the table feature's properties is getting
> way too big after conversion.
>
> To test, I have converted a mapInfo tab to geojson using:
>
> ogr2ogr -f "GeoJSON" test.geojson test.tab
>
> and then I converted it back to mapInfo tab using:
>
> ogr2pgr -f "MapInfo File" test2.tab test.geojson
>
> Before convertion, the .dat of the mapInfo file was 8,75 Mo after
> conversion it became 105 Mo.
> I dont know if the problem is only when converting geojson to mapInfo tab.
> What could be the cause of the problem and does a solution exists?
Maxime,
The issue is that when converting from GeoJSON to .tab, the source text fields in GeoJSON have no longer an explicit field width, hence the mapinfo driver fallbacks to 254 characters.
You could workaround with a statement like this :
ogr2ogr -f "MapInfo File" test2.tab test.geojson -sql "select cast(field1_name as character(field_width)), cast(field2_name as character(field2_width)), ... from layername"
to specify explicit field width.
It would have been great if ogr2ogr had a mode to automate this (I thought there was one already, but can't find it)
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list