MapQuest-GL.js

mqgl.Service.geocode

The geocode object for retrieving forward, batch, and reverse geocoding.

Methods

mqgl.Service.geocode.address(options)

Geocode an address. Refer to the Geocoding Address API page for more information.

Syntax

var services = new mqgl.Service('KEY');

services.geocode.address({location: 'Denver, CO'})
  .then(response => console.log(response));

Parameters

Return Value

A Promise, containing the geocoding response object.

Example

Loading...

mqgl.Service.geocode.batch(options)

Geocode a batch of locations. Refer to the Batch Geocoding API page for more information.

Syntax

var services = new mqgl.Service('KEY');

services.geocode.batch({locations: ['Denver, CO', 'Boulder, CO']})
  .then(response => console.log(response));

Parameters

Return Value

A Promise, containing the batch geocoding response object.

Example

Loading...

mqgl.Service.geocode.reverse(geocodes)

Converts a pair of geocodes into an address. Refer to the Revese Geocoding API page for more information.

Syntax

var services = new mqgl.Service('KEY');

services.geocode.reverse([-105.122870, 39.666076])
  .then(response => console.log(response));

Parameters

  • geocodes required array [lng, lat]

    A single geocode to be reverse geocoded.

    Example: Single Geocode

    [-105.122870, 39.666076]

Return Value

A Promise, containing the reverse geocoding response object.

Example

Loading...