[mapserver-users] wfs data conversion with ogr2ogr?

Knut Behrends knb at gfz-potsdam.de
Mon Dec 15 00:33:42 PST 2008


-----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>

ogrinfo can parse the file:
 ogrinfo SA_PLACES.gml
Had to open data source read-only.
INFO: Open of `SA_PLACES.gml'
      using driver `GML' successful.
1: featureSet_704

ogr2ogr can also convert the file to, say, Esri Shapefile. There isI
must assign a source SRS and a target SRS and force a source geometry type.

INFO: Open of `out/featureSet_704.shp'
      using driver `ESRI Shapefile' successful.

Layer name: featureSet_704
Geometry: Line String
Feature Count: 100
Extent: (0.000000, 0.000000) - (0.000000, 0.000000)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_1984",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]]
GEOM_ID: Real (11.0)
NAME: String (19.0)
OGRFeature(featureSet_704):0
  GEOM_ID (Real) =        1732
  NAME (String) = Marienborn
...


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


- --
____________________________________________________________________________

Knut Behrends                         Phone: +49 (0) 331 288 1688
Potsdam 14473                         KeyID: 0xF22CACEF (PGP Public Key)
____________________________________________________________________________

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAklGFmYACgkQcfWHNfIsrO9NNACfTwBojDKZ0MU3J/yVUBiof5JP
P28AnRStqwySPcQ9gM+hjAgQBNZYRZz4
=Eane
-----END PGP SIGNATURE-----



More information about the MapServer-users mailing list