Skip to content

Commit 1802947

Browse files
committed
Add doc feature collection text and examples
1 parent 5374b13 commit 1802947

File tree

2 files changed

+98
-12
lines changed

2 files changed

+98
-12
lines changed

hugo/content/usage/collections.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,31 @@ The metadata includes:
4242
The path `/collections` returns a list of the feature collections
4343
available in the service as a JSON document.
4444

45+
#### Example
46+
```
47+
http://localhost:9000/collections
48+
```
49+
4550
Each listed feature collection provides a name, title, description and extent.
4651
A set of links provide the URLs for accessing:
4752

4853
* `self` - the feature collection metadata
4954
* `alt` - the feature collection metadata as an HTML view
5055
* `items` - the feature collection items
5156

57+
5258
## Describe Feature Collection metadata
5359

5460
The path `/collections/{coll-name}` returns a JSON object describing
5561
the metadata for a feature collection.
5662
The `{coll-name}` is the schema-qualified name of the database table or view
5763
backing the feature collection.
5864

65+
#### Example
66+
```
67+
http://localhost:9000/collections/ne.admin_0_countries
68+
```
69+
5970
The response is a JSON document ontaining metadata about the collection, including:
6071

6172
* The geometry column name

hugo/content/usage/query_data.md

Lines changed: 87 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,115 @@ draft: false
55
weight: 150
66
---
77

8+
Feature collections can be queried to provide sets of features,
9+
or to return a single feature.
10+
811
## Query features
912

10-
`/collections/{collid}/items`
13+
The path `/collections/{collid}/items` is the basic query to return
14+
a set of features from a feature collection.
15+
16+
The response is a GeoJSON feature collection containing the result.
17+
18+
#### Example
19+
```
20+
http://localhost:9000/collections/ne.admin_0_countries/items
21+
```
22+
23+
Additional query parameters can be appended to the basic query
24+
to provide control over what sets of features are returned.
1125

12-
- response is GeoJSON for result dataset
26+
These are analagous to using SQL statement clauses to control
27+
the results of a query.
28+
In fact the service
29+
implements these using exactly that technique.
30+
This provides maximum performance since it allows
31+
the Postgres SQL engine to optimize the query execution plan.
1332

1433
### Limiting and paging results
1534

16-
`limit=N`
35+
The query parameter `limit=N` can be added to the query to control
36+
the maximum number of features returned in a response document.
37+
There is also a server-defined maximum which cannot be exceeded.
38+
39+
The query parameter `offset=N` specifies the offset in the
40+
actual query result at which the response feature set starts.
41+
42+
Used together these two parameters allow paging through large result
43+
sets.
44+
45+
#### Example
46+
```
47+
http://localhost:9000/collections/ne.admin_0_countries/items?limit=50&offset=200
48+
```
1749

18-
`offset=N`
1950

2051
### Ordering results
2152

22-
`orderBy=PROP`
53+
The result set can be ordered by any property it contains.
54+
This allows performing "greatest N" or "smallest N" queries.
2355

24-
`orderBy=PROP:A`
56+
* `orderBy=PROP` orders results by `PROP` in ascending order
2557

26-
`orderBy=PROP:D`
58+
The sort order can be specified by appending `:A` (ascending)
59+
or `:D` (descending) to the ordering property name.
60+
The default is ascending order.
61+
62+
* `orderBy=PROP:A` orders results by `PROP` in ascending order
63+
* `orderBy=PROP:D` orders results by `PROP` in descending order
64+
65+
#### Example
66+
```
67+
http://localhost:9000/collections/ne.admin_0_countries/items?orderBy=name
68+
```
2769

2870
### Filter by bbox
2971

30-
`bbox=MINX,MINY,MAXX,MAXY`
72+
The query parameter `bbox=MINX,MINY,MAXX,MAXY`
73+
can be used
74+
to limit the features returned to those that intersect
75+
a specified bounding box.
76+
The bounding box is specified in geographic coordinates (longitude/latitude).
3177

32-
- extent is in lon/lat (4326)
78+
#### Example
79+
```
80+
http://localhost:9000/collections/ne.admin_0_countries/items?bbox=10.4,43.3,26.4,47.7
81+
```
3382

3483
### Specify result properties
3584

36-
`properties=PROP1,PROP2,PROP3...`
85+
The query parameter `properties=PROP1,PROP2,PROP3...`
86+
can be used to restrict the properties which are returned
87+
in the response.
88+
This allows reducing the response size of feature collections
89+
which have a large number of properties.
90+
91+
#### Example
92+
```
93+
http://localhost:9000/collections/ne.admin_0_countries/items?properties=name,abbrev,pop_est
94+
```
3795

3896
## Query a single feature
3997

40-
`/collections/{collid}/items/{fid}`
98+
The path `/collections/{collid}/items/{fid}`
99+
allows querying a single feature in a feature collection
100+
by specifying its ID.
101+
102+
The response is a GeoJSON feature containing the result.
103+
104+
#### Example
105+
```
106+
http://localhost:9000/collections/ne.admin_0_countries/items/23
107+
```
108+
41109

42110
### Specify properties in result
43111

44-
`properties=PROP1,PROP2,PROP3...`
112+
The query parameter `properties=PROP1,PROP2,PROP3...`
113+
can be used to restrict the properties which are returned
114+
in the response.
115+
116+
#### Example
117+
```
118+
http://localhost:9000/collections/ne.admin_0_countries/items/23?properties=name,abbrev,pop_est
119+
```

0 commit comments

Comments
 (0)