-
Notifications
You must be signed in to change notification settings - Fork 0
Maps API
API for managing maps (represented in GeoServer admin as a LayerGroup).
- GET - list available maps
-
GET - complete map definition
-
POST - create new map
-
PUT - replace definition of existing map
-
PATCH - updating existing map with partial definition
-
DELETE - remove indicated map
/api/maps/<workspace>/<map>/copy
- PUT - copy an existing map
/api/maps/<workspace>/<map>/bounds
- PUT - calculate the bounds of an existing map in a given projection
/api/maps/<workspace>/<map>/layers
-
GET - list of layer references, in order displayed by map
-
PATCH - replace lost of layer references
-
POST - append one (or more) layer references
/api/maps/<workspace>/<map>/layers/<name>
-
GET - access an individual layer by name or index
-
DELETE - remove an individual layer by name or index
Related "Reflector" GeoServer API:
/geoserver/wms/reflect?layers=<workspace>:<map>&format=application/openlayers
- GET - URL used to for sharing map via email
- http://horizon.boundlessgeo.com/geoserver/wms/reflect?layers=medford:medford&format=application/openlayers
- http://horizon.boundlessgeo.com/geoserver/wms/reflect?layers=usa:states&format=application/openlayers
List maps available in a workspace.
- GET /api/maps/{workspace}
- http://horizon.boundlessgeo.com/geoserver/api/maps/medford
- http://localhost:8080/geoserver/api/stores/maps/medford
HTTP 200 OK
[ { "name" : <name>,
"workspace" : <workspace>
"title": <title>,
"description" : <description>,
"proj": <proj>,
"bbox": <bbox>,
"projectionExtent": <extent>,
"layer_count": 13,
"timeout": 1000,
"modified": "Mon, 06 Oct 2014 16:21:53 GMT"
}
<map summary>
]
Each <map summary> provides details sufficient for listing available maps:
-
bboxis the Bounding box of all the layers in the map, calculated using the SRS defined byproj. -
projectionExtentis the cannonical projection extent of the SRS. -
layer_countincludes both layers and group layers - metadata:
author,created,modified,changeandtimeoutare optional-
modifiedis filled in from file handle so you have something
-
HTTP 404
- notfound
Map definition including list of layers.
- GET /api/maps/{workspace}/{map}
- http://horizon.boundlessgeo.com/geoserver/api/maps/medford/medford
- http://localhost:8080/geoserver/api/stores/maps/medford/medford
HTTP 200 OK
Map definition suitable for editing.
- contained groups describe mode and layer_count
- contained layers indicate which resource
- additional metadata can be added, such as background
HTTP 400
- notfound
Creates a new map.
- POST api/maps//
{"name": "foo",
"proj": "epsg:4326",
"abstract": "Spatial data courtesy of the City of Medford \<http://medford.org\>"
}
HTTP 200 OK
Resulting map definition.
HTTP 400
- notfound:
Deletes an existing map.
- DELETE /api/maps/{workspace}/{map}
HTTP 200
{"title": "foo"}
Edits an existing map.
- PUT /api/maps/{workspace}/{map}
{
"proj":"epsg:3587"
"bbox":{"west":180,"east":180,"south"90,"north"90:}
}
A partial map definition (as shown above). Can include any or all attributes of a map. Note that bbox and proj are meaningless without each other, although if only proj is included, then bbox will be automatically calculated based on the layers in the layer group.
HTTP 200
Representation of modified map.
HTTP 404
- notfound
Copies an existing map.
- PUT api/maps/{workspace}/{map}/copy
{"name": "foo",
"copylayers": "true",
"layers": [...]
}
Where:
- name: The name of the copy
- copylayers: Boolean flag to copy all the layers, or use the existing layers in the new map. Optional, defaults to true.
-
layers: List of layers to rename. Elements have the same syntax as the Copy Layer API. Only applies if
copylayers=true. If any layers are not provided, renaming defaults to<oldlayername>-<map>where<map>is the first three letters of the map name.
Calculates the bounds of an existing map in a given projection.
- PUT api/maps/{workspace}/{map}/bounds
{"proj": "EPSG:4326"}
Calculates the net bounds (aggregated layer bounds) of the map in the projection given by proj. The calculated bounds will be in the same units as this projection. If a projection is not given, uses the current projection of the map.
HTTP 200 The calculated bounds:
{
"proj": {
srs:"epsg:3587",
wkt: ...,
...
},
"bbox": {
native: {
"west":180,"east":180,"south":90,"north":90,
"center":[...]
},
lonlat: {
"west":180,"east":180,"south":90,"north":90,
"center":[...]
}
}
}
HTTP 404
- not found: layer reference does not match a published layer
- bad request: invalid CRS
List of layers used by map, in order displayed.
- GET /api/maps/{workspace}/{map}/layers
- http://horizon.boundlessgeo.com/geoserver/api/maps/medford/medford/layers
- http://localhost:8080/geoserver/api/maps/medford/medford/layers
HTTP 200
- List of layer references in order displayed
HTTP 404
- notfound
Replace the references in the list of layers (can be used to bulk move references, add references or remove references).
PUT:
- PUT [/api/maps/{workspace}/{map}/layers]
{ { workspace=<workspace>,
name=<layer>},
<reference>
}
Where:
- reference: provides a workspace and name used to locate a published layer
Notes:
Removing references listed in a Map does not delete the published layer (your layer and style remain unmodified and available for use in other Maps).
HTTP 200
List of layers after modification.
HTTP 404
- not found: layer reference does not match a published layer
- bad request: adding two references for the same published layer
- bad request: removing the last layer
Append one (or more) layer references.
- POST [/api/maps/{workspace}/{map}/layers]
{ { workspace=<workspace>,
name=<layer>},
<reference>
}
Where:
- reference: provides a workspace and name used to locate a published layer
HTTP 200
List of layers after modification (see GET).
HTTP 404
- not found: layer reference does not match a published layer
- bad request: adding two references for the same published layer
Access an individual layer by name or index.
- GET /api/maps/{workspace}/{map}/layers/{name}
- http://horizon.boundlessgeo.com/geoserver/api/maps/medford/medford/layers/schools
- http://horizon.boundlessgeo.com/geoserver/api/maps/medford/medford/layers/2
- http://localhost:8080/geoserver/api/maps/medford/medford/layers/schools
- http://localhost:8080/geoserver/api/maps/medford/medford/layers/2
Remove an individual layer by name or index.
- DELETE [/api/maps/{workspace}/{map}/layers/{name}]
HTTP 200
{ name: <name>
removed: <boolean>
}
HTTP 404
- not found: layer reference does not match a published layer
- bad request: adding two references for the same published layer