Hi Ben,
Thanks for your answer.
I noticed that my polygon wasn't closed, but the problem remained.
In your test you use gsml:shape which is of type GeometryPropertyType and I
think that's the point. I need to use an abstract type and it looks like
"targetAttributeNode" is not working.
I'm sure your test would work even if you don't use the "targetAttributeNode"
element. I've done so in a similar situation. In INSPIRE LandCover Schema, a
coverage geometries reside inside an element called GeometryValuePair which
combines the geometry with a complex object (in this case a LandCoverObject).
This is its (long) definition:
<complexType name="GeometryValuePairType">
<sequence>
<element name="geometry">
<annotation>
(...)
</annotation>
<complexType>
<complexContent>
<extension base="gml:AbstractMemberType">
<sequence minOccurs="0">
<element ref="gml:AbstractObject" />
</sequence>
<attributeGroup ref="gml:AssociationAttributeGroup" />
</extension>
</complexContent>
</complexType>
</element>
<element name="value">
<annotation>
(...)
</annotation>
<complexType>
<complexContent>
<extension base="gml:AbstractMemberType">
<sequence minOccurs="0">
<element ref="gml:AbstractObject" />
</sequence>
<attributeGroup ref="gml:AssociationAttributeGroup" />
</extension>
</complexContent>
</complexType>
</element>
</sequence>
</complexType>
It looks a little weird to me that both elements have the same abstract type
when the geometry could be just a GeometryPropertyType. I tried changing its
type to that (so it looked just like gsml:shape) and it worked pretty fine.
I don't know much about Application Schemas nor the Geoserver - GeoTools source
code, but debugging it, it looks to me like it's not interpreting the value as
a geometry although the "targetAttributeNode" element is present.
Best regards,
Ruben.
-----Mensaje original-----
De: Ben Caradoc-Davies [mailto:[email protected]]
Enviado el: viernes, 26 de agosto de 2011 6:53
Para: Ruben Velasco Vega
CC: [email protected]; Justin Deoliveira
Asunto: Re: [Geoserver-users] App-Schema: Mapping gml:AbstractGeometry
Ruben,
I have the answer: your polygon is not closed. I do not have a
reference, but please see the examples here, which show that for
polygons, the last and first point must have the same coordinates:
http://en.wikipedia.org/wiki/Well-known_text
In my unit test fixture for a GeoSciML 3.0rc1 MappedFeature, which has
property gsml:shape that is a GML 3.2 GeometryPropertyType, I changed
the mapping for gsml:shape to:
<AttributeMapping>
<targetAttribute>gsml:shape</targetAttribute>
<idExpression>
<OCQL>strConcat('shape.', getId())</OCQL>
</idExpression>
<sourceExpression>
<OCQL>'POLYGON((268926 4810180, 268926 4829560, 296474 4829560, 296474
4810180, 268926 4810180))'</OCQL>
</sourceExpression>
<targetAttributeNode>
gml:MultiSurfacePropertyType
</targetAttributeNode>
</AttributeMapping>
Note that I added the first point of your polygon again at the end to
close it.
The corresponding fragment from the WFS response is:
<gsml:shape>
<!--#shape.mf.1-->
<gml:MultiSurface gml:id="shape.mf.1">
<gml:surfaceMember>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:posList>268926.0 4810180.0 268926.0 4829560.0 296474.0 4829560.0
296474.0 4810180.0 268926.0 4810180.0</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</gsml:shape>
This is almost correct.
One remaining problem is that there is no gml:id on the inner
gml:Polygon, making the response schema-invalid. I have created a Jira
issue for this defect:
https://jira.codehaus.org/browse/GEOT-3824
Justin, how should we modify the encoder to allow gml:id to be placed on
every geometry nested inside the top-level geometry? Geometries are
opaque to app-schema.
Kind regards,
Ben.
On 24/08/11 14:52, Ruben Velasco Vega wrote:
> Hi Ben,
>
> I tried that solution, using just one attributeMapping element:
>
> <AttributeMapping>
> <targetAttribute>
> gml:domainSet
> </targetAttribute>
> <sourceExpression>
> <OCQL>'POLYGON((268926 4810180, 268926 4829560, 296474 4829560,
> 296474 4810180))'</OCQL>
> </sourceExpression>
> <targetAttributeNode>
> gml:MultiSurfacePropertyType
> </targetAttributeNode>
> </AttributeMapping>
>
> But it didn't work and I got the same behavior.
> It also didn't work using the geometry column of a shapefile.
>
> I think I'll try to debug GeoServer + app-schema source code to see if it
> helps me to understand how this works.
>
> I'll let you know if I make any progress.
>
> Best regards.
>
> Ruben Velasco.
>
> -----Mensaje original-----
> De: Ben Caradoc-Davies [mailto:[email protected]]
> Enviado el: miércoles, 24 de agosto de 2011 0:45
> Para: Ruben Velasco Vega
> CC: [email protected]
> Asunto: Re: [Geoserver-users] App-Schema: Mapping gml:AbstractGeometry
>
> Ruben,
>
> you have two attributeMapping elements for one targetAttribute. Please
> try merging them into a single element containing one targetAttribute,
> one targetAttributeNode, and one sourceExpression. Normally separate
> elements are used because the property element has a path one step
> shorter, but I suspect your mapping is almost correct because geometry
> properties are handled differently.
>
> I have never tried to use CQL to deliver a literal geometry in this way.
> Please let us know if it works! (I am in a conference [ISDE7] today and
> tomorrow and cannot test your mapping until Friday.)
>
> Kind regards,
> Ben.
>
> On 23/08/11 20:20, Ruben Velasco Vega wrote:
>> Hi,
>>
>> First of all let me put you in situation. I’m working on the mapping of the
>> INSPIRE Annex II Land Cover schema. I’m using GeoServer 2.2 + app-schema. I
>> tried GS 2.1, but I moved to 2.2 when I read this issue:
>> http://jira.codehaus.org/browse/GEOS-4496
>>
>> I need to map the attribute “gml:domainSet” which has this definition:
>>
>> <element name="domainSet" type="gml:DomainSetType">
>> <annotation>
>>
>> <documentation>…</documentation>
>> </annotation>
>> </element>
>> <complexType name="DomainSetType">
>> <sequence minOccurs="0">
>> <choice>
>> <element
>> ref="gml:AbstractGeometry"/>
>> <element
>> ref="gml:AbstractTimeObject"/>
>> </choice>
>> </sequence>
>> <attributeGroup
>> ref="gml:OwnershipAttributeGroup"/>
>> <attributeGroup
>> ref="gml:AssociationAttributeGroup"/>
>> </complexType>
>>
>>
>> I want to use an explicit polygon so I wrote the mapping this way:
>>
>>
>> <AttributeMapping>
>> <targetAttribute>
>>
>> gml:domainSet
>> </targetAttribute>
>> <targetAttributeNode>
>>
>> gml:MultiSurfacePropertyType
>> </targetAttributeNode>
>> </AttributeMapping>
>>
>> <AttributeMapping>
>> <targetAttribute>
>> gml:domainSet
>> </targetAttribute>
>> <sourceExpression>
>> <OCQL>'POLYGON((268926 4810180,
>> 268926 4829560, 296474 4829560, 296474 4810180))'</OCQL>
>> </sourceExpression>
>> </AttributeMapping>
>>
>> When I make this request:
>> http://localhost:8080/geoserver/wfs?request=GetFeature&typeName=lcs:LandCoverSurfaceCoverage&outputFormat=text/xml;%20subtype=gml/3.2
>>
>> I get this response:
>>
>> <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs/2.0" ...
>> <wfs:member>
>> <lcs:LandCoverSurfaceCoverage gml:id="land_cover_coverages.1">
>>
>> [DOMAINSET SHOULD BE HERE]
>>
>> <cvgvp:domainExtent>
>> <gmd:EX_Extent>
>> …
>> …
>>
>> In the GeoServer log (with the GEOTOOLS_DEVELOPER_LOGGING.properties profie)
>> I find this pair of lines that maybe related to this problem:
>>
>> 2011-08-23 13:11:09,550 DEBUG [org.geotools.xml] - AbstractFeature is
>> abstract
>> 2011-08-23 13:11:09,552 DEBUG [org.geotools.xml] - Property
>> http://www.opengis.net/gml/3.2:domainSet not found but minoccurs> 0
>>
>> If I remove the “targetAttributeNode” of the mapping, I get this output:
>>
>> <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs/2.0" ...
>> <wfs:member>
>> <lcs:LandCoverSurfaceCoverage gml:id="land_cover_coverages.1">
>> <gml:domainSet/>
>> <cvgvp:domainExtent>
>> <gmd:EX_Extent>
>> <gmd:geographicElement>
>> …
>> …
>>
>> And in the log file I only get this line:
>>
>> 011-08-23 13:30:40,111 DEBUG [org.geotools.xml] - AbstractFeature is abstract
>>
>>
>> I have a similar problem with the geometry attribute of each element of this
>> coverage using the “the_geom” column of a shapefile, but I think this one is
>> more simple.
>>
>> I hope I’ve explained it right and someone can help me. Thank you in advance.
>>
>> Rubén Velasco
>>
>>
>> [http://www.gijon.eu/Imagenes/correo/pie_correo.jpg]
>>
>>
>>
>>
>
--
Ben Caradoc-Davies <[email protected]>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre
---
Antes de imprimir este correo piensa bien si es necesario hacerlo.
If you print this email please think if you really need to do it.
Enantes d'imprimir esti corréu, mira bien si ye necesario que lo faigas.
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users