• 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. Search Reasults are also available in the redux store under store-->geocoding-->results

    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

    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})