Syntax FACTORY_DEF SortFactory [FACTORY_NAME ] [INPUT FEATURE_TYPE [ ]* []*]* [GROUP_BY []+]* [FLUSH_WHEN_GROUPS_CHANGE (Yes|No)] [SORT_BY [ (NUMERIC|ALPHA) [(ASCENDING|DESCENDING)]]+] [SORT_DIRECTION (ASCENDING|DESCENDING)] [GEOMETRY_SORT_METHOD (HILBERT_2D|HILBERT_3D)] [MEMORY_CACHE_SIZE ] [OUTPUT SORTED FEATURE_TYPE [ ]* []*]* Overview This factory sorts features according to the values of the specified attributes, as determined by the factory definition. For each attribute name, directions are given about how its value should be interpreted when it is compared. If NUMERIC is specified, then numeric comparisons will be done. If ALPHA is specified, then alphanumeric comparisons will be done. If no SORT_BY clause is specified, then the SortFactory will hold all features that enter the factory until all other features have passed. Then it will release the features into the factory pipeline. This is useful if, for example, you want to detain certain features until all input features have arrived, thereby ensuring that no additional processing is performed. Once the factory is told to empty itself, it outputs all features it received in the order specified. Any SORT_BY clause that does not specify ASCENDING or DESCENDING will use the direction specified by SORT_DIRECTION. That is, the per-attribute sort direction overrides the global sort direction. By default, the SORT_DIRECTION is in ascending order. If the GEOMETRY_SORT_METHOD clause is present, this means the factory will sort the geometries by their Geometry, using Hilbert sorting (either in 2D or 3D). All of the parameters for attribute sorting will be ignored. - The centroid of the bounding box (2D or 3D) is used for sorting. - If 3D mode is selected, 2D geometries will assume a z value of 0.0 for sorting. This factory tries to balance speed and memory usage by storing some features in memory and some in a temporary disk file. The maximum number of features stored in memory can be set using the MEMORY_CACHE_SIZE clause. If this is not explicitly set, the default value used is 100. If an attribute name is specified but is not present on a feature, then the sorting algorithm will consider that feature to have a null or zero value for that attribute. An O(nlogn) algorithm is used to do the sorting. Parameters GROUP_BY This clause allows for processing features in groups based on one or more attributes on the input features. Processing will only be performed on input features whose group by attributes (as specified by this clause) are identical. FLUSH_WHEN_GROUPS_CHANGE If the GROUP_BY clause is specified, this clause (when set to Yes) will cause the factory to process and output the current group immediately when an attribute that does not belong to the current group is encountered. Output Tags The SortFactory supports the following output tag. SORTED Applied to all features that leave this factory.