Skip to content

Latest commit

 

History

History
387 lines (268 loc) · 8.54 KB

services.md

File metadata and controls

387 lines (268 loc) · 8.54 KB

Table of Contents

Static

Static Images API service.

Learn more about this service and its responses in Goong Static Map API documentation.

getStaticImage

Get a static map image.

Parameters

  • config Object
    • config.origin number Origin coordinate latitude,longitude
    • config.destination string Destination coordinate latitude,longitude
    • config.width number Width of the image in pixels, default 600px. (optional, default 600)
    • config.height number Height of the image in pixels, default 400px. (optional, default 400)
    • config.vehicle ("car" | "bike" | "taxi") Vehicle type (optional, default 'car')
    • config.type ("fastest" | "shortest") Routing type (optional, default 'fastest')
    • config.color string Color of route line, default #253494 (optional, default '#253494')

Examples

staticClient.getStaticImage({
  origin: '20.981971,105.864323',
  destination: '20.994531,105.849663',
  width: 600,
  height: 400,
  vehicle: 'car',
  type: 'fastest',
  color: '#253494'

})
  .send()
  .then(response => {
    const image = response.body;
  });

Returns GAPIRequest

Geocoding

Geocoding API service.

Learn more about this service and its responses in Goong Geocoding API documentation.

reverseGeocode

Reverse Geocoding

Parameters

  • config Object
    • config.latlng string Coordinates at which features will be reversed.

Examples

geocodingClient.reverseGeocode({
  latlng: '21.0137443130001,105.798346108'
})
  .send()
  .then(response => {
    // JSON document with geocoding matches
    const match = response.body;
  });

Returns GAPIRequest

forwardGeocode

Forward Geocoding

Parameters

  • config Object
    • config.address string Address string you are looking for

Examples

geocodingClient.forwardGeocode({
  address: '91 Trung Kinh, Trung Hoa, Cau Giay, Ha Noi'
})
  .send()
  .then(response => {
    // JSON document with geocoding matches
    const match = response.body;
  });

Returns GAPIRequest

placeDetail

Get Place detail

Parameters

Examples

geocodingClient.placeDetail({
  place_id: 'uq58Yr/RA0wuHVtqzDczw7bbR4Gs7gs2b5DRZtogUr2bvWTaN5Vb2qd/atCZ1FoPg7cdIqFo9E_2TxQzrc20hw==.ZXhwYW5kMA=='
})
  .send()
  .then(response => {
    // JSON document with geocoding matches
    const match = response.body;
  });

Returns GAPIRequest

Autocomplete

Autocomplete API service.

Learn more about this service and its responses in Goong Places API documentation.

search

Autocomplete search

See the public documentation.

Parameters

  • config Object
    • config.input string A place name.
    • config.location string A location to use as a hint when looking up the specified address - latitude,longitude
    • config.radius number Distance round from your location by kilometers
    • config.limit number Limit the number of results returned. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. (optional, default 10)

Examples

autocompleteClient.search({
  input: 'san bay noi bai',
  limit: 5
})
  .send()
  .then(response => {
    const match = response.body;
  });
// autocomplete with location
autocompleteClient.search({
  input: 'san bay noi bai',
  location: '21.028531,105.854189',
  radius: 100
})
  .send()
  .then(response => {
    const match = response.body;
  });

Returns GAPIRequest

placeDetail

Autocomplete get place detail

See the public documentation.

Parameters

Examples

autocompleteClient.placeDetail({
  placeid: '0WmA4vbeody2J9AEvVM9YE3ZN85z7Mrw',
})
  .send()
  .then(response => {
    const match = response.body;
  });

Returns GAPIRequest

Directions

Directions API service.

Learn more about this service and its responses in Goong Directions API documentation.

getDirections

Get directions.

Parameters

  • config Object
    • config.origin number Origin coordinate latitude,longitude
    • config.destination string The destination coordinate string. Split by ; for more than 2 destinations.
    • config.alternatives boolean Whether to try to return alternative routes. (optional, default true)
    • config.vehicle ("car" | "bike" | "taxi" | "hd") Vehicle type (optional, default 'car')

Examples

directionsClient.getDirections({
  origin: '20.981971,105.864323',
  destination: '21.031011,105.783206',
  alternatives: true,
  vehicle: 'car'
})
  .send()
  .then(response => {
    const directions = response.body;
  });

Returns GAPIRequest

DistanceMatrix

Map Matching API service.

Learn more about this service and its responses in Goong Distance Matrix API documentation.

getMatrix

Get a duration and/or distance matrix showing travel times and distances between coordinates.

Parameters

  • config Object
    • config.origins number Origin coordinate: latitude,longitude|latitude,longitude
    • config.destinations string List of destination coordinate: latitude,longitude|latitude,longitude|latitude,longitude
    • config.vehicle ("car" | "bike" | "taxi" | "hd") Vehicle type (optional, default 'car')

Examples

matrixClient.getMatrix({
  origins: '20.981971,105.864323',
  destinations: '21.031011,105.783206|21.022328,105.790480|21.016665,105.788774',
  vehicle: 'car'
})
  .send()
  .then(response => {
      const matrix = response.body;
  });

Returns GAPIRequest