Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Geolocation

JMap.Geolocation

This is where you can find geolocation relative methods

Index

Functions

getMyLocation

  • JMap.Geolocation.getMyLocation

    Returns the user current location if promise succeed.

    throws

    if browser doesn't support geolocation, if geolocation is disabled, if an unexpected error occurs while getting location from browser

    example
    
    // returns a promise that return the user current location if succeed
    JMap.Geolocation.getMyLocation()
       .then(location => console.info("My location is ", location))
       .error(error => console.error("Cannot get my location : ", error))

    Returns Promise<JLocation>

goToMyLocation

  • JMap.Geolocation.goToMyLocation

    Returns the user current location if promise succeed, and pan and zoom to this location.

    throws

    if browser doesn't support geolocation, if geolocation is disabled, if an unexpected error occurs while getting location from browser

    example
    
    // pan and zoom to the user location
    JMap.Geolocation.goToMyLocation()
       .then(location => console.info("Paned and zommed to user location ", location))
       .error(error => console.error("Cannot get my location : ", error))

    Parameters

    Returns Promise<JLocation>

isEnabled

  • isEnabled(): boolean
  • JMap.Geolocation.isEnabled

    Returns false if the JMap NG Core library has been started with option that disable the geolocation.

    See startup parameter [[JCoreOption.geolocationEnabled]].

    example
    
    // returns false if geolocation is disabled
    JMap.Geolocation.isEnabled()

    Returns boolean

isSupportedByBrowser

  • isSupportedByBrowser(): boolean
  • JMap.Geolocation.isSupportedByBrowser

    Returns true if the browser support the geolocation

    example
    
    // returns true if the browser supports the geolocation
    JMap.Geolocation.isSupportedByBrowser()

    Returns boolean