geoview-core - v2.2.0
    Preparing search index...

    Class GeometryApi

    Class used to manage vector geometries (Polyline, Polygon, Circle, Marker...).

    Index

    Constructors

    Properties

    defaultGeometryGroupId: string = 'defaultGeomGroup'

    The default geometry group name

    geometries: Feature<Geometry>[] = []

    All added geometries

    Methods

    • Creates a new circle.

      Parameters

      • coordinate: Coordinate

        The lon/lat coordinate of the circle

      • Optionaloptions: {
            geometryLayout?: "XY" | "XYZ" | "XYM" | "XYZM";
            projection?: number;
            style?: TypeFeatureCircleStyle;
        }

        Optional circle options including styling

      • OptionaloptionalFeatureId: string

        Optional id to be used to manage this geometry

      • OptionalgroupId: string

        Optional group id in which we want to add the geometry

      Returns Feature

      The created circle feature

    • Creates a new marker icon.

      Parameters

      • coordinate: Coordinate

        The lon/lat position of the marker

      • Optionaloptions: {
            geometryLayout?: "XY" | "XYZ" | "XYM" | "XYZM";
            projection?: number;
            style?: TypeIconStyle;
        }

        Optional marker options including styling

      • OptionaloptionalFeatureId: string

        Optional id to be used to manage this geometry

      • OptionalgroupId: string

        Optional group id in which we want to add the geometry

      Returns Feature

      The created marker feature

    • Creates a new polygon.

      Parameters

      • points: number[] | Coordinate[][]

        The array of points to create the polygon

      • Optionaloptions: {
            geometryLayout?: "XY" | "XYZ" | "XYM" | "XYZM";
            projection?: number;
            style?: TypeFeatureStyle;
        }

        Optional polygon options including styling

      • OptionaloptionalFeatureId: string

        Optional id to be used to manage this geometry

      • OptionalgroupId: string

        Optional group id in which we want to add the geometry

      Returns Feature

      The created polygon feature

    • Creates a polyline using an array of lon/lat points.

      Parameters

      • points: Coordinate

        The points of lon/lat to draw a polyline

      • Optionaloptions: {
            geometryLayout?: "XY" | "XYZ" | "XYM" | "XYZM";
            projection?: number;
            style?: TypeFeatureStyle;
        }

        Optional polyline options including styling

      • Optionalid: string

        Optional id to be used to manage this geometry

      • OptionalgroupId: string

        Optional group id in which we want to add the geometry

      Returns Feature

      The created polyline feature

    • Adds a new geometry to the group whose identifier is equal to geometryGroupId.

      If geometryGroupId is not provided, uses the active geometry group. If the geometry group doesn't exist, creates it.

      Parameters

      • geometry: Feature

        The geometry to be added to the group

      • OptionalgeometryGroupId: string

        Optional id of the group to add the geometry to

      Returns void

    • Creates a new geometry group to manage multiple geometries at once.

      The z-index is infinity by default, set the index to change the behaviour.

      Parameters

      • geometryGroupId: string

        The id of the group to use when managing this group

      • Optionaloptions: {
            vectorLayerOptions?: Options<
                Feature<Geometry>,
                VectorSource<Feature<Geometry>>,
            >;
            vectorSourceOptions?: Options<Feature<Geometry>>;
        }

        Optional vector layer and vector source options

      Returns FeatureCollection

      The created or existing geometry group

    • Deletes all geometries from the geometry group but keeps the group.

      Parameters

      • geometryGroupid: string

        The group id

      Returns FeatureCollection

      The group with empty layers

      When the provided geometry group id does not exist

    • Deletes a specific feature from a group using the feature id.

      Parameters

      • featureId: string

        The feature id to be deleted

      • geometryGroupid: string

        The group id

      Returns void

      When the provided geometry group id does not exist

    • Deletes a geometry group and all the geometries from the map.

      The default geometry group can't be deleted.

      Parameters

      • geometryGroupid: string

        The id of the geometry group to delete

      Returns void

    • Gets the geometry group by using the ID specified when the group was created.

      Parameters

      • geometryGroupId: string

        The id of the geometry group to return

      Returns FeatureCollection

      The geometry group

      When the provided geometry group id does not exist

    • Finds the groups that contain the geometry using its id.

      Parameters

      • featureId: string

        The id of the geometry

      Returns FeatureCollection[]

      Groups that contain the geometry

    • Gets the z-index of a geometry group's vector layer.

      Parameters

      • geometryGroupId: string

        The id of the group

      Returns number

      The z-index value of the vector layer

      When the provided geometry group id does not exist

    • Sets the active geometry group (the geometry group used when adding geometries).

      If id is not specified, uses the default geometry group.

      Parameters

      • Optionalid: string

        Optional id of the group to set as active

      Returns void

    • Hides the identified geometry group from the map.

      Parameters

      • geometryGroupId: string

        The id of the group to hide from the map

      Returns void

      When the provided geometry group id does not exist

    • Shows the identified geometry group on the map.

      Parameters

      • geometryGroupId: string

        The id of the group to show on the map

      Returns void

      When the provided geometry group id does not exist

    • Sets the z-index of a geometry group's vector layer.

      Parameters

      • geometryGroupId: string

        The id of the group

      • zIndex: number

        The z-index value to set

      Returns void

      When the provided geometry group id does not exist

    • Creates a Geometry given a geometry type and coordinates expected in any logical format.

      Parameters

      • geometryType:
            | "Point"
            | "MultiPoint"
            | "LineString"
            | "MultiLineString"
            | "Polygon"
            | "MultiPolygon"
            | "GeometryCollection"

        The geometry type to create

      • coordinates: Coordinate | Coordinate[] | Coordinate[][] | Coordinate[][][]

        The coordinates to use to create the geometry

      Returns Geometry

      The OpenLayers Geometry

      When the geometry type is not supported