Datasets | Documentation | Query-Builder

Overview

This API allows you to perform spatial and property-based queries on spatial data and returns GeoJSON.

All API requests are performed by sending your query as JSON to https://where2demo.herokuapp.com/q. Requests can be performed using either GET or POST. Using POST allows you to send the JSON as request body, while POST requires you to URI encode the JSON and append it to https://where2demo.herokuapp.com/q/.

JSON structure

{
	"dataset": …,
	"query": …,
	"spatial": …,
	"properties": …,
	"distance": …,
	"sort": …,
	"limit": …,
	"offset": …,
}

dataset : String (required)

Name of the dataset you want to perform the query on. If you do not pass any other arguments a JSON-file representing the full dataset will be returned.

example:
dataset: "addresses"

query : Object

Property-based query: Object containing property (prop, String), operator (op, String), value (val, String / Number) and optionally case-sensitivity (c, Boolean, default is false).

available operators:
OperatorDescription
=Equal
!=Not equal
<Less than
>More than
<=Less than or equal
>=More than or equal
$contains
!$Does not contain
$=starts with
!$=Does not start with
=$ends with
!=$Does not end with

Use Arrays to query multiple relations using and or or.

example:
query: {
	"and": [{
		"prop": "age",
		"op": "<=",
		"val": "25"
	}, {
	"or": [{
			"prop": "name",
			"op": "=",
			"val": "Jane Doe"
		}, {
			"prop": "name",
			"op": "=",
			"val": "John Doe"
		}]
	}]
}


spatial : Object

Spatial query: Object containing spatial relation (relation, String), geometry (geometry, String (WKT) or Object (GeoJSON-Feature), supported feature types: Point, LineString, Polygon) and distance (distance, Number, only for relation "DistWithin").

available relations:
RelationDescription
EqualsTRUE if queried geometry (g1) and supplied geometry (g2) are equal
DisjointTRUE if the intersection of g1 and g2 is the empty set
TouchesTRUE if the only Points in common between g1 and g2 lie in the union of the boundaries of g1 and g2
WithinTRUE if g1 is completely contained in g2
OverlapsTRUE if the intersection of g1 and g2 results in a value of the same dimension as g1 and g2 that is different from both g1 and g2
CrossesTRUE if the intersection of g1 and g2 results in a value whose dimension is less than the maximum dimension of g1 and g2 and the intersection value includes Points interior to both g1 and g2, and the intersection value is not equal to either g1 or g2
IntersectsTRUE if the intersection of g1 and g2 is not empty
ContainsTRUE if g2 is completely contained in g1
DistWithinTRUE if g2 is within supplied distance of g1

example:
spatial: {
	"relation": "within",
	"geometry": {
	"type": "Polygon",
		"coordinates": [
			[
				[8.522214889526367, 47.39189986655709],
				[8.522214889526367, 47.41112933122305],
				[8.545131683349610, 47.41112933122305],
				[8.522214889526367, 47.39189986655709]
			]
		]
	}
}


properties : Array

Specify which properties will be returned. This may be used to reduce the size of the response. If not specified all properties will be returned.

example:
properties: ["city", "district", "street"]


distance : String (WKT) or Object (GeoJSON Feature)

Calculates distance to specified geometry and returns it as property where_distance. This allows you to sort the result according to distance. For performance reasons it is recommended to only use this on small datasets or subsets.

example:
distance: "POINT (13.467375 52.483492)"


sort : Object

Sorts results by specified property (by, String, property name) in ascending or descending order (desc, Boolean, default is false).

example:
sort: {
	by: "city",
	desc: true
}


limit : Number

Sets maximum number of returned features

example:
limit: 50


offset : Number

Sets offset for returned features

example:
offset: 50

dataset:













Request URL:


Map URL:


Request Body:

Response: