Class FeatureOperations

    • Method Detail

      • link

        public static AbstractOperation link​(Map<String,​?> identification,
                                             AbstractIdentifiedType referent)
        Creates an operation which is only an alias for another property.
        Example: features often have a property that can be used as identifier or primary key. But the name of that property may vary between features of different types. For example features of type Country may have identifiers named “ISO country code” while features of type Car may have identifiers named “license plate number”. In order to simplify identifier usages regardless of their name, an application could choose to add in all features a virtual property named "identifier" which links to whatever property is used as an identifier in an arbitrary feature. So the definition of the Car feature could contain the following code:
        AttributeType licensePlateNumber = ...;            // Attribute creation omitted for brevity
        FeatureType car = new DefaultFeatureType(...,      // Arguments omitted for brevity
                licensePlateNumber, model, owner,
                FeatureOperations.link(singletonMap(NAME_KEY, "identifier"), licensePlateNumber);
        Since this method does not create new property (it only redirects to an existing property), this method ignores all "result.*" entries in the given identification map.
        Read/write behavior
        Since the Operation​.apply(…) method returns directly the property identified by the referent argument, the returned property is writable if the referenced property is also writable.
        Warning: The type of referent parameter will be changed to Property­Type if and when such interface will be defined in GeoAPI.
        Parameters:
        identification - the name and other information to be given to the operation.
        referent - the referenced attribute or feature association.
        Returns:
        an operation which is an alias for the referent property.
      • compound

        public static AbstractOperation compound​(Map<String,​?> identification,
                                                 String delimiter,
                                                 String prefix,
                                                 String suffix,
                                                 AbstractIdentifiedType... singleAttributes)
                                          throws UnconvertibleObjectException
        Creates an operation concatenating the string representations of the values of multiple properties. This operation can be used for creating a compound key as a String that consists of two or more attribute values that uniquely identify a feature instance.

        The delimiter, prefix and suffix arguments given to this method are used in the same way than String­Joiner, except for null values. Null prefix, suffix and property values are handled as if they were empty strings.

        If the same character sequences than the given delimiter appears in a property value, the '\' escape character will be inserted before that sequence. If the '\' character appears in a property value, it will be doubled.

        Restrictions:

        • The single properties can be either attributes or operations that produce attributes; feature associations are not allowed, unless they have an "sis:identifier" property.
        • Each attribute shall contain at most one value; multi-valued attributes are not allowed.
        • The delimiter can not contain the '\' escape character.
        Read/write behavior
        This operation supports both reading and writing. When setting a value on the attribute created by this operation, the given string value will be split around the delimiter and each substring will be forwarded to the corresponding single property.
        Warning: The type of single­Attributes elements will be changed to Property­Type if and when such interface will be defined in GeoAPI.
        Parameters:
        identification - the name and other information to be given to the operation.
        delimiter - the characters to use as delimiter between each single property value.
        prefix - characters to use at the beginning of the concatenated string, or null if none.
        suffix - characters to use at the end of the concatenated string, or null if none.
        single­Attributes - identification of the single attributes (or operations producing attributes) to concatenate.
        Returns:
        an operation which concatenates the string representations of all referenced single property values.
        Throws:
        Unconvertible­Object­Exception - if at least one of the given single­Attributes uses a value class which is not convertible from a String.
        Illegal­Argument­Exception - if single­Attributes is an empty sequence, or contains a property which is neither an Attribute­Type or an Operation computing an attribute, or an attribute has a maximum number of occurrences greater than 1.
        See Also:
        Compound key on Wikipedia
      • envelope

        public static AbstractOperation envelope​(Map<String,​?> identification,
                                                 CoordinateReferenceSystem crs,
                                                 AbstractIdentifiedType... geometryAttributes)
                                          throws FactoryException
        Creates an operation computing the envelope that encompass all geometries found in the given attributes. Geometries can be in different coordinate reference systems; they will be transformed to the first non-null CRS in the following choices:
        1. the CRS specified to this method,
        2. the CRS of the default geometry, or
        3. the CRS of the first non-empty geometry.
        The result of this operation is an Attribute with values of type Envelope. If the crs argument given to this method is non-null, then the envelope CRS will be that CRS.
        Limitations
        If a geometry contains other geometries, this operation queries only the envelope of the root geometry. It is the root geometry responsibility to take in account the envelope of all its children.
        Read/write behavior
        This operation is read-only. Calls to Attribute​.set­Value(Envelope) will result in an Illegal­State­Exception to be thrown.
        Warning: The type of geometry­Attributes elements will be changed to Property­Type if and when such interface will be defined in GeoAPI.
        Parameters:
        identification - the name and other information to be given to the operation.
        crs - the Coordinate Reference System in which to express the envelope, or null.
        geometry­Attributes - the operation or attribute type from which to get geometry values. Any element which is null or has a non-geometric value class will be ignored.
        Returns:
        an operation which will compute the envelope encompassing all geometries in the given attributes.
        Throws:
        Factory­Exception - if a coordinate operation to the target CRS can not be created.