GeoJSON encoding of complex features produces duplicates [SEC=UNCLASSIFIED]

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GeoJSON encoding of complex features produces duplicates [SEC=UNCLASSIFIED]

Michael Sexton

Hi


We have just been testing the new GeoJSON output format for our complex app-schema services, which is really great and will allow us to plug in our data directly to web apps.


However we have noticed what is possibly a strange bug where if there are multiple gml:ReferenceTypes in a complex type and one of them is an unbounded reference. A snippet from our mapping file:


<AttributeMapping>
<targetAttribute>gsmlbh:indexData/gsmlbh:BoreholeDetails/gsmlbh:purpose</targetAttribute>
<ClientProperty>
<name>xlink:href</name>
<value>purpose_href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>purpose_title</value>
</ClientProperty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>gsmlbh:indexData/gsmlbh:BoreholeDetails/gsmlbh:startPoint</targetAttribute>
<ClientProperty>
<name>xlink:href</name>
<value>startpoint_href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>startpoint_title</value>
</ClientProperty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>gsmlbh:indexData/gsmlbh:BoreholeDetails/gsmlbh:inclinationType</targetAttribute>
<targetAttributeNode>gml:ReferenceType</targetAttributeNode>
<ClientProperty>
<name>xlink:href</name>
<value>inclinationtype_href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>inclinationtype_title</value>
</ClientProperty>
</AttributeMapping>
This produces the following GeoJSON output:



We don't get inclinationType or startPoint, these are instead populated into an array of purpose.

I suspect the reason is that the gsmlbh:purpose element is an unbounded reference type, while the other two don't. So the GeoJSON encoder picks up the attribute mappings and populates gsmlbh:purpose with any gml:ReferenceType it finds in the mapping file


Relevant code in the XSD:


<element name="startPoint" type="gml:ReferenceType" nillable="true" minOccurs="0">
<annotation>
<documentation>The property startPoint:BoreholeStartPointCode provides a term from a controlled vocabulary indicating the named position relative to ground surface where the borehole commenced. (e.g., natural ground surface, open pit floor, underground, offshore)</documentation>
<appinfo>
<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholeStartPointCode</targetElement>
<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholeStartPointCode</targetCodeList>
</appinfo>
</annotation>
</element>
<element name="inclinationType" type="gml:ReferenceType" nillable="true" minOccurs="0">
<annotation>
<documentation>The property inclinationType:BoreholeInclinationCode contains a term from a controlled vocabulary indicating the inclination type of the borehole. Appropriate terms would include vertical; inclined up; inclined down, horizontal.</documentation>
<appinfo>
<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholeInclinationCode</targetElement>
<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholeInclinationCode</targetCodeList>
</appinfo>
</annotation>
</element>
<element name="boreholeMaterialCustodian" type="cit:CI_Responsibility_PropertyType" nillable="true" minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>The property boreholeMaterialCustodian is an association between BoreholeDetails and a CIT:CI_ResponsibleParty describing the organisation that is custodian of the drilled material recovered from the borehole.</documentation>
</annotation>
</element>
<element name="purpose" type="gml:ReferenceType" nillable="true" minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>The property purpose:BoreholePurposeCode contains a term from a controlled vocabulary describing the purpose for which the borehole was drilled. e.g., site investigation, mineral exploration, hydrocarbon exploration, water resources.</documentation>
<appinfo>
<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholePurposeCode</targetElement>
<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholePurposeCode</targetCodeList>
</appinfo>
</annotation>
</element>


http://schemas.opengis.net/gsml/4.1/borehole.xsd

If I remove the maxOccurs="unbounded" from gsmlbh:purpose, I don't get the duplication.

Thanks


Michael Sexton
Resources Division Information Services | Resources Division
 
t +61 2 6249 9262    www.ga.gov.au
 
 

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.
-------------------------------------------------------------------------------------------------------------------------



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: GeoJSON encoding of complex features produces duplicates [SEC=UNCLASSIFIED]

geowolf
Hi Michael,
we are aware of the issue and there is a good chance it's going to be fixed soon, but as always, no promises :-)

Cheers
Andrea

On Fri, May 10, 2019 at 7:11 AM Sexton Michael <[hidden email]> wrote:

Hi


We have just been testing the new GeoJSON output format for our complex app-schema services, which is really great and will allow us to plug in our data directly to web apps.


However we have noticed what is possibly a strange bug where if there are multiple gml:ReferenceTypes in a complex type and one of them is an unbounded reference. A snippet from our mapping file:


<AttributeMapping>
<targetAttribute>gsmlbh:indexData/gsmlbh:BoreholeDetails/gsmlbh:purpose</targetAttribute>
<ClientProperty>
<name>xlink:href</name>
<value>purpose_href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>purpose_title</value>
</ClientProperty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>gsmlbh:indexData/gsmlbh:BoreholeDetails/gsmlbh:startPoint</targetAttribute>
<ClientProperty>
<name>xlink:href</name>
<value>startpoint_href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>startpoint_title</value>
</ClientProperty>
</AttributeMapping>
<AttributeMapping>
<targetAttribute>gsmlbh:indexData/gsmlbh:BoreholeDetails/gsmlbh:inclinationType</targetAttribute>
<targetAttributeNode>gml:ReferenceType</targetAttributeNode>
<ClientProperty>
<name>xlink:href</name>
<value>inclinationtype_href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>inclinationtype_title</value>
</ClientProperty>
</AttributeMapping>
This produces the following GeoJSON output:



We don't get inclinationType or startPoint, these are instead populated into an array of purpose.

I suspect the reason is that the gsmlbh:purpose element is an unbounded reference type, while the other two don't. So the GeoJSON encoder picks up the attribute mappings and populates gsmlbh:purpose with any gml:ReferenceType it finds in the mapping file


Relevant code in the XSD:


<element name="startPoint" type="gml:ReferenceType" nillable="true" minOccurs="0">
<annotation>
<documentation>The property startPoint:BoreholeStartPointCode provides a term from a controlled vocabulary indicating the named position relative to ground surface where the borehole commenced. (e.g., natural ground surface, open pit floor, underground, offshore)</documentation>
<appinfo>
<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholeStartPointCode</targetElement>
<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholeStartPointCode</targetCodeList>
</appinfo>
</annotation>
</element>
<element name="inclinationType" type="gml:ReferenceType" nillable="true" minOccurs="0">
<annotation>
<documentation>The property inclinationType:BoreholeInclinationCode contains a term from a controlled vocabulary indicating the inclination type of the borehole. Appropriate terms would include vertical; inclined up; inclined down, horizontal.</documentation>
<appinfo>
<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholeInclinationCode</targetElement>
<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholeInclinationCode</targetCodeList>
</appinfo>
</annotation>
</element>
<element name="boreholeMaterialCustodian" type="cit:CI_Responsibility_PropertyType" nillable="true" minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>The property boreholeMaterialCustodian is an association between BoreholeDetails and a CIT:CI_ResponsibleParty describing the organisation that is custodian of the drilled material recovered from the borehole.</documentation>
</annotation>
</element>
<element name="purpose" type="gml:ReferenceType" nillable="true" minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>The property purpose:BoreholePurposeCode contains a term from a controlled vocabulary describing the purpose for which the borehole was drilled. e.g., site investigation, mineral exploration, hydrocarbon exploration, water resources.</documentation>
<appinfo>
<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholePurposeCode</targetElement>
<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholePurposeCode</targetCodeList>
</appinfo>
</annotation>
</element>


http://schemas.opengis.net/gsml/4.1/borehole.xsd

The GeoSciML Borehole package contains an information model for boreholes and related artefacts. This is primarily through re-use of standard components from the Observations and Measurements (ISO19156).
If I remove the maxOccurs="unbounded" from gsmlbh:purpose, I don't get the duplication.

Thanks


Michael Sexton
Resources Division Information Services | Resources Division
 
t +61 2 6249 9262    www.ga.gov.au
 
cid:image006.png@01D239A5.39C6E990
 
cid:image002.png@01D239A5.39C6E990cid:image003.png@01D239A5.39C6E990cid:image007.png@01D239A5.39C6E990cid:image008.png@01D239A5.39C6E990

Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is intended only for the person or entity to which it is addressed. If you are not the intended recipient, then you have received this e-mail by mistake and any use, dissemination, forwarding, printing or copying of this e-mail and its file attachments is prohibited. The security of emails transmitted cannot be guaranteed; by forwarding or replying to this email, you acknowledge and accept these risks.
-------------------------------------------------------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users