MapServer / MapServer-import

3 stars 2 forks source link

XML error with native GML docs via OGR #1142

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: tomkralidis Date: 2004/12/21 - 23:09

When I invoke:

I have a GML file on disk.  Here's a record of the data natively as GML on disk:

        <gml:featureMember>
                <Observation>
                        <gml:name>bob</gml:name>
                        <gml:location>
                                <gml:Point
srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
                                        <gml:coord>
                                                <gml:X>-75.70420000</gml:X>
                                                <gml:Y>45.39940000</gml:Y>
                                        </gml:coord>
                                </gml:Point>
                        </gml:location>
                        <datetime>2003-10-30T00:00:00Z</datetime>
                </Observation>
        </gml:featureMember>

..testing this with ogrinfo returns no apparent problems:

$ ogrinfo -al obs.gml
Had to open data source read-only.
INFO: Open of `obs.gml'
using driver `GML' successful.

Layer name: Observation
Geometry: Unknown (any)
Feature Count: 3
Extent: (-95.704200, 45.399400) - (-71.920080, 55.399400)
Layer SRS WKT:
(unknown)
gml:name: String (0.0)
datetime: String (0.0)
OGRFeature(Observation):1
  gml:name (String) = tom
  datetime (String) = 2004-10-30T00:00:00Z
  POINT (-71.92008200 45.41276600)

OGRFeature(Observation):2
  gml:name (String) = bob
  datetime (String) = 2003-10-30T00:00:00Z
  POINT (-75.70420000 45.39940000)

OGRFeature(Observation):3
  gml:name (String) = joe
  datetime (String) = 2002-10-30T00:00:00Z
  POINT (-95.70420000 55.39940000)

I have referred in my mapfile as:

LAYER
  NAME "obs"
  STATUS ON
  CONNECTIONTYPE OGR
  CONNECTION "obs/obs.gml"

...etc...
END

I  have also  defined in my mapfile:

   "wfs_namespace_uri" "http://www.ec.gc.ca/ecows"
   "wfs_namespace_prefix" "ecows"

Now, when I invoke:

http://devgeo.cciw.ca/cgi-bin/mapserv/ecows?version=1.0.0&service=WFS&request=GetFeature&typename=obs&

....through OGC:WFS, this gets marshalled as:

<gml:featureMember>
 <ecows:obs>
  <gml:boundedBy>
   <gml:Box srsName="EPSG:4326">
    <gml:coordinates>-75.704200,45.399400 -75.704200,45.399400</gml:coordinates>
   </gml:Box>
  </gml:boundedBy>
  <gml:pointProperty>
   <gml:Point srsName="EPSG:4326">
    <gml:coordinates>-75.704200,45.399400</gml:coordinates>
   </gml:Point>
  </gml:pointProperty>
  <ecows:gml:name>bob</ecows:gml:name>
  <ecows:datetime>2003-10-30T00:00:00Z</ecows:datetime>
 </ecows:obs>
</gml:featureMember>

...so gml:name gets output as ecows:gml:name.  Any items defined in the native
XML file with the gml namespace (i.e. gml:name, gml:description, etc.) should be
pushed out as such.  Only non gml namespace'd elements should be pushed out with
whatever wfs_namespace_prefix (or default prefix if one is not defined).

Having said this, should we not be assigning a default namespace to the XML
document so that wfs_namespace_prefix is not prefixed to elements for GetFeature
responses?  This seems to be the norm for most XML documents out there.

Note that we still need wfs_namespace_prefix to respond to DescribeFeatureType
requests.
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/03/18 - 15:10

Any update on this one?  We should fix this sooner than later.
tbonfort commented 12 years ago

Author: dmorissette Date: 2005/03/22 - 18:10

Um, that's a tough one: if we modify the OGR-GML driver to strip off the
namespace prefix then some people may see this as a bug. And OTOH I'm not sure
it's a good idea to systematically modify attribute names in the GML generation
code.

Oh wait, maybe a solution for you would be to use the attribute name mapping
that Steve just added in the GML code, see bug 950.

I'll mark this as WONTFIX, reopen if the attribute name mapping doesn't solve
the issue.
tbonfort commented 12 years ago

Author: tomkralidis Date: 2005/03/23 - 19:14

I'm not sure this would be a bug if implemented.  The OGR GML driver currently
does not prefix the GML geometry objects (like gml:Point), so why should it
prefix the GML attributes?
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2005/03/23 - 19:28

Tom, 

In some feature types the prefixes from different names spaces are all 
that is available to disambiguate what would otherwise be conflicting
names.  For instance some features my have a gml:Description and a 
feature class specific Description.

Nevertheless, I am of two minds on this.  I am tempted to just strip all 
namespaces from attributes like I do for the rest of the geometry stuff. 
But I am afraid I may be creating problems for the future.