• JMap.Feature.geometryCreate

    Creates a new Geometry

    Parameters

    • params: JFeatureGeometryCreateParams

      An object containing the parameters for geometry creation. params.layerId: The JMap layer id (string). params.geometry: The GeoJSON geometry object. params.properties: The values of the feature's attributes. params.crs: An object representing the coordinate reference system of the geometry.

    Returns Promise<GeoJSON.Feature>

    A promise that resolves with the created GeoJSON feature.

    Throws

    Will throw an error if the layerId is not found.

    Example

    // Create a feature
    JMap.Feature
    .geometryCreate({
    layerId: "123e4567-e89b-12d3-a456-426614174000",
    crs: {
    type: "EPSG",
    properties: {
    code: 4326
    }
    },
    geometry: {
    type: "Point",
    coordinates: [-73.56, 45.51]
    },
    properties: {
    property1: "value1",
    property2: "value2"
    }
    })
    .then(() => console.info("Feature has been created"))
    .catch(error => console.error("An error occurred", error));