[Geoserver-devel] GEOS-7349: GeoJSON geometry and geometry_name inconsistent on multi-geometry features

Hi GeoServer-Developers,

Andrea Aime asked me to involve this mailing list regarding the
following issue & pull request:
https://osgeo-org.atlassian.net/browse/GEOS-7349
https://github.com/geoserver/geoserver/pull/1370

Context:
- GeoServer WFS-Response with outputFormat=JSON
- FeatureType with multiple geometries
- any of the geometries might be null
- the JSON contains one "geometry" attribute, which might be null,
according to the spec
- the JSON contains one "geometry_name" attribute, which defines the
name of the attribute providing the value for the above
- GeoTools FeatureTypes have a "default geometry"

Question:
- What is the desired behaviour if the default geometry of the feature is null?

Solutions:
1) write "null" to the JSON "geometry" field and write the name of the
default geometry attribute to "geometry_name"
Pro: The value of the "geometry_name" field will be the name of the
GeoTools default geometry attribute, consistently across all features
of a feature type.

2) Serialize the first not-null geometry of the feature to the JSON
"geometry" field and write the corresponding field name to
"geometry_name"
Pro: The JSON default geometry will be populated more often than in
1). This makes it more likely for the feature to be displayed
out-of-the-box, like in OpenLayers.

Currently, in this case the "geometry_name" does not correspond to the
value of "geometry".

I can offer to fix this issue. Please given me a feedback which way you prefer.

Best regards,
Andreas

--
Andreas
----------------------------------------------------------------
ITS Telco Services GmbH
GIS Services & Solutions
Telecommunications Division
Dillenburger Str. 77
D-51105 Köln
Tel.: +49 (0)221 820 07 00
Fax : +49 (0)221 820 07 22
Mail: info@anonymised.com
Web : http://www.its-telco.de
----------------------------------------------------------------
Sitz der Gesellschaft: Köln
Amtsgericht Köln, HRB 59310
Geschäftsführer: Gunnar Haack, Ralf Petersilka, Michael Schnepf, Kai
Schriewer, Ludger Schulte
----------------------------------------------------------------

Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese
E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser
E-Mail ist nicht gestattet.

This e-mail may contain confidential information. If you are not the
intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in
this e-mail is strictly forbidden.

Hi,
I was hoping for others to chime in, but… well, let me break the ice.

Personally I like option 1) better, it makes GeoJSON consistent with the other
formats.

Note for others, the current behavior is a mix of 1 and 2 that is just wrong, it declares
the geometry attribute as the default geometry, but then the value is the
first non null geometry found. Just broken imho.

Cheers
Andrea

···

On Mon, Dec 21, 2015 at 1:06 PM, Andreas Watermeyer <Andreas.Watermeyer@anonymised.com> wrote:

Hi GeoServer-Developers,

Andrea Aime asked me to involve this mailing list regarding the
following issue & pull request:
https://osgeo-org.atlassian.net/browse/GEOS-7349
https://github.com/geoserver/geoserver/pull/1370

Context:

  • GeoServer WFS-Response with outputFormat=JSON
  • FeatureType with multiple geometries
  • any of the geometries might be null
  • the JSON contains one “geometry” attribute, which might be null,
    according to the spec
  • the JSON contains one “geometry_name” attribute, which defines the
    name of the attribute providing the value for the above
  • GeoTools FeatureTypes have a “default geometry”

Question:

  • What is the desired behaviour if the default geometry of the feature is null?

Solutions:

  1. write “null” to the JSON “geometry” field and write the name of the
    default geometry attribute to “geometry_name”
    Pro: The value of the “geometry_name” field will be the name of the
    GeoTools default geometry attribute, consistently across all features
    of a feature type.

  2. Serialize the first not-null geometry of the feature to the JSON
    “geometry” field and write the corresponding field name to
    “geometry_name”
    Pro: The JSON default geometry will be populated more often than in
    1). This makes it more likely for the feature to be displayed
    out-of-the-box, like in OpenLayers.

Currently, in this case the “geometry_name” does not correspond to the
value of “geometry”.

I can offer to fix this issue. Please given me a feedback which way you prefer.

Best regards,
Andreas


Andreas

ITS Telco Services GmbH
GIS Services & Solutions
Telecommunications Division
Dillenburger Str. 77
D-51105 Köln
Tel.: +49 (0)221 820 07 00
Fax : +49 (0)221 820 07 22
Mail: info@anonymised.com
Web : http://www.its-telco.de

Sitz der Gesellschaft: Köln
Amtsgericht Köln, HRB 59310
Geschäftsführer: Gunnar Haack, Ralf Petersilka, Michael Schnepf, Kai
Schriewer, Ludger Schulte

Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese
E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser
E-Mail ist nicht gestattet.

This e-mail may contain confidential information. If you are not the
intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in
this e-mail is strictly forbidden.



Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Geosolutions’ Winter Holidays from 24/12 to 6/1

Ing. Andrea Aime

@geowolf
Technical Lead

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

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.


Hi all,

I suppose solution 1) is accepted by all.

I will create a pull request.

Best regards,
Andreas