[OpenLayers-Trac] [OpenLayers] #3492: GMLv3 doesn’t show or update GeometryCollection
OpenLayers
trac-20090302 at openlayers.org
Thu Sep 8 10:48:03 EDT 2011
#3492: GMLv3 doesn’t show or update GeometryCollection
------------------------------------------------------------------+---------
Reporter: lsmtti | Owner: tschaub
Type: bug | Status: new
Priority: minor | Milestone: 2.12 Release
Component: Format.GML | Version: 2.11 RC3
Keywords: GeometryCollection, Multigeometry, update, GML3, GML | State:
------------------------------------------------------------------+---------
I’m using an Oracle 10G database on WS2003 with Geoserver nightly build
from trunk (geoserver-trunk-2011-09-05-bin.zip) (we used this version
because there is a problem in stable version) on windows XP. I was doing
some tests with WFS-T 1.1.0 with GML 3, on a windows xp host machine with
firefox and found out that OpenLayers doesn’t show or update
GeometryCollection. That arises because GML v3 isn't dealing correctly
with the Geometry.Collection. OpenLayers is expecting erroneous it to be
GeometryCollection when it should be MultiGeometry as stated in the spec
of GML v3. I’ve made a patch to correct this and now in our scenario we
can use WFS-T to show update and insert geometries when those geometries
are GeometryCollection. I would like you to review it and add this
correction to OpenLayers if possible, or a better one that fixes the
problem.
To reproduce the problem you must have a GeometryCollection stored in a
Database (in our case Oracle) use a Open Geospatial Consortium WFS-T
compliant server (in our case Geoserver 2011-09-05 build).
1 - Declare a vector layer in open layers expecting the GML3 output (from
geoserver)
''var teste3BaseWFS = new OpenLayers.Layer.Vector("TESTE3", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
srsName: "EPSG:27493",
url: "http://localhost:8080/geoserver/wfs",
featureNS : "http://localhost:8080/geoserver",
featureType: "TESTE2_BEMPORTUARIO",
outputFormat: "GML3",
geometryName: "GEOMETRY"
})
});''
2 - Then Geoserver will generate the following GML so that OpenLayers can
show up the geometries
''<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection numberOfFeatures="0"
timeStamp="2011-09-05T14:08:21.187+01:00"
xsi:schemaLocation="http://localhost:8080/geoserver
http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=O3Port%3ATESTE2_BEMPORTUARIO
http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd"
xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov"
xmlns:cite="http://www.opengeospatial.net/cite"
xmlns:nurc="http://www.nurc.nato.int" xmlns:sde="http://geoserver.sf.net"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:topp="http://www.openplans.org/topp"
xmlns:O3Port="http://localhost:8080/geoserver"
xmlns:it.geosolutions="http://www.geo-solutions.it"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sf="http://www.openplans.org/spearfish"
xmlns:ows="http://www.opengis.net/ows"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink">
<gml:featureMembers>
<O3Port:TESTE2_BEMPORTUARIO gml:id="TESTE2_BEMPORTUARIO.30519">
<O3Port:GEOMETRY>
<gml:MultiGeometry srsDimension="2"
srsName="http://www.opengis.net/gml/srs/epsg.xml#27493">
<gml:geometryMember>
<gml:LineString>
<gml:posList>-47103.3946020567 169627.5381311
-47053.0385691367 169484.4209849</gml:posList>
</gml:LineString>
</gml:geometryMember>
<gml:geometryMember>
<gml:LineString>
<gml:posList>-47119.2965071867 169375.75796649
-46986.8537496867 169432.76120727</gml:posList>
</gml:LineString>
</gml:geometryMember>
<gml:geometryMember>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:posList>-47283.6161935567 169349.25479127
-47185.5544452367 169357.20574384 -47103.3946020567 169394.31018915
-47113.9958721467 169471.16939729 -47283.6161935567
169349.25479127</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:geometryMember>
<gml:geometryMember>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:posList>-47238.5607956867 169481.77066738
-47113.9958721467 169518.87511269 -47116.6461896667 169585.13305075
-47209.4073029367 169601.03495588 -47238.5607956867
169481.77066738</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:geometryMember>
</gml:MultiGeometry>
</O3Port:GEOMETRY>
</O3Port:TESTE2_BEMPORTUARIO>
</gml:featureMembers>
</wfs:FeatureCollection>''
3- It does not show the geometries of the type GeometryCollection, then
change the outputFormat for GML2 to testing if the GeometryCollection is
shown.
'' var teste3BaseWFS = new OpenLayers.Layer.Vector("TESTE3", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
srsName: "EPSG:27493",
url: "http://localhost:8080/geoserver/wfs",
featureNS : "http://localhost:8080/geoserver",
featureType: "TESTE2_BEMPORTUARIO",
outputFormat: "GML2",
geometryName: "GEOMETRY"
})
});''
4- Now OpenLayers can display the geometry, since it is receiving an GML2
format.
5 - When we try to edit and save the geometryCollection, GeoServer will
generate an error since OpenLayers is generating an GML3 response and
erroneous uses GeometryCollection instead of MultiGeometry. I have seen in
the GML 3 specification what is the the name of tag for representation of
GeometryCollection and that name is MultiGeometry. The following WFS
transaction is generated by OpenLayers.
''<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Update typeName="feature:TESTE2_BEMPORTUARIO"
xmlns:feature="http://localhost:8070/geoserver">
<wfs:Property>
<wfs:Name>GEOMETRY</wfs:Name>
<wfs:Value>
<gml:GeometryCollection xmlns:gml="http://www.opengis.net/gml"
srsName="EPSG:27493">
<gml:geometryMember>
<gml:LineString srsName="EPSG:27493">
<gml:posList>-46991.12771677839 169596.48558836358
-46988.54482653 169450.97978503</gml:posList>
</gml:LineString>
</gml:geometryMember>
<gml:geometryMember>
<gml:LineString srsName="EPSG:27493">
<gml:posList>-47054.80276458 169342.31676662 -46922.36000708
169399.3200074</gml:posList>
</gml:LineString>
</gml:geometryMember>
<gml:geometryMember>
<gml:Polygon srsName="EPSG:27493">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-47219.12245095 169315.8135914
-47121.06070263 169323.76454397 -47038.90085945 169360.86898928
-47049.50212954 169437.72819742 -47219.12245095
169315.8135914</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:geometryMember>
<gml:geometryMember>
<gml:Polygon srsName="EPSG:27493">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-47174.06705308 169448.32946751
-47049.50212954 169485.43391282 -47052.15244706 169551.69185088
-47144.91356033 169567.59375601 -47174.06705308
169448.32946751</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:geometryMember>
</gml:GeometryCollection>
</wfs:Value>
</wfs:Property>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:FeatureId fid="TESTE2_BEMPORTUARIO.30519"/>
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>''
6 - After applying the patch OpenLayers will show well the geometry
collections and will generate the following WFS transaction (wich is the
correct one).
''<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Update typeName="feature:TESTE2_BEMPORTUARIO"
xmlns:feature="http://localhost:8070/geoserver">
<wfs:Property>
<wfs:Name>GEOMETRY</wfs:Name>
<wfs:Value>
<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml"
srsName="EPSG:27493">
<gml:geometryMember>
<gml:LineString srsName="EPSG:27493">
<gml:posList>-46991.12771677839 169596.48558836358
-46988.54482653 169450.97978503</gml:posList>
</gml:LineString>
</gml:geometryMember>
<gml:geometryMember>
<gml:LineString srsName="EPSG:27493">
<gml:posList>-47054.80276458 169342.31676662 -46922.36000708
169399.3200074</gml:posList>
</gml:LineString>
</gml:geometryMember>
<gml:geometryMember>
<gml:Polygon srsName="EPSG:27493">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-47219.12245095 169315.8135914
-47121.06070263 169323.76454397 -47038.90085945 169360.86898928
-47049.50212954 169437.72819742 -47219.12245095
169315.8135914</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:geometryMember>
<gml:geometryMember>
<gml:Polygon srsName="EPSG:27493">
<gml:exterior>
<gml:LinearRing>
<gml:posList>-47174.06705308 169448.32946751
-47049.50212954 169485.43391282 -47052.15244706 169551.69185088
-47144.91356033 169567.59375601 -47174.06705308
169448.32946751</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:geometryMember>
</gml:MultiGeometry >
</wfs:Value>
</wfs:Property>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:FeatureId fid="TESTE2_BEMPORTUARIO.30519"/>
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>''
Thanks in advance Luis Morais
--
Ticket URL: <http://trac.openlayers.org/ticket/3492>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list