mirrored from https://gitlab.com/mrlotfi/gquery
An in-memory database for geographic/geometric queries with experimental support for persistence. Currently the only way to interact with gquery is via it’s HTTP REST apis.
To run the latest version in a docker container:
```shell script
docker pull mrlotfi/gquery
docker run -p 6985:6985 mrlotfi/gquery
#### Manual build
Get a working rust environment ([rustup is recommended](https://rustup.rs/)). It should be compilable on most
supported platforms as it has no platform specific dependency. To build an optimized version run
```cargo build --release```. Binary will be accessible on ```./target/release/gquery```.
#### Binary releases
To be announced.
## Running
Just run `gquery`. No additional parameter is required for running with default configuration. But you can take a look at `gquery --help`.
## Storage API
Items are stored in different namespaced collections. Each item has a unique id which is provided by you or automatically selected and returned by server.
#### Adding a new item
Path:
POST /{collection_name}
Request body example:
```json
{
"id": "abc",
"geojson": {
"coordinates": [
[
[-1.0, 1.0],
[0.0, -1.0],
[1.0, 1.0]
]
],
"properties": {
"name": "hassan"
},
"type": "MultiLineString"
}
}
Response:
Id of the added item is returned as plain text. It is either provided by you or automatically generated by the server.
Path:
DELETE /{collection_name}/{id}/
such as http://localhost:6985/abc/efg/
Path:
DELETE /{collection_name}/
such as http://localhost:6985/abc
Path:
GET /{collection_name}/{id}/
such as http://localhost:6985/abc/efg/
Reponse body example:
{
"id": "123123",
"geojson": {
"coordinates": [
[
[-1.0, 1.0],
[0.0, -1.0],
[1.0, 1.0]
]
],
"properties": {
"name": "hassan"
},
"type": "MultiLineString"
}
}
Path:
GET /
Response body example:
[
"abc",
"my_awesome_collection"
]
Path:
PUT /save
Returns 200 in case of succession.
Path:
GET /{collection_name}/nearby?long=-0.1&lat=0.122
Query Params:
404
if collection doesn’t exist or empty.Response body example:
{
"id": "abc",
"geojson": {
"coordinates": [
[
[-1.0, 1.0],
[0.0, -1.0],
[1.0, 1.0]
]
],
"properties": {
"name": "hassan"
},
"type": "MultiLineString"
}
}
Path:
GET /{collection_name}/intersect?long=-0.1&lat=0.122
Query Params:
404
if collection doesn’t exist or empty or no object containing this point is found.Response body example:
{
"id": "hiva",
"geojson": {
"coordinates": [
[
[-1.0, -1.0],
[-1.0, 1.0],
[1.0, 1.0],
[1.0, -1.0],
[-1.0, -1.0]
]
],
"properties": {
"name": "hassan"
},
"type": "Polygon"
}
}