[mapserver-users] wfs data conversion with ogr2ogr?

Frank Warmerdam warmerdam at pobox.com
Mon Dec 15 12:21:16 EST 2008


Knut Behrends wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> 
> I have received data from a WFS that was returned in this format:
> (Sample feature member)
> 
>   <gml:featureMember>
>     <featureSet_704 fid="featureSet_704-feature_1732">
>       <gml:boundedBy>
>         <gml:Box>
>           <gml:coord>
>             <gml:X>4436682.0</gml:X>
>             <gml:Y>5783076.0</gml:Y>
>           </gml:coord>
>           <gml:coord>
>             <gml:X>4441086.0</gml:X>
>             <gml:Y>5786776.0</gml:Y>
>           </gml:coord>
>         </gml:Box>
>       </gml:boundedBy>
>       <GEOM_ID>1732</GEOM_ID>
>       <NAME>Marienborn</NAME>
>     </featureSet_704>
>   </gml:featureMember>
...

> After successful conversion, however, only the GEOM_ID and the NAME are
> exported. The spatial information is ignored lost during the conversion.
> Maybe it's in the wrong format, but it is obviously present  in the GML
> fragment above. What can I do to convert the spatial information that is
> contained in the <X> and <Y> elements?

Knut,

The above feature fragment from a WFS lacks a geometry properly.  The
boundedBy properly is normally ignored by OGR.  Following is a simple
example of a GML feature with a point geometry attribute.

   <gml:featureMember>
     <airports fid="2">
       <NAME>Bowstring Municipal Airport</NAME>
       <LAT>     47.5583</LAT>
       <LON>    -93.8689</LON>
       <ELEVATION>   1372.0000</ELEVATION>
       <QUADNAME>Jessie Lake</QUADNAME>
 
<ogr:geometryProperty><gml:Point><gml:coordinates>434634,5267578</gml:coordinates></gml:Point></ogr:geometryProperty>
     </airports>
   </gml:featureMember>

If you can influence your WFS, then producing something a bit like this
might be good.

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    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list