Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
That is good thinking Andrea, that will probably be the most efficient approach. -- Jody Garnett On Wed, 21 Oct 2020 at 00:52, Andrea Aime wrote: > On Wed, Oct 21, 2020 at 9:50 AM Andrea Aime > wrote: > >> Long story short, you need three separate rules anyways >> > > Actually wait, no, given GeoServer's ability to accept Functions in the > geometry property of each symbolizer (not part of the standard btw), > one rule with three symbolizers, each using the right function in the > geometry field, will do. > > Cheers > Andrea > > == > > 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 Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
On Wed, Oct 21, 2020 at 9:50 AM Andrea Aime wrote: > Long story short, you need three separate rules anyways > Actually wait, no, given GeoServer's ability to accept Functions in the geometry property of each symbolizer (not part of the standard btw), one rule with three symbolizers, each using the right function in the geometry field, will do. Cheers Andrea == 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 Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
On Tue, Oct 20, 2020 at 11:33 PM Jody Garnett wrote: > 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. > That's what you want to do, in the end, due to SLD symbolizer application rules. GeoServer does not implement them 100% percent, but the standard says something like: - Given a line symbolizer, paint polygon borders (I can't remember if points need to be converted to tiny lines, believe not) - Given a point symbolizer, paint the centroid of whatever you're given that's not a point - Given a polygon symbolizer, close the lines to form a polygon, create a small square around points, and paint the result as a polygon Long story short, you need three separate rules anyways Cheers Andrea == 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 Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
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 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 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" >> *An: *"groznykh" >> *CC: *"Geoserver USERS" >> *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 evaluate(Object object, Class 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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
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 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" > *An: *"groznykh" > *CC: *"Geoserver USERS" > *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 evaluate(Object object, Class 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 points = new ArrayList<>(); > for (int i; 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; jpoints.add( (Point) pts.getGeometryN(j); >} > } > } > return geometryFactory().createMultiPoint(points.toArray(new > Point[p
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
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 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" An: "groznykh" CC: "Geoserver USERS" 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 evaluate(Object object, Class 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 points = new ArrayList<>(); for (int i; i 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.sourc
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
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" An: "groznykh" CC: "Geoserver USERS" 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 | https://docs.geotools.org/latest/userguide/tutorial/function.html ] 2) A method similar to: public T evaluate(Object object, Class 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 points = new ArrayList<>(); for (int i; imailto:groznykh@gmail.com | 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 | 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#/ | http://www.ianturton.com/talks/foss4g.html#/ ] - The GeoServer user list posting guidelines: [ http://geoserver.org/comm/userlist-guidelines.html | 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 | https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer ] [ mailto:Geoserver-users@lists.sourceforge.net | Geoserver-users@lists.sourceforge.net ] [ https://lists.sourceforge.net/lists/listinfo/geoserver-users | 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 EMF_fixed2.sld Description: XML document ___ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earni
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 evaluate(Object object, Class 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 points = new ArrayList<>(); for (int i; i 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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
Thanks for answers! Yeah, such function would be awesome вт, 7 апр. 2020 г. в 19:21, Jody Garnett : > That is a tricky question, I am not sure we have addressed that case yet. > > It may be worth making a function that returns *only* the points from a > collection (as a MultiPoint), and then only the lines, and then only the > polygons. > > slice( geometryCollection, dimension ) > > So: > slice( collection, 0 ) = > slice( collection, 1 ) = MultiLineString > slice( collection, 2 ) = MultiPolygon > > Or because there are only three perhaps, points(collection), lines( > collection), polygons(collection) > > With those functions you could construct a more appropriate generic style > for your data. > -- > Jody Garnett > > > On Mon, 6 Apr 2020 at 17:30, Artem Groznykh > wrote: > >> Hi there. >> >> I created an YSLD style for Polygons, LineStrings and Points >> >> feature-styles: >>> - name: name >>> x-ruleEvaluation: first >>> rules: >>> - filter: ${dimension(geometry()) = 2} >>> symbolizers: >>> - polygon: >>> fill-color: 'yellow' >>> stroke-color: 'red' >>> >>> - filter: ${dimension(geometry()) = 1} >>> symbolizers: >>> - line: >>> stroke-color: 'blue' >>> >>> - else: true >>> symbolizers: >>> - point: >>> symbols: >>> - mark: >>> shape: circle >>> stroke-width: 1 >> >> >> It works fine with Polygon and Linestring geometries. >> >> But when geometry is a GeometryCollection with Polygon and LineString >> inside then all child geometries have style of polygone (dimension of >> Collection is 2). If only Linestrings and Points are >> indise GeometryCollection then all children have style of lineString >> (dimension of Collection is 1). >> >> How to apply different styles for geometries of different types inside >> GeometryCollection? >> ___ >> 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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
That is a tricky question, I am not sure we have addressed that case yet. It may be worth making a function that returns *only* the points from a collection (as a MultiPoint), and then only the lines, and then only the polygons. slice( geometryCollection, dimension ) So: slice( collection, 0 ) = slice( collection, 1 ) = MultiLineString slice( collection, 2 ) = MultiPolygon Or because there are only three perhaps, points(collection), lines( collection), polygons(collection) With those functions you could construct a more appropriate generic style for your data. -- Jody Garnett On Mon, 6 Apr 2020 at 17:30, Artem Groznykh wrote: > Hi there. > > I created an YSLD style for Polygons, LineStrings and Points > > feature-styles: >> - name: name >> x-ruleEvaluation: first >> rules: >> - filter: ${dimension(geometry()) = 2} >> symbolizers: >> - polygon: >> fill-color: 'yellow' >> stroke-color: 'red' >> >> - filter: ${dimension(geometry()) = 1} >> symbolizers: >> - line: >> stroke-color: 'blue' >> >> - else: true >> symbolizers: >> - point: >> symbols: >> - mark: >> shape: circle >> stroke-width: 1 > > > It works fine with Polygon and Linestring geometries. > > But when geometry is a GeometryCollection with Polygon and LineString > inside then all child geometries have style of polygone (dimension of > Collection is 2). If only Linestrings and Points are > indise GeometryCollection then all children have style of lineString > (dimension of Collection is 1). > > How to apply different styles for geometries of different types inside > GeometryCollection? > ___ > 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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
Hi, I agree restructuring seems the only way, SLD does not allow splitting a Geometry in its own components and rendering each in a different ways, has to be done before it reaches the symbolizers. Could be done statically, as described in the docs, or one could develop some Java code leveraging the "Rendering transformations <https://docs.geoserver.org/stable/en/user/styling/sld/extensions/rendering-transform.html>" machinery, which would take a feature with a geometry collection, and split it out in N, one per component, or at least in 2 or 3, one per geometric type, repeating all other attributes along. Some development oriented docs here: https://docs.geoserver.org/latest/en/developer/programming-guide/wps-services/implement-rendertrans.html Cheers Andrea On Tue, Apr 7, 2020 at 11:25 AM Vitor Fonseca wrote: > > Juka is right, > According to documentation here: > > > https://docs.geoserver.org/latest/en/user/styling/sld/tipstricks/mixed-geometries.html#dimension-function > > *dimension=2* function won't select geometrycollection, only Polygons and > MultiPolygons > > Maybe you should consider restructuring the data > > > https://docs.geoserver.org/latest/en/user/styling/sld/tipstricks/mixed-geometries.html#restructuring-the-data > > Rahkonen Jukka (MML) escreveu no > dia terça, 7/04/2020 à(s) 10:04: > >> Hi, >> >> The question was about GeometryCollections so all the geometries are of >> the same type. >> >> -Jukka Rahkonen- >> >> -Alkuperäinen viesti- >> Lähettäjä: HSt >> Lähetetty: tiistai 7. huhtikuuta 2020 11.40 >> Vastaanottaja: geoserver-users@lists.sourceforge.net >> Aihe: Re: [Geoserver-users] How to apply different styles for different >> geometry types in GeometryCollection? >> >> Hi, >> >> you need a different filter, which checks the /geometryType/ of your >> geometry column, for example: >> >> - filter: ${geometryType(yourgeometrycolumn) = 'Point'} >> symbolizers: >> - point: >> ... >> >> - filter: ${geometryType(yourgeometrycolumn) = 'Polygon'} >> symbolizers: >> - polygon: >> ... >> >> Cheers, >> HSt >> >> >> >> -- >> Sent from: >> http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html >> >> > > Rahkonen Jukka (MML) escreveu no > dia terça, 7/04/2020 à(s) 10:04: > >> Hi, >> >> The question was about GeometryCollections so all the geometries are of >> the same type. >> >> -Jukka Rahkonen- >> >> -Alkuperäinen viesti- >> Lähettäjä: HSt >> Lähetetty: tiistai 7. huhtikuuta 2020 11.40 >> Vastaanottaja: geoserver-users@lists.sourceforge.net >> Aihe: Re: [Geoserver-users] How to apply different styles for different >> geometry types in GeometryCollection? >> >> Hi, >> >> you need a different filter, which checks the /geometryType/ of your >> geometry column, for example: >> >> - filter: ${geometryType(yourgeometrycolumn) = 'Point'} >> symbolizers: >> - point: >> ... >> >> - filter: ${geometryType(yourgeometrycolumn) = 'Polygon'} >> symbolizers: >> - polygon: >> ... >> >> Cheers, >> HSt >> >> >> >> -- >> 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/user
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
Juka is right, According to documentation here: https://docs.geoserver.org/latest/en/user/styling/sld/tipstricks/mixed-geometries.html#dimension-function *dimension=2* function won't select geometrycollection, only Polygons and MultiPolygons Maybe you should consider restructuring the data https://docs.geoserver.org/latest/en/user/styling/sld/tipstricks/mixed-geometries.html#restructuring-the-data Rahkonen Jukka (MML) escreveu no dia terça, 7/04/2020 à(s) 10:04: > Hi, > > The question was about GeometryCollections so all the geometries are of > the same type. > > -Jukka Rahkonen- > > -Alkuperäinen viesti- > Lähettäjä: HSt > Lähetetty: tiistai 7. huhtikuuta 2020 11.40 > Vastaanottaja: geoserver-users@lists.sourceforge.net > Aihe: Re: [Geoserver-users] How to apply different styles for different > geometry types in GeometryCollection? > > Hi, > > you need a different filter, which checks the /geometryType/ of your > geometry column, for example: > > - filter: ${geometryType(yourgeometrycolumn) = 'Point'} > symbolizers: > - point: > ... > > - filter: ${geometryType(yourgeometrycolumn) = 'Polygon'} > symbolizers: > - polygon: > ... > > Cheers, > HSt > > > > -- > Sent from: > http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html > > Rahkonen Jukka (MML) escreveu no dia terça, 7/04/2020 à(s) 10:04: > Hi, > > The question was about GeometryCollections so all the geometries are of > the same type. > > -Jukka Rahkonen- > > -Alkuperäinen viesti----- > Lähettäjä: HSt > Lähetetty: tiistai 7. huhtikuuta 2020 11.40 > Vastaanottaja: geoserver-users@lists.sourceforge.net > Aihe: Re: [Geoserver-users] How to apply different styles for different > geometry types in GeometryCollection? > > Hi, > > you need a different filter, which checks the /geometryType/ of your > geometry column, for example: > > - filter: ${geometryType(yourgeometrycolumn) = 'Point'} > symbolizers: > - point: > ... > > - filter: ${geometryType(yourgeometrycolumn) = 'Polygon'} > symbolizers: > - polygon: > ... > > Cheers, > HSt > > > > -- > 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 > -- www.vfonsecaz.pt ___ 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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
Hi, The question was about GeometryCollections so all the geometries are of the same type. -Jukka Rahkonen- -Alkuperäinen viesti- Lähettäjä: HSt Lähetetty: tiistai 7. huhtikuuta 2020 11.40 Vastaanottaja: geoserver-users@lists.sourceforge.net Aihe: Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection? Hi, you need a different filter, which checks the /geometryType/ of your geometry column, for example: - filter: ${geometryType(yourgeometrycolumn) = 'Point'} symbolizers: - point: ... - filter: ${geometryType(yourgeometrycolumn) = 'Polygon'} symbolizers: - polygon: ... Cheers, HSt -- 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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
Hi, you need a different filter, which checks the /geometryType/ of your geometry column, for example: - filter: ${geometryType(yourgeometrycolumn)='Point'} symbolizers: - point: ... - filter: ${geometryType(yourgeometrycolumn)='Polygon'} symbolizers: - polygon: ... Cheers, HSt -- 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
Re: [Geoserver-users] How to apply different styles for different geometry types in GeometryCollection?
Hi, you need a different filter, which checks the /geometryType/ of your geometry column, for example: - filter: ${geometryType(yourgeometrycolumn) = 'Point'} symbolizers: - point: ... - filter: ${geometryType(yourgeometrycolumn) = 'Polygon'} symbolizers: - polygon: ... Cheers, HSt -- 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] How to apply different styles for different geometry types in GeometryCollection?
Hi there. I created an YSLD style for Polygons, LineStrings and Points feature-styles: > - name: name > x-ruleEvaluation: first > rules: > - filter: ${dimension(geometry()) = 2} > symbolizers: > - polygon: > fill-color: 'yellow' > stroke-color: 'red' > > - filter: ${dimension(geometry()) = 1} > symbolizers: > - line: > stroke-color: 'blue' > > - else: true > symbolizers: > - point: > symbols: > - mark: > shape: circle > stroke-width: 1 It works fine with Polygon and Linestring geometries. But when geometry is a GeometryCollection with Polygon and LineString inside then all child geometries have style of polygone (dimension of Collection is 2). If only Linestrings and Points are indise GeometryCollection then all children have style of lineString (dimension of Collection is 1). How to apply different styles for geometries of different types inside GeometryCollection? ___ 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