Maps API for JavaScript Developer's Guide

H.service.GeocodingService

Class Summary

This class encapsulates the Geocoding REST API in a service stub, providing methods to access its resources.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

static CONFIG_KEY : {string}

The property name to use when specifying options for this service within the H.service.Platform.Options#servicesConfig.

Method Summary

Table 2. Methods
Methods

geocode (geocodingParams, onResult, onError) : {H.service.JsonpRequestHandle}

This method sends a geocoding request to the Geocoder REST API and calls the onResult callback function once the service response becomes available (providing a H.service.ServiceResult object) or the onError callback if a communication error occurs.

reverseGeocode (reverseGeocodingParams, onResult, onError) : {H.service.JsonpRequestHandle}

This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response becomes available (providing a H.service.ServiceResult object) or the onError callback if a communication error occurs.

search (searchParams, onResult, onError) : {H.service.JsonpRequestHandle}

This method sends a landmark search request to the Geocoder REST API and calls the onResult callback function once the service response becomes available (providing a H.service.ServiceResult object) or the onError callback if a communication error occurs.

Class Description

This class encapsulates the Geocoding REST API in a service stub, providing methods to access its resources.

It's not allowed to call the constructor directly (an IllegalOperationError is thrown). Instead an instance of this Service can be retrieved by calling the factory method H.service.Platform#getGeocodingService on a platform instance.

Example

// Assumption: the platform is instantiated
geocoder = platform.getGeocodingService();

var geocodingParams = {
    searchText: '425 W Randolph Street, Chicago'
  },
  onResult = function(result) {
    console.log(result.Response.View[0].Result[0].Location.DisplayPosition);
  },
  onError = function(error) {
     console.log(error);
  };
geocoder.geocode(geocodingParams, onResult, onError);

Constructor Details

H.service.GeocodingService(opt_options)

Parameters:
 
opt_options:
{H.service.GeocodingService.Options=} [optional]
 
Configuration options for geocoding service

Property Details

static CONFIG_KEY: {string}

The property name to use when specifying options for this service within the H.service.Platform.Options#servicesConfig.

Method Details

geocode (geocodingParams, onResult, onError) : {H.service.JsonpRequestHandle}

This method sends a geocoding request to the Geocoder REST API and calls the onResult callback function once the service response becomes available (providing a H.service.ServiceResult object) or the onError callback if a communication error occurs.

Please refer to the Geocoder REST API documentation for information on available parameters and the response object structure.

Parameters:
 
geocodingParams:
{H.service.ServiceParameters}
 
Contains service parameters to be sent with the geocoding request.
onResult:
{function(H.service.ServiceResult)}
 
A callback function to be called once the Geocoder REST API provides a response to the request.
onError:
{function(Error)}
 
A callback function to be called if a communication error occurs during the request
Returns:
 
{H.service.JsonpRequestHandle}
A request handle

reverseGeocode (reverseGeocodingParams, onResult, onError) : {H.service.JsonpRequestHandle}

This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response becomes available (providing a H.service.ServiceResult object) or the onError callback if a communication error occurs.

Please refer to the Geocoder REST API documentation for information on available parameters and the response object structure.

Parameters:
 
reverseGeocodingParams:
{H.service.ServiceParameters}
 
Contains the service parameters to be sent with the reverse geocoding request
onResult:
{function(H.service.ServiceResult)}
 
A callback function to be called once the Geocoder REST API provides a response to the request
onError:
{function(Error)}
 
A callback function to be called if a communication error occurs during the request
Returns:
 
{H.service.JsonpRequestHandle}
A request handle

This method sends a landmark search request to the Geocoder REST API and calls the onResult callback function once the service response becomes available (providing a H.service.ServiceResult object) or the onError callback if a communication error occurs.

Please refer to the Geocoder REST API documentation for information on available parameters and the response object structure.

Parameters:
 
searchParams:
{H.service.ServiceParameters}
 
Contains the service parameters to be sent with the landmark search request
onResult:
{function(H.service.ServiceResult)}
 
A callback function to be called once the Geocoder REST API provides a response to the request
onError:
{function(Error)}
 
A callback function to be called if a communication error occurs during the request
Returns:
 
{H.service.JsonpRequestHandle}
A request handle