[Gdal-dev] GML writing issue

Mateusz Loskot mateusz at loskot.net
Fri May 19 06:42:51 EDT 2006


Bart van den Eijnden (OSGIS) wrote:
> Hi list,
> 
> when trying to use a Mapserver 4.8.3 generated GML file in OGR, we are
> running into a few issues. Mapserver uses ms as the namespace prefix in
> the GML. OGR raises a few warnings, but if I look into the resulting GML
> file all attribute information is lost in fact.
> 
> H:\appl\FWTools1.0.0a7\bin>ogr2ogr -f "GML" test.gml
> D:\temp\gdelivery\mapserv.gml
> Warning 1: Layer name 'ms:AAA132' adjusted to 'ms_AAA132' for XML validity.
> Warning 1: Field name 'ms:TDN_CODE' adjusted to 'ms_TDN_CODE' to be a valid
> XML element name.
> Warning 1: Field name 'ms:OMSCHRIJVI' adjusted to 'ms_OMSCHRIJVI' to be a
> valid
> XML element name.
> Warning 1: Field name 'ms:Area' adjusted to 'ms_Area' to be a valid
> XML element name.
> Warning 1: Field name 'ms:Perimeter' adjusted to 'ms_Perimeter' to be a valid
> XML element name.


OGR strips all namespace names off.
As I know from reading the GML driver source code, the drivers seems to
not accept colon in names (http://www.w3.org/TR/xml11/#sec-common-syn,
NOTE about namespace).
NOTE: I may be wron!


> A second issue, the boundingbox is screwed up in the process. Mapserver
> GML has:
>       <gml:boundedBy>
>       	<gml:Box srsName="EPSG:28992">
>       		<gml:coordinates>192519.015625,320687.375000
> 194164.359375,322355.968750</gml:coordinates>
>       	</gml:Box>
>       </gml:boundedBy>
> 
> The output from OGR is:
>   <gml:boundedBy>
>     <gml:Box>
>       <gml:coord><gml:X>0</gml:X><gml:Y>0</gml:Y></gml:coord>
>       <gml:coord><gml:X>194164.359375</gml:X><gml:Y>322355.96875</gml:Y></gml:coord>
>     </gml:Box>
>   </gml:boundedBy>
> 
> which gives trouble viewing the GML in e.g. Gaia.


This behaviour seems to be common to OGR's GML driver.
AFAIK it uses *only* gml::coord notation to write gml:Box tree, but not
gml::coordiantes.
I don't know if this behaviour is intentional behaviour or it's a bug.


> Another issue is when transforming Mapserver GML into an ESRI Shapefile.
> The attributes in the dbf files are named ms:XXX. TatukGIS won't show any
> attribute info, and OpenEV even crashes on this shapefile.

I may be wrong, but if GML driver does not strip colon from field names,
then it seems to be a bug.
Shapelib docs say:

"In order to use the xBase file in some packages it may be necessary to
avoid some special characters in the field names such as spaces, or
arithmetic operators."

so, one may expect that colon in the name of field won't be portable.

NOTE: I'm quite new to GML driver, so my assumptions may be incorrect.
Thus, I suggest you to wait for Frank's opinion.

Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list