[Gdal-dev] file size balloons when converting gml to tab, shp with ogr2ogr

Peter.Rushforth at statcan.ca Peter.Rushforth at statcan.ca
Thu May 18 13:30:40 EDT 2006


Hi Ethan,

Thanks...  I don't know perl unfortunately but you are right
there must be more than one way to skin this cat.  I will have
to look into that language binding stuff... it is one area
I have overlooked until now.

I would think that one could modify the gml driver source to read
a field definition from the gfs file or xsd file if available also.
Of course, that would mean one would have to learn c++ ;)

Another option would be to generate a mid/mif pair, modify the 
string field width definitions as appropriate, and then generate
the shp and tab files from those.  That could be a little more like
hand editing though.

Cheers,

Peter Rushforth
Geography Division
Statistics Canada
Ottawa Ontario
K1A 0T6


> -----Original Message-----
> From: Ethan Alpert [mailto:ealpert at digitalglobe.com] 
> Sent: May 18, 2006 1:07 PM
> To: Peter.Rushforth at statcan.ca; warmerdam at pobox.com
> Cc: gdal-dev at lists.maptools.org
> Subject: RE: [Gdal-dev] file size balloons when converting 
> gml to tab,shp with ogr2ogr
> 
> 
> 
> Another option is to use one of the language bindings to do 
> the coversion. This way you could set the string widths when 
> you define the output file. It's about 40 lines of code in perl.
> 
> -e
> 
> -----Original Message-----
> From: gdal-dev-bounces at lists.maptools.org
> [mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of 
> Peter.Rushforth at statcan.ca
> Sent: Thursday, May 18, 2006 9:05 AM
> To: warmerdam at pobox.com
> Cc: gdal-dev at lists.maptools.org
> Subject: RE: [Gdal-dev] file size balloons when converting 
> gml to tab,shp with ogr2ogr
> 
> Hi Frank,
> 
> It is just the .dbf and the .dat files for mapinfo which grow 
> too big. I checked the mid/mif and found that you could edit 
> the string field definition and generate the tab file which 
> then turned out to be about the right size.
> 
> I was searching for a way to tell the gml driver how big the 
> string fields were in order that that info get passed on to 
> the tab and shp drivers.  I tried editing the gfs file and 
> adding a Width element, but it seemed to be ignored.  Would 
> an xml schema work, I wonder?
> 
> Cheers
> 
> Peter Rushforth
> Geography Division
> Statistics Canada
> Ottawa Ontario
> K1A 0T6
> 
> 
> > -----Original Message-----
> > From: Frank Warmerdam [mailto:fwarmerdam at gmail.com] On Behalf
> > Of Frank Warmerdam
> > Sent: May 18, 2006 10:30 AM
> > To: Peter.Rushforth at statcan.ca
> > Cc: gdal-dev at lists.maptools.org
> > Subject: Re: [Gdal-dev] file size balloons when converting 
> > gml to tab, shp with ogr2ogr
> > 
> > 
> > Peter.Rushforth at statcan.ca wrote:
> > > Hi,
> > > 
> > > I've been experimenting with converting GML documents to
> > mapinfo tab
> > > and
> > > esri shp
> > > formats.  I have the same files previously created with commercial
> > > software with
> > > exactly the same record layouts.  The files I've created 
> > with ogr2ogr
> > > seem to be up
> > > to 5 to 10 times larger than the same file (and format)
> > created with the
> > > commercial software.
> > > 
> > > When you view the files, they appear identical, line for line,
> > > attribute
> > > for attribute.
> > > 
> > > Is there somebody who could point me in the right direction to
> > > determine
> > > why?
> > 
> > Peter,
> > 
> > Generally speaking string fields without a defined size will
> > end up being very wide when translated to shapefiles since it 
> > is necessary for me to pick a string width when creating the 
> > shapefile, but without prescanning all the actual values that 
> > will be written.  This may also be an issue with tab format, 
> > I'm not sure.  I don't *think* it is an issue with .mid/.mif.
> > 
> > So, is it primarily the .dbf file that is big for shapefiles?
> >  The .shp should generally be slightly more compact than the 
> > corresponding GML geometry format.
> > 
> > Best regards,
> > 
> > --
> > ---------------------------------------+----------------------
> > ----------
> > ---------------------------------------+------
> > I set the clouds in motion - turn up   | Frank Warmerdam, 
> > warmerdam at pobox.com
> > light and sound - activate the windows | http://pobox.com/~warmerdam
> > and watch the world go round - Rush    | President OSGF, 
> > http://osgeo.org
> > 
> > 
> 
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/gdal-dev
> 




More information about the Gdal-dev mailing list