Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Geocoding

JMap.Geocoding

This is where you can find geocoding relative methods

Index

Functions

displayForwardSearchResult

  • JMap.Geocoding.displayForwardSearchResult

    Will display on the map the result of a JMap.Geocoding.forwardSearch single result.

    throws

    If geocoding is not enabled, or if an unexpected error occurs

    example
    
    // Display on the map the first match received
    JMap.Event.Geocoding.on.success(
      "custom-geocoding-success",
      params => {
       if (params.results.length > 0) {
         JMap.Geocoding.displayForwardSearchResult(params.results[0])
       }
     }
    )
    JMap.Geocoding.forwardSearch("1440 Saint-Catherine St W #522, Montreal, Quebec H3G 1R8", {autoComplete: false, fuzzyMatch: false, proximity: null})

    Parameters

    Returns void

forwardSearch

  • JMap.Geocoding.forwardSearch

    Proceeds with a forward geocoding search. Some characters are not permitted in search strings (see JMap.Geocoding.getInvalidSearchStringCharacters). Calling this method may not trigger immediately a forward geocoding search if the string is too short, or if the method is repetitively called too fast. You can set an event listener to have access to the forward search results (see [[TBD]]). Search Reasults are also available in the redux store under store-->geocoding-->results

    throws

    If geocoding is not enabled, if the search string is too short or invalid, or if an unexpected error occurs

    example
    
    // log a message in the console once the geocoding search has been completed
    JMap.Event.Geocoding.on.success(
      "custom-geocoding-success",
      params => console.log("A geocoding search has been completed", params.results)
    )
    // options.autoComplete is true by default (returns all match that would begin with the search string)
    // options.fuzzyMatch is true by default (setting this option to false will restrict results to exact match)
    // option.proximity: a JLocation object, or null. If not specified, it is by default set to the map's extent center. If you want to disable proximity bias, pass null for this option.
    JMap.Geocoding.forwardSearch("1440 Saint-Catherine St W #522, Montreal, Quebec H3G 1R8", {autoComplete: false, fuzzyMatch: false, proximity: null})

    Parameters

    • searchText: string

      The place name to search for. Can be an address, a region's name, or a geographical location expressed as "longitude,latitude" (ex: "-73.576321,45.495757" )

    • Optional options: JGeocodingOptions

      an optional JGeocodingOptions object

    Returns void

getInvalidSearchStringCharacters

  • getInvalidSearchStringCharacters(): string
  • JMap.Geocoding.getInvalidSearchStringCharacters

    Returns a string composed of all forbiden characters in geocoding search strings

    example
    
    // returns the invalid characters
    JMap.Geocoding.getInvalidSearchStringCharacters()
    // ";"

    Returns string

getMinimumSearchStringLength

  • getMinimumSearchStringLength(): number
  • JMap.Geocoding.getMinimumSearchStringLength

    Returns the search string length required to trigger a geocoding search

    example
    
    // returns the minimum search string length
    JMap.Geocoding.getMinimumSearchStringLength()
    // 3

    Returns number

isAvailable

  • isAvailable(): boolean
  • JMap.Geocoding.isAvailable

    Returns false if geocoding is not available. Geocoding may be unavailable based on your configuration in regards with the available API keys configured in your account

    example
    
    // returns false if geocoding is unavailable
    JMap.Geocoding.isAvailable()

    Returns boolean