[Gdal-dev] ogr gml reader needs an update
Frank Warmerdam
warmerdam at pobox.com
Mon May 22 13:07:03 EDT 2006
Peter Rushforth wrote:
> I think the gml reader needs to be updated to allow for string field
> widths to be recognized from either an available xsd or gfs file.
>
> Could someone give me some pointers as to where to jump in?
> The ogr2ogr.cpp must have some kind of abstract feature that
> it uses in order to translate between feature types... I must have
> to start there no?
>
> Here's what I think needs doing:
>
> I can see that gmlfeatureclass.cpp is where the system reads
> the specs from the gfs file. parsexsd.cpp is where it reads them
> from the xsd file. I would need to create getters and setters for
> m_nWidth in gmlreader.cpp and gmlreader.h.
>
> Once that was done, how would the ogr2ogr system know to use
> the new property when creating output?
Peter,
This sounds like an excellent idea. It sounds like you have the general
idea how to handle this.
The GMLPropertyDefn (defined in gmlreader.h) will need a width parameter.
The methods for reading and writing the gfs file should have the width
added as a new element for the <PropertyDefn>. This would require
updates to the GMLFeatureClass::InitializeFromXML() and GMLFeatureClass::
SerializeToXML() methods.
You could look at adding support for widths to parsexsd.cpp too, but this
is really "experimental" support for the "level 0" GML and may not be working
well currently.
You will also want to alter GMLPropertyDefn::AnalysePropertyValue(). This
method is applied during the "prepass" for generating new .gfs information
from GML files. It currently does a bunch of checking to set or reset the
property type based on the value. You will also want to have it set and
grow the property width based on the values found.
Hopefully this gives you enough to go on. If you don't have time to do this,
either Mateusz or I could do it instead.
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
More information about the Gdal-dev
mailing list