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

Reply via email to