Exemple #1
0
 def get_default_geometry(self):
     """
     Returns:
         The default geometry of the feature.
     """
     j_geom = self._java_ref.getDefaultGeometry()
     return GeometryType().from_java(j_geom)
Exemple #2
0
    def literal(self, value):
        """
        Constructs an expression with the given literal value.

        Args:
            value (any): The literal value to use.
        Returns:
            An Expression with the given literal value.
        """
        if isinstance(value, datetime):
            # Convert the date to a string
            value = value.strftime("%Y-%m-%dT%H:%M:%S")
        if isinstance(value, str):
            # Prevent Py4J from assuming the string matches up with the char variant method
            filter_factory_class = self._java_ref.getClass()
            object_class = reflection_util.classForName("java.lang.Object")
            class_array = java_gateway.new_array(java_pkg.java.lang.Class, 1)
            class_array[0] = object_class
            method = filter_factory_class.getMethod("literal", class_array)
            objects_array = java_gateway.new_array(java_pkg.java.lang.Object, 1)
            objects_array[0] = value
            return method.invoke(self._java_ref, objects_array)
        if isinstance(value, BaseGeometry):
            return self._java_ref.literal(GeometryType().to_java(value))
        return self._java_ref.literal(value)
Exemple #3
0
    def spatial_constraints(self, geometry):
        """
        Use the given geometry as a spatial constraint.

        Args:
            geometry (shapely.geometry.base.BaseGeometry): The geometry to use in
                the constraint.
        Returns:
            This spatial temporal constraints builder.
        """
        self._java_ref.spatialConstraints(GeometryType().to_java(geometry))
        return self