LuciadRIA (2026.0.10)
    Preparing search index...

    MapNavigator provides utility functions to navigate the map.

    A MapNavigator instance can be obtained through the map.mapNavigator property.

    All operations are supported in both 2D and 3D. All operations also work on non-georeferenced views (e.g. vertical views or timelines).

    All operations can be immediate or animated. The following operations are supported:

    • pan
    • Translate the map so that a given point ends up at a certain location in the view.
    • zoom
    • Change the scale of the map. You can either zoom with a factor or zoom up to a target scale.
    • rotate
    • Rotate the map. You can either rotate towards a target angle or add a delta angle to the current rotation of the camera.
    • fit
    • Fit the map on a target bounds.

    Most parameters take a point in either view (point.reference === null), model (point.reference !== null) or map coordinates (point.reference === map.reference). See the JSdoc to check in which reference a point argument can be.

    Note that the Map can have navigation restrictions by using constraints. Constraints can be set on the MapNavigator via mapNavigator.constraints. A detailed description of the available constraints and their behavior can be found in the documentation of MapNavigatorConstraints

    When these constraints are set, it is not possible to violate these constraints by using the MapNavigator. However, if you use the map's underlying camera directly, the constraints are not applied.

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get defaults(): MapNavigatorDefaults

      An object describing the default values used in this MapNavigator.

      Manipulate this object to change the default animation durations (or easing functions) for the different MapNavigator operations.

      You can assign individual properties, like so:
        mapNavigator.defaults.pan.duration = 5000; //change the default pan duration to 5000ms
      

      Returns MapNavigatorDefaults

    • set defaults(defaults: MapNavigatorDefaults): void

      Parameters

      Returns void

    Methods

    • Performs a fit operation.

      Use this operation to ensure that the map covers a certain area.

      Note: For backwards compatibility, when a Bounds is passed instead of an options literal, the deprecated version of fit will be used.

      After the fit operation, the view extents will fit the extents of fitOptions.target. The map's rotation might be affected by the fit operation. It is not guaranteed that rotation will be preserved.

      Parameters

      Returns Promise<void>

      A promise that will be resolved after the fit operation has finished. You have to wait for the promise to resolve, even for non-animated fits.

      For animated fits, the returned Promise will be resolved when the fit animation has completely finished. If the fit animation is interrupted (for example, by another animation), the promise is rejected.

    • Positions the viewer at a given eye point. This method can be used to look around freely from a fixed position.

      This method will only perform an operation if the Map's reference (RIAMap.reference) is a geocentric 3D reference (e.g. EPSG:4978). If the map is not a 3D map, this method will throw an error.

      Parameters

      • eyePoint: Point

        the point at which to put the eye point. The point can have any spatial reference.

      • yaw: number

        the desired yaw angle from the eye point to the reference point (in degrees). This is similar to turning your head left to right. 0 means looking north, and the degrees count clockwise.

      • pitch: number

        the desired pitch angle from the eye point to the reference point (in degrees). This value must be between -89 and 89 degrees. This is similar to nodding your head up and down. -89 means looking straight down, 0 is looking straight ahead to the horizon, and 89 is degrees is looking straight up.

      • roll: number

        the desired roll angle of the viewer around its line-of-sight axis (in degrees). This is similar to turning your entire head upside down (if you could). The rotation is clockwise.

      • Optionaloptions: MapNavigatorLookFromOptions

        the options for the lookFrom operation

      Returns Promise<void>

      A promise that will be resolved after the lookFrom operation has finished. You have to wait for the promise to resolve, even for non-animated lookFrom operations.

      For animated lookFrom operations, the returned Promise will be resolved when the lookFrom animation has completely finished. If the lookFrom animation is interrupted (for example, by another animation), the promise is rejected.

    • Performs a pan operation.

      Use this operation to:

      • center the map on a certain model or world location
      • shift the map in a certain direction by a certain amount in pixels or world units

      After the pan operation, targetLocation will be at toViewLocation.

      Parameters

      Returns Promise<void>

      A promise that will be resolved after the pan operation has finished. You have to wait for the promise to resolve, even for non-animated pan operations.

      For animated panning, the returned Promise will be resolved when the pan animation has completely finished. If the pan animation is interrupted (for example, by another animation), the promise is rejected.

    • Performs a rotate operation. Use this operation to:

      • rotate to a specific orientation angle (in some projections, this is a heading or azimuth)
      • rotate by a delta angle relative to the current rotation
      • adapt camera pitch in 3D

      If you rotate to a target angle, you cannot rotate with a delta and vice-versa.

      2D only options will be ignored in 3D (and vice-versa).

      Note that map rotation will be disabled (fixed to 0) in the following cases:

      • A navigation bounds constraint is set on the map (cfr. constraints)
      • Axes are configured on the map

      Parameters

      Returns Promise<void>

      A promise that will be resolved after the rotate operation has finished. You have to wait for the promise to resolve, even for non-animated rotate operations.

      For animated rotations, the returned Promise will be resolved when the rotate animation has completely finished. If the rotate animation is interrupted (for example, by another animation), the promise is rejected.

    • Performs a zoom operation.

      Use this operation to:

      • zoom in or zoom out by a certain factor
      • set the scale of the map to a specific scale

      You must specify either a factor or a target scale, but you can not use both in the same zoom operation.

      Can be used for both uniform zooming (same x- and y-scale, commonly used on georeferenced maps) and non-uniform zooming (different x- and y-scale, commonly used for non-georeferenced maps).

      Parameters

      Returns Promise<void>

      A promise that will be resolved after the zoom operation has finished. You have to wait for the promise to resolve, even for non-animated zoom operations.

      For animated zooming, the returned Promise will be resolved when the pan animation has completely finished. If the zoom animation is interrupted (for example, by another animation), the promise is rejected.