Query API and Web Services

  1. Home
  2. Query API and Web Services
  3. Vector query

Vector query

The Vector Query API allows users to request information related to a point location from one or more Koordinates vector datasets.

URL

Your URL endpoint is dependent on the particular Koordinates service you wish to access.

The URL for Koordinates.com site will be: https://koordinates.com/services/query/v1/vector

Formats

The sets API returns in:

  • JSON: content-type: application/vnd.koordinates.setQuery+json. Results are encoded as GeoJSON-compatible Feature objects.
  • Xml: content-type: application/vnd.koordinates.vectorQuery+xml. A schema is available. Geometries are encoded as GML v3 geometry objects.
  • Json-gmaps: content-type: application/vnd.koordinates.vectorQuery-gmaps+json. For use with the Google Maps API, geometries are returned as arrays of geometry objects, with linestrings & polygons encoded for faster display & smaller response-size.

Formats can be specified via URL. For example: https://koordinates.com/services/query/v1/vector.json

They can also be specified using the HTTP Accept header with the appropriate content-type against the base URL. For example: application/vnd.koordinates.vectorQuery.1+json

By default, all responses use the newest format. While we try very hard to prevent backwards-incompatible breaks, please note that it may happen in future

If you're using the URL endpoint (eg. vector.json) you can pass a &v=1 parameter to specify version 1.0. The current version is 1.1.

Compression

Add a request header with Accept-Encoding: gzip to get compressed results. This dramatically reduces the size of the response and will speed up your API requests.

HTTP Method

GET

Parameters

All parameters are available for 1.0, except where noted. 

  • key: Required. Your Koordinates API key.
  • layer: Required. The number of the vector layer to get results from. The layer numbers can be found in the URL for a layer (eg. http://koordinates.com/layer/743-nz-school-zones-april-2009/ is layer 743). Repeat this parameter to query more than one layer.
  • x: Required. Longitude of the point you want to query, in decimal degrees (WGS84/EPSG:4326).
  • y: Required. Latitude of the point you want to query, in decimal degrees (WGS84/EPSG:4326).
  • max_results: Optional (default 1). Returns a maximum of this many results. The valid range is 1-100. Results are sorted by distance from the query point, so closest results will always be returned first.
  • radius: Optional (default 1000). Distance in meters to query around the specified point. The valid range is 0-100000 (100km).
  • geometry: Optional (default 'false'). Whether to return the attributes only (false) or both the attributes and the geometry (true) for each feature result. Geometry coordinates are returned in WGS84 Lat/Long (EPSG:4326).
  • with_field_names: Optional (default 'false'). Whether to include an ordered list of field names. Availability: 1.1
  • callback: Optional. Only available for JSON formats. If supplied, will use the JSONP format with a callback of the given name. In addition, most error responses will be returned as 200-success codes, with a string error message.1.0 (JSON)