[ Whereis® API Home ] [ JSON API Home ] [ Services ] [ Map Services ]

If you want to know the exact geographical area that will be covered by a map before you request it, use one of the viewport services. Maps are not available at all resolutions. A viewport by geometry response precisely describes the extent of a map returned by an equivalent Map request.

URL

HTTP Post to <ENDPOINT>service/viewport/by_geometry

Request format

{
	"height":<int>,
	"width":<int>,
	"mapData":[<mapData>]
}

Rules

Parameter

Mandatory?

Description

height  

Y

Image height in pixels. Min = 1, max = 1600

width

Y

Image width in pixels. Min = 1, max = 1600

<mapData>

Y

Describes any data to be overlaid on the map, which may include routes, markers, shapes, etc. The system calculates the bounds that will contain all points in the requested <mapData> and returns a viewport "snapped" to the optimal zoom.

Sample request

{
	"height":400,
	"width":600,
	"mapData":[{"values":[{"points":[{"lon":144.9602,"lat":-36.81063},{"lon":145.1602,"lat":-36.81063},{"lon":144.9602,"lat":-36.91063},{"lon":144.9602,"lat":-36.81063}]}],
  	"type":"polyline"}]
}

Sample response

{
  "bounds": {
    "left": 144.957203,
    "top": -36.805688,
    "right": 145.163197,
    "bottom": -36.915565
  },
  "centre": {
    "lon": 145.0602,
    "lat": -36.860627
  },
  "resolution": 38.21851413726806612203290569595992565155029296875,
  "x_distance": 18327.387885,
  "y_distance": 12209.485213,
  "zoom": 10
}
NOTES
 A viewport request does not return a map.
Icon

This request uses the following objects: