Hi all,
I'm resurrecting this old thread because I've been working on this again
and I've made a few new discoveries.

As a quick reminder, the mapping I'm struggling with is:

<AttributeMapping>
  <targetAttribute>
lcv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_BoundingPolygon/gmd:polygon/gml:AbstractGeometry
  </targetAttribute>
  <sourceExpression><OCQL>geom</OCQL></sourceExpression>
  <targetAttributeNode>gml:MultiSurfaceType</targetAttributeNode>
</AttributeMapping>

which produces an empty gml:AbstractGeometry tag.

First of all, the weirdest of thigs: I found a way to make it work as
expected (actually, my colleague Mauro Bartolomeoli did). 
Steps to reproduce:
1) inside Eclipse, import all GeoServer projects, plus gt-app-schema
from GeoTools.
2) add the gt-app-schema project to the classpath of gs-web-app the
Eclipse way (Configure build path --> Projects --> Add) and NOT by
running mvn eclipse:clean eclipse:eclipse -Papp-schema
3) start GeoServer from Eclipse... et voilà, it works! The
gml:AbstractGeometry tag inside gmd:polygon is correctly encoded as a
gml:MultiSurface geometry.
If I run GeoServer from Eclipse the standard way or build a WAR, deploy
and run it, all I get is an empty gml:AbstractGeometry element.

Second, I've found where the code goes wrong, but I can't explain why.
The problem occurs inside org.geotools.xml.Encoder, line 769:

if (entry.element.isAbstract()) {
..
}

If I run GeoServer from Eclipse the standard way, when the time to
encode gml:AbstractGeometry comes, entry.element.isAbstract() returns
false, causing the code inside the if block to be skipped. If I add
gt-app-schema to the build path as described previously,
entry.element.isAbstract() returns true and the geometry is encoded just
fine. 
Apparently, this wrong element declaration comes from a call to
encoder.getSchemaIndex().getChildElementParticles() inside the class
org.geotools.xml.impl.BindingPropertyExtractor:
https://github.com/geotools/geotools/blob/aa0d0346e4bb4a5a2055559c22d2b12ded7cbd20/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xml/impl/BindingPropertyExtractor.java#L71


Does this ring any bell? Any suggestion on what other things I could
try?

BTW, I'm working on GeoServer/GeoTools master.

Many thanks!


Il giorno gio, 14/05/2015 alle 12.31 +0200, Stefano Costa ha scritto:
> Quick update: I tried both mappings suggested by Ben with the current
> development version of GeoServer (master branch, last commit
> 6db6bdbb9dc1be9daec066762c2c6bc5f7c7259d), but the result is unchanged
> (tried all WFS versions. 1.0.0, 1.1.0 and 2.0.0).
> 
> What drives me crazy is that the LandCoverUnit feature type has a
> geometry property (a "standard" one, of type gml:GeometryPropertyType),
> which is encoded just fine with this mapping:
> 
> <AttributeMapping>
>   <targetAttribute>lcv:geometry</targetAttribute>
>   <targetAttributeNode>
>     gml:MultiSurfacePropertyType
>   </targetAttributeNode>
>   <sourceExpression>
>     <OCQL>geom</OCQL>
>   </sourceExpression>
> </AttributeMapping>
> 
> I interpret this fact as further evidence that the problem lies in
> gmd:polygon not being a gml:GeometryPropertyType, but a
> gss:GM_Object_PropertyType... just a guess, though.
> 
> Best regards,
> Stefano
> 
> Il giorno gio, 14/05/2015 alle 10.18 +0200, Stefano Costa ha scritto:
> > Hi Mauro,
> > 
> > Il giorno gio, 14/05/2015 alle 10.12 +0200, Mauro Bartolomeoli ha
> > scritto:
> > > Hi Stefano,
> > > I remember having the same problem with some tests I did some time
> > > ago. 
> > > 
> > > 
> > > Could you please try a more recent version (latest 2.8 SNAPSHOT for
> > > example)? Because if I am not wrong, this should have already been
> > > fixed.
> > 
> > Sure thing, I'll test it ASAP.
> > 
> > > Also, try with a different WFS version (2.0, 1.1.0) and see if the
> > > result is consistent.
> > 
> > Tried both WFS 2.0 and 1.1.0, same result :-(
> > 
> > > 
> > > 
> > > Thanks
> > > Mauro
> > 
> > Thanks for the suggestion,
> > Stefano
> > 
> > > 
> > > 2015-05-13 23:28 GMT+02:00 Stefano Costa
> > > <[email protected]>:
> > >         Hi Ben,
> > >         thanks for your suggestions.
> > >         Unfortunately, they didn't work for me.
> > >         
> > >         > please try using targetAttributeNode to treat this property
> > >         as a
> > >         > gml:GeometryPropertyType:
> > >         >
> > >         > <AttributeMapping>
> > >         > <targetAttribute>
> > >         >
> > >         
> > > lcv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_BoundingPolygon/gmd:polygon
> > >         > </targetAttribute>
> > >         >
> > >         
> > > <targetAttributeNode>gml:GeometryPropertyType</targetAttributeNode>
> > >         > <sourceExpression>
> > >         > <OCQL>geom</OCQL>
> > >         > </sourceExpression>
> > >         > </AttributeMapping>
> > >         
> > >         Same result as before, the geometry is encoded as a WKT
> > >         string.
> > >         
> > >         >
> > >         > This tutorial suggests that you could also map the contained
> > >         > gml:AbstractGeometry (no need for targetAttributeNode):
> > >         >
> > >         
> > > https://sites.google.com/site/inspiremappingtutorial/land-use-mapping-details/5-2-spatialplan_mapping-xml
> > >         >
> > >         > <AttributeMapping>
> > >         > <targetAttribute>
> > >         >
> > >         
> > > lcv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_BoundingPolygon/gmd:polygon/gml:AbstractGeometry
> > >         > </targetAttribute>
> > >         > <sourceExpression>
> > >         > <OCQL>geom</OCQL>
> > >         > </sourceExpression>
> > >         > </AttributeMapping>
> > >         
> > >         This configuration produces an empty gml:AbstractGeometry tag
> > >         nested
> > >         inside a gmd:polygon tag:
> > >         
> > >         <lcv:extent>
> > >           <gmd:EX_Extent>
> > >            <gmd:geographicElement>
> > >              <gmd:EX_BoundingPolygon>
> > >                <gmd:polygon>
> > >                  <gml:AbstractGeometry/>
> > >                </gmd:polygon>
> > >              </gmd:EX_BoundingPolygon>
> > >            </gmd:geographicElement>
> > >           </gmd:EX_Extent>
> > >         </lcv:extent>
> > >         
> > >         I forgot to mention I'm using GeoServer 2.6.2, so GeoTools
> > >         12.2.
> > >         
> > >         I'll continue the investigation.
> > >         
> > >         >
> > >         > Please let us know if either of these mappings work for you.
> > >         >
> > >         > Kind regards,
> > >         > Ben.
> > >         
> > >         Best regards,
> > >         Stefano
> > >         
> > >         
> > >         
> > >         
> > > ------------------------------------------------------------------------------
> > >         One dashboard for servers and applications across
> > >         Physical-Virtual-Cloud
> > >         Widest out-of-the-box monitoring support with 50+ applications
> > >         Performance metrics, stats and reports that give you
> > >         Actionable Insights
> > >         Deep dive visibility with transaction tracing using APM
> > >         Insight.
> > >         http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> > >         _______________________________________________
> > >         GeoTools-GT2-Users mailing list
> > >         [email protected]
> > >         https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > >         
> > > 
> > > 
-- 

Best regards,
Stefano Costa

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Dott. Stefano Costa
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate.
Il loro utilizzo è consentito esclusivamente al destinatario del
messaggio, per le finalità indicate nel messaggio stesso. Qualora
riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
diverse, costituisce comportamento contrario ai principi dettati dal
D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely
for the attention and use of the named addressee(s) and may be
confidential or proprietary in nature or covered by the provisions of
privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New
Data Protection Code).Any use not in accord with its purpose, any
disclosure, reproduction, copying, distribution, or either
dissemination, either whole or partial, is strictly forbidden except
previous formal approval of the named addressee(s). If you are not the
intended recipient, please contact immediately the sender by
telephone, fax or e-mail and delete the information in this message
that has been received in error. The sender does not give any warranty
or accept liability as the content, accuracy or completeness of sent
messages and accepts no responsibility  for changes made after they
were sent or for other risks which arise as a result of e-mail
transmission, viruses, etc.




------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to