Caught up with the JTS team.

There is a postgis function
https://postgis.net/docs/ST_CollectionExtract.html that covers this concept.

There are a couple implementations in JTS, GeometryExtracter is close but
only can do one geometry type at a time, and we want to do both Point and
MultiPoint at the same time.

The other interesting wrinkle ...
- Points (Point and MultiPoint) can be extracted into a a MultiPoint
- Lines (LineString and MultiLineString) can be extracted into a
MultiLineString
- Polygons (Polygon and MultiPolygon) ... cannot be extracted into a
MultiPolygon (because they may end up overlapping)

Jody


--
Jody Garnett


On Mon, 19 Oct 2020 at 07:29, Jody Garnett <jody.garn...@gmail.com> wrote:

> This bug report is for a slightly different problem, when working with a
> geometry collection the ability to filter out only the points and
> multi-points.
> --
> Jody Garnett
>
>
> On Mon, 19 Oct 2020 at 02:21, Ron Lindhoudt <rlindho...@yahoo.com> wrote:
>
>> You should probably use the existion function `geometryType` in the SLD
>> rule.
>> If you don't do that a polygon is visualised as a polygon and also point
>> (the centre of the polygon) for example.
>>
>> The only thing is that there are multiple geometry-types that represent
>> Point, Polygon and Line.
>>
>> Polygon:
>> - Polygon
>> - MultiPolygon
>> - MultiSurface
>> - CurvePolygon
>> - GeometryCollection (this is a difficult one!)
>>
>> Line:
>> - LineString
>> - CircularString
>> - CompoundCurve
>> -CompoundRing
>> - CircularRing
>> - MultiCurve
>> - MultiLineString
>>
>> Point:
>> - Point
>> - Multipoint
>>
>> It would be nice if there was a separate function "mainGeometryType" that
>> just returns Point, Polygon, Line or Collection
>>
>> On Monday, 19 October 2020, 10:32:15 CEST, Florian Hoedt <
>> florian.ho...@thuenen.de> wrote:
>>
>>
>> Hi,
>>
>> Sorry for interrupting into this conversation, but: Are you aware that
>> SLD can style different geometries out of the box? See attached SLD for the
>> INSPIRE theme Environmental Monitoring Facilities which does use survey
>> area (Polygon) and representative point (Point) as geometry. But maybe this
>> is about something different and you can ignore this.
>> yours, Florian
>> --
>> MSc Florian Hoedt
>> Head Geoinformatics | OpenData Representative
>> Thünen Institute, Centre for Information Management
>> Bundesallee 44
>> 38116 Braunschweig
>>
>> Tel:  +49 531 596-1428
>> Mobil: +49 162 92 50 275
>> Fax:  +49 531 596-1499
>> Mail: florian.ho...@thuenen.de
>> Web:  www.thuenen.de
>>
>> The Johann Heinrich von Thünen Institute, Federal Research Institute for
>> Rural Areas, Forestry and Fisheries – Thünen Institute in brief – consists
>> of 14 specialized institutes that carry out research and provide policy
>> advice in the fields of economy, ecology and technology.
>>
>> ------------------------------
>> *Von: *"Jody Garnett" <jody.garn...@gmail.com>
>> *An: *"groznykh" <groznykh....@gmail.com>
>> *CC: *"Geoserver USERS" <geoserver-users@lists.sourceforge.net>
>> *Gesendet: *Montag, 19. Oktober 2020 07:05:10
>> *Betreff: *Re: [Geoserver-users] How to apply different styles for
>> different geometry types in GeometryCollection?
>>
>> I think it is a good idea, but have not had time/budget to work on this
>> myself.
>> Indeed I have had this draft email replying to you open for a month or
>> so. I have been very focused on transitioning our build infrastructure,
>> with some small development implementing mapbox style expression support :)
>> Do you have any experience with Java? Or if there are any volunteers on
>> this list interested it should be a combination of:
>>
>> 1) https://docs.geotools.org/latest/userguide/tutorial/function.html
>>
>> 2) A method similar to:
>>
>>     public <T> T evaluate(Object object, Class<T> context) {
>>         Expression pointExpression = parameters.get(0);
>>         Geometry geometry = pointExpression.evaluate(object,
>> Geometry.class);
>>         if( geometry == null) return geometry;
>>
>>         Expression dimensionExpression = parameters.get(1);
>>         Integer dimension = dimensionExpression.evaluate(object,
>> Integer.class);
>>
>>
>>        switch(dimension) {
>>        case 0: return toPuntal(geometry);
>>        case 1: return toLineal(geometry);
>>        case 2: return toPolygonal(geometry);
>>        default:
>>            throw IllegalArgumentException("Dimension "+dimension+"
>> invalid (0,1 or 2 supported)");
>>        }
>>     }
>>
>> 3) And then methods to collect each type, this could probably be done a
>> bit more neatly
>>
>>    return Geometry toPuntal(Geometry geometry){
>>         if( geometry instanceof Puntal) return geometry;
>>         if( geometry instanceof GeometryCollection){
>>               GeometryCollection collection = (GeometryCollection)
>> geometry;
>>               ArrayList<Point> points = new ArrayList<>();
>>               for (int i; i<collection.getNumGeometries(); i++){
>>                   Geometry g = collection.getGeometryN(geometry,i);
>>                   Geometry = toPuntal(g);
>>                   if( g instanceof Point)
>>                        points.add( (Point) g );
>>                   else if( g instanceof MultiPoint) {
>>                        MultiPoint pts = (MultiPoint) g;
>>                        for (int j; j<pts.getNumGeometries(); j++){
>>                            points.add( (Point) pts.getGeometryN(j);
>>                        }
>>                   }
>>               }
>>              return geometryFactory().createMultiPoint(points.toArray(new
>> Point[points.size()]);
>>         }
>>         return geometryFactory().createMultiPoint();
>>    }
>>
>>
>>
>> On Wed, 23 Sep 2020 at 03:51, groznykh <groznykh....@gmail.com> wrote:
>>
>> Hi Jody
>>
>> Is there a possibility that such functions would be realized?
>>
>>
>>
>> --
>> Sent from:
>> http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html
>>
>>
>> _______________________________________________
>> 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
>>
>>
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>> _______________________________________________
>> 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
>>
>>
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>
_______________________________________________
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


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to