Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using the sort Parameter

The sort parameter specifies the field by which to sort the retrieved surveys requested by the Coverage API.

In this example we retrieve surveys for a given polygon, sorting the response fields according to the lastPhotoTime field in an ascending order, and limiting the response to three surveys:

Code Block
languagejs
themeEclipse
Request:
https://api.nearmap.com/coverage/v2/poly/138.59707796614592,-34.91729448760797
,138.61703360121672,-34.91729448760797,138.61703360121672,-34.927709974005474,
138.59707796614592,-34.927709974005474,138.59707796614592,-34.91729448760797
?apikey=Yzc2MjEzMWUtY2Q4YS00NTM2LTgyMDgtMDljZjI2YTdhMTMz&sort=lastPhotoTime&limit=3

Response:
{
	"surveys": [
		{
			"captureDate": "2009-10-19",
			"firstPhotoTime": "2009-10-18T18:21:46Z",
			"id": "100-c54f488e-b95d-11e7-bd8e-5f787b2dc397",
			"lastPhotoTime": "2009-10-19T22:39:49Z",
			"location": {
				"country": "AU",
				"region": "Adelaide",
				"state": "SA"
			},
			"onlineTime": "2018-02-09T03:32:38Z",
			"pixelSize": 0.08,
			"resources": {
				"tiles": [
					{
						"id": "c55168f8-b95d-11e7-bd91-43d8499f1906",
						"scale": 21,
						"type": "Vert"
					}
				]
			},
			"timezone": "ACDT",
			"utcOffset": 37800
		},
		{
			"captureDate": "2009-10-29",
			"firstPhotoTime": "2009-10-28T15:52:19Z",
			"id": "100-0647ec10-b95e-11e7-ac79-4fe499e7d4d3",
			"lastPhotoTime": "2009-10-30T22:09:13Z",
			"location": {
				"country": "AU",
				"region": "Adelaide",
				"state": "SA"
			},
			"onlineTime": "2018-02-09T03:07:21Z",
			"pixelSize": 0.08,
			"resources": {
				"tiles": [
					{
						"id": "064a0180-b95e-11e7-ac7c-2fae4102c9b7",
						"scale": 21,
						"type": "Vert"
					}
				]
			},
			"timezone": "ACDT",
			"utcOffset": 37800
		},
		{
			"captureDate": "2009-12-01",
			"firstPhotoTime": "2009-11-30T16:03:36Z",
			"id": "100-c735b188-b95d-11e7-bdec-8fc52cb7008c",
			"lastPhotoTime": "2009-12-01T23:19:42Z",
			"location": {
				"country": "AU",
				"region": "Adelaide",
				"state": "SA"
			},
			"onlineTime": "2018-02-09T02:47:48Z",
			"pixelSize": 0.08,
			"resources": {
				"tiles": [
					{
						"id": "c737c9a0-b95d-11e7-bdef-1f90b15ebb7e",
						"scale": 21,
						"type": "Vert"
					}
				]
			},
			"timezone": "ACDT",
			"utcOffset": 37800
		}
	],
	"limit": 3,
	"offset": 0,
	"total": 66
}


Troubleshooting

Not Authorized to Access Area

If you receive the following error:

Info
iconfalse
{"error":"You are not authorized to access this area"}

Check whether the coordinates that you used are LONG,LAT points, and not LAT,LONG points. The order is crucial, otherwise you will be requesting surveys for an area that is outside your coverage area, and this error will be returned. 

For example:

  • The latitude and longitude for the Statue of Liberty is 40.688640, -74.043970. In the request we will change the order of the coordinates:

    Code Block
    themeConfluence
    https://api.nearmap.com/coverage/v2/point/138-74.59707796614592043970,-3440.91729448760797688640?apikey={YOUR_API_KEY}


  • The latitude and longitude for the Sydney Opera House is -33.858060, 151.214850. In the request we will change the order of the coordinates:

    Code Block
    themeConfluence
    https://api.nearmap.com/coverage/v2/point/151.214850,-33.858060?apikey={YOUR_API_KEY}


This error is also returned when you request coverage for an area you are not authorized to access, for example when your API key can be used only for Australian imagery, and you request coverage for an area in the United States.

It is also possible that you requested coverage for an area that Nearmap doesn't cover.

Invalid Polygon

If you receive the following error:

Info
iconfalse
{"error": "geometry was not a valid sequence of x,y coordinates","code": "INVALID_POLYGON"}

Check whether you have an extra comma or space in your URL request. 

This error is also returned when the polygon is given in the wrong format.

API Key Not Found

If you receive the following error:

Info
iconfalse
{"error": "API key not found"}

Check whether you have are missing any part of the API key, or if you have an extra space in the API key.

This error is also returned when the API key is invalid. Check if the API Key that you are using is "Stale". You can confirm this and renew the API by following the instructions listed here.