Dear community,

regarding one of our projects we utilized your open-source *PointStacker* and adjusted the source code to our needs. First of all, thanks a lot for providing this highly helpful code as open-source code! If you are interested, we would like to contribute to the development of the code with our extensions.We added input parameters, and output attributes that might be requested for other use cases as well. If you are interested in these code extensions, I would be happy to create a Merge Request. I am refering to /org/geotools/process/vector/PointStackerProcess.java <https://github.com/geotools/geotools/blob/master/modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointStackerProcess.java>. Here you can see our customized PointStackerProcess as forked repository <https://github.com/SaCodematix/geotools/blob/master/modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointStackerProcess.java> as well as the additional unit tests <https://github.com/SaCodematix/geotools/blob/master/modules/unsupported/process-feature/src/test/java/org/geotools/process/vector/PointStackerProcessTest.java> (see "CM_POINSTACKER" comments).

In the following you can find more detailed information about our code extensions:


(Definition: The data set consists of features that are stacked to cluster. A cluster point then is representing the assigned features. A StackedPoint contains a feature that is stacked to a cluster. Original attributes are column names of the data set connected through the GeoServer datastore. Single points are features that are not assigned to a cluster with other features, thus, count equals 1.)

  In addition to the original source code and the clustering by grid, our adjustments allow GeoServer users to cluster by an original attribute, such as state or district (depending on the given data set). The already existing location options 'nearest' and 'weighted' of how to position the cluster point are expanded by 'average' (average of all coordinates of the clustered features) and 'extent' (center of the minimum and maximumcoordinates in x and y direction). For this, an additional input parameter _clusterBasis_ is added. Depending on the data and use case, these locating approaches result in more suitable cluster point locations on the final map visualization.

The output is expanded by additional returning values. The fids (*listStackedPointsIDs*) and coordinates (*listStackedPtsCoos*) of the features belonging to the cluster are listed, as well as all available properties (attributes & values) for single points (*singlePointOrigAttributes*) which might be required as FeatureInfo on the final map.

  If the user wants to sort the resulting data collection (*sortedByField *by overwriting default values of result.SortBy()) by a specified original attributefield, for instance grades from 1 to 6, three additional parameters are introduced: _sortField_ (e.g. 'grade'), _sortBy_ (can be either 'DESCENDING' or 'ASCENDING' (default)), and _sortValueStackedPt_ to set a representative value for cluster points that otherwise would contain a list of grades, instead of a single number that can be sorted. We required this sorting method to influence the rendered z-order of several PointSymbolizers in the style .sld file, since the available VendorOption SortBy <https://docs.geoserver.org/latest/en/user/styling/sld/extensions/z-order/syntax.html> option had no influence on the z-order of the PointSymbolizers in our single FeatureTypeStyle since a transformation (PointStacker) is included.

  With these extensions, the user also has the possibility to add original attributes to the output result (_originalAttributes)_. For instance, ifthe following list is given in the style as list of original attributes,

      <ogc:Function name="parameter">
<ogc:Literal>originalAttributes</ogc:Literal>
        <ogc:Literal>*attrA,attrB*,*attrC*</ogc:Literal>
      </ogc:Function>

  the *extended output* is a FeatureCollection containing the following attributes:

 * fid - the fid of the point representing the cluster
 * count - the total number of points in the cluster
 * countunique - the number of unique point locations in the cluster
 * envBBOX - bounding box coordinates
 * *listStackedPointsIDs* - list of all IDs of the stacked features in
   the cluster
 * *listStackedPtsCoos* - list of all coordinates of the stacked
   features in the cluster
 * *singlePointOrigAttributes* - only for single points, all of its
   data properties (attributes & values)
 * *sortedByField* contains the original attribute values of the
   sortField, or the representative sortValueStackedPt for cluster
   points, or nothing, if no sortField is indicated
 * *attrA* - list of values for the first attribute of the input
   parameter originalAttributes
 * *attrB* - list of values for the second attribute of the input
   parameter originalAttributes
 * *attrC* - list of values for the third attribute of the input
   parameter originalAttributes, and so on.

   To approach this output, the following input parameters are added:

@DescribeParameter(
          name = "_clusterBasis_",
          description = "Indicate basis for clustering methods: 'grid' (default), or an original " +
                  "attribute such as state or district (data-dependent).",
          defaultValue = "grid"
   )
   @DescribeParameter(
          name = "_originalAttributes_",
          description = "List of original attributes that are requested to be returned. If these " +                   "indicated attributes are no actual original attributes of data, they will be ignored. " +                   "Required as comma-separated list of format, e.g: a,b,c. All in lower case!",
          min = 0
   )
          String argOrigAttributes,
   @DescribeParameter(
          name = "_sortField_",
          description = "Attribute field by which resulting collection (optionally) can be sorted.",
          min = 0
   )
          String argSortField,
   @DescribeParameter(
          name = "_sortBy_",
          description = "If collection is desired to be sorted through a specified 'sortField', one can " +                   "indicate the method to sort, either 'DESCENDING' or 'ASCENDING' (default) .",
          min = 0
  )
          String argSortOrder,
   @DescribeParameter(
          name = "_sortValueStackedPt_",
          description = "If a collection is desired to be sorted vy a specified column 'sortField', here" +                   "you can indicate the value that will be used for clustered points as sort value since only" +                   "single points will keep the original value of the 'sortField' while clustered points " +                   "gather the values of the 'sortField's to an array which will be replaced by this value " +
                  "instead, such as 0 (default).",
          min = 0
   )
          String argSortValueStackedPt __


Please let me know, if you have any questions or unclarity. I am looking forward to any responses, discussions and more information about a possible Merge Request.


--

All the best

Sabrina Arnold

logo
Felsbachstr. 5/7
D-07745 Jena
Tel:     +49 (3641) 30 38-12
Fax:     +49 (3641) 30 38-20
Internet: www.codematix.de <https://www.codematix.de/>
e-mail:   sarn...@codematix.de
------------------------------------------------------------------------------------------------------------
Handelsregister: Amtsgericht Jena / HRB 10575 / Geschäftsführung: Carsten Busch

Diese E-Mail könnte vertrauliche und / oder rechtlich geschützte Informationen enthalten. 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 Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

This e-mail may contain confidential and/or privileged 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.

Please consider the environment - only print this e-mail if absolutely necessary!
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to