Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Feature

JMap.Feature

This is where you can find feature related methods

Index

Functions

deleteById

  • deleteById(layerId: JId, featureId: JId): Promise<Feature>
  • JMap.Feature.deleteById

    Deletes the feature for the given layer and feature ids.

    throws

    if layer or feature not found

    example
    
    // deletes the feature id="4" on layer id="3"
    JMap.Feature
     .deleteById(3, 4)
     .then(deletedFeature => console.info("Feature has been deleted", deletedFeature))
     .catch(error => console.error("An error occured", error))

    Parameters

    • layerId: JId

      the JMap layer id

    • featureId: JId

      the JMap feature id

    Returns Promise<Feature>

deleteByIds

  • JMap.Feature.deleteByIds

    Deletes the features for the given layer and features ids.

    throws

    if layer or feature not found

    example
    
    // deletes 3 features on layer id="3"
    JMap.Feature
     .deleteByIds(3, [4, 5, 16])
     .then(() => console.info("Features have been deleted"))
     .catch(error => console.error("An error occured", error))

    Parameters

    • layerId: JId

      the JMap layer id

    • featureIds: JId[]

      the JMap feature ids to delete

    Returns Promise<JFeatureDeleteByIdsResult>

geometryUpdateById

  • JMap.Feature.geometryUpdateById

    Change the feature geometry for the given layer id, feature id and geometry (projection EPSG:4326).

    throws

    if layer or feature not found, or if feature is invalid (undefined, wrong geometry type, etc ...)

    example
    
    const newGeometry = { ... }
    // change the geometry of feature id="4" on layer id="3"
    JMap.Feature
     .geometryUpdateById({
       layerId: 3,
       featureId: 4,
       geometry: newGeometry
     })
     .then(feature => console.info("Feature geometry has been changed", feature))
     .catch(error => console.error("An error occured", error))

    Parameters

    Returns Promise<Feature>

getById

  • getById(layerId: JId, featureId: JId): Promise<Feature>
  • JMap.Feature.getById

    Returns the feature (EPSG:4326 projection) for the given layer and feature id.

    throws

    if layer or feature not found

    example
    
    // returns the feature of layer id="3" and feature id="4"
    JMap.Feature
     .getById(3, 4)
     .then(feature => console.info("Feature has been fetched", feature))
     .catch(error => console.error("An error occured", error))

    Parameters

    • layerId: JId

      the JMap layer id

    • featureId: JId

      the JMap feature id

    Returns Promise<Feature>

getByIds

  • getByIds(layerId: JId, featureIds: JId[]): Promise<Feature[]>
  • JMap.Feature.getByIds

    Returns the features (EPSG:4326 projection) for the given layer and feature ids.

    throws

    if layer or any of the features not found

    example
    
    // returns the features of layer id="3" and feature id="4", "5" and "6"
    JMap.Feature
     .getByIds(3, [4, 5, 6])
     .then(features => console.info("Features has been fetched", features))
     .catch(error => console.error("An error occured", error))

    Parameters

    • layerId: JId

      the JMap layer id

    • featureIds: JId[]

      the array of JMap feature ids

    Returns Promise<Feature[]>