• JMap.Map.fitFeatures

    Move and zoom (or unzoom) to display the given features.

    Parameters

    • features: Feature<Geometry, GeoJsonProperties>[]

      The features where the map will be centered

    • Optional options: JPanAndZoomOptions

      parameter to customize the animation, padding, and/or maxZoomLevel

    Returns void

    Throws

    Error if bad parameters are passed

    Example

    // first select some features on layer id=3
    const features = JMap.Map.Selection.getSelectedFeaturesForLayer(3) // returns layer id=3 selected features
    // Move and zoom to display the features
    JMap.Map.fitFeatures(features)

    // The same with optional parameters
    JMap.Map.fitFeatures(features, {
    animate: false, // default true
    paddingTop: 120, // default 50
    paddingLeft: 100, // default 50
    paddingRight: 100, // default 50
    paddingBottom: 120, // default 50
    maxZoom: 10 // default the current zoom
    })