Request

Response

    Autodesk.Viewing.Extensions
    Version 8 preview
    This page documents a preview of the Viewer SDK v8. APIs and content can still change before the final release.

    GeolocationExtension

    Provides functions for converting GPS coordinates in WGS-84 format { x: Longitude, y: Latitude, z: Height(m) } into Viewer scene coordinates, and back. Supports a single model loaded into the scene.

    The extension id is: Autodesk.Geolocation

    new GeolocationExtension(viewer, options)

    Parameters

    viewer*The Viewer instance
    options
    object
    Not used
    * Required

    Examples

    viewer.loadExtension('Autodesk.Geolocation')
    

    Methods

    activate()

    When active, the extension will detect clicks on the model and will place a marker on the model. A panel will be displayed containing vertices clicked on the model. Each point-entry will also contain GPS its associated GPS position.

    deactivate()

    Stops detecting click events on the canvas and closes the Panel.

    isActive()

    Whether the extension is active. When the extension is active, click events will be processed and added into a Panel.

    Returns

    typedescription
    boolean True if the extension is active.

    hasGeolocationData()

    Returns

    typedescription
    boolean true when the model contains geolocation data.

    lmvToLonLat(lmvPoint)

    Converts viewer coordinates (obtained with something like viewer.clientToWorld()) into { x: Longitude, y: Latitude, z: Height (meters) } in WGS-84 format.

    Parameters

    lmvPoint*3D point in the scene
    * Required

    Returns

    typedescription
    Autodesk.Viewing.Math.Vector3 GPS coordinate in WGS-84 format: { x: Longitude, y: Latitude, z: Height }

    lonLatToLmv(lonLat)

    Converts coordinates from { x: Longitude, y: Latitude, z: Height (meters) } in WGS-84 format into viewer scene coordinates.

    Parameters

    lonLat*GPS coordinate in WGS-84 format: { x: Longitude, y: Latitude, z: Height }
    * Required

    Returns

    typedescription
    Autodesk.Viewing.Math.Vector3 3D point in the scene

    openGoogleMaps(pointLL84)

    Returns a Google Maps URL with a PIN on the specified GPS location. When no argument is provided, the URL will use the Model’s geolocation if available.

    Parameters

    pointLL84GPS location in WGS-84 format: { x: Longitude, y: Latitude }. Height is ignored.

    getCurrentPositionLmv()

    Returns a Promise that resolves with a position in Viewer-space coordinates based on the device’s real world GPS position.

    Returns

    typedescription
    Promise that resolves with a Autodesk.Viewing.Math.Vector3 containing Viewer-space coordinates. It rejects if device’s real world GPS position is not available.