Maps
- List Maps
- Get Map
- Create Map
- Update Map
- Delete Map
- Render Map
- Tiles
- List Map Layers
- Delete Map Cache
/maps
List Maps
URL: /maps
Method: GET
Protocol: HTTP, HTTPS
Parameters:
- type – private, public,shared, archived (default: all accessible maps)
Returns one of:
- 200 (OK) + collection of maps
- 404 (Not Found)
Example:
$ curl -X GET http://api.giscloud.com/1/maps <maps> <map> <id>2</id> <name>test_map_2</name> <description/> <owner>1</owner> <active>1</active> <copyright/> <proj4>+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs</proj4> <units>meter</units> <maxzoom>1000</maxzoom> <share>t</share> <mobileacess>f</mobileacess> <bgcolor/> <wmsaccess/> <modified>1312718747</modified> <accessed>1307483018</accessed> <created>1304248698</created> </map> </maps>
Get Map
URL: /maps/{id}
Method: GET
Protocol: HTTP, HTTPS
Parameters: id – map to be retrieved
Example:
$ curl -X GET http://api.giscloud.com/1/maps/1 <map> <id>2</id> <name>test_map_2</name> <owner>1</owner> ... </map>
Create Map
URL: /maps
Method: POST
Protocol: HTTPS
Returns:
- 201 + a URL to the newly created resource in the Location header of the response
Example:
curl -X POST https://api.giscloud.com/1/maps curl -H "Content-Type: application/json" -X POST -d '{"name": "<MAP_NAME>"}' "https://api.giscloud.com/1/maps.json?perpage=10&api_key=<API_KEY>"
Below you can see how to add a basemap.
curl -H "Content-Type: application/json" -X POST -d '{"mid": <MAP_ID>,"name":"<BASEMAP_NAME>","type":"tile","source":"{\"type\":\"tile\",\"src\":\"mapquest-osm\"}"}' "https://api.giscloud.com/1/layers.json?api_key=<API_KEY>" -v
Update Map
URL: /maps/{id}
Method: PUT
Protocol: HTTPS
Query string parameters:
parameter | default value | possible value | description |
archived | true,false | Using this parameter you can archive or restore a map |
Returns one of:
- 204 if successful
- 401 if not enough privileges
- 404 if the resource wasn’t found
Delete Map
URL: /maps/{id}
Method: DELETE
Protocol: HTTPS
Parameters:
- id – map to be deleted
Returns one of:
- 204 if successful
- 404 if the resource wasn’t found
Render Map
Produces map rendered as image (png,jpg) or as interactive map in an iframe.
URL: /maps/{id}/render.{format}
Method: GET
Protocol: HTTP, HTTPS
Parameters:
- id – map to be rendered
Query string parameters – render an image of a map:
parameter | default value | possible value | description |
format | png or jpg | Using this parameter you can choose image format, it can be in JPG or PNG. | |
phender | phender(true) | phender(true) | Starts the rendering engine |
timestamp | number, example: 1446645385 | Date/time of creation or modification. | |
width | 256 | number, example: 150 | Image width in pixels. |
height | 256 | number, example: 250 | Image height in pixels. |
layerlist | false | layerlist (true) | Set layerlist to visible. |
bounds | null | example: bounds=1674429.541,5684163.171, 1876223.296,5816093.482 |
Set bounds of rendered map. |
download | download(true) | Downloads the rendered map | |
numscale | false | number,example: 20000 | Set scale number |
invalidate | null | invalidate(true) | Invalidate cache |
justgenerate | null | justgenerate(true) | Just generate the image without saving |
saveto | saveto=exported maps | Set path to save image |
Query string parameters – create an interactive map:
parameter | default value | possible value | description |
format | iframe | Using this parameter you are creating an interactive map. | |
toolbar | false | toolbar (true) | Set toolbar to visible. |
layerlist | false | layerlist (true) | Set layerlist to visible. |
popups | false | popups (true) | Enable info popups in iframe when feature is selected. |
layer_id | null | number, example: 123456 | Set layer id. |
feature_id | null | number, example: 5 | Set feature id. |
bounds | null | example: bounds=1674429.541,5684163.171, 1876223.296,5816093.482 |
Set bounds of rendered map. |
width | 100% | number, example: 300 | Set width of iframe |
height | 100% | number, example: 300 | Set height of iframe |
visibility | null | example: visibility=1011,2121,1543 | Set visible layers |
expressions | null | example: expressions={“1011”:[1,2]} | Set visible expressions for a layer |
f | null | example: f=country | Set features field to zoom into |
v | null | example: v=Croatia | Set the features field value |
numscale | false | number,example: 20000 | Set scale number |
layerlist_expanded | false | layerlist_expanded(true) | Set expanded layerlist visible |
scalebar | false | scalebar(true) | Set scalebar visible |
noattrib | false | noattrib(true) | Sets noattrib class, removes attribution from the map |
noctrl | false | noctrl(true) | Sets noctrl class, removes controllers from the map |
no3d | false | no3d(true) | Disables hardware-accelerated CSS 3D transforms for positioning |
lockzoom | false | lockzoom(true) | Disables zoom |
style | null | example: style=phender | Sets the css file to use |
Returns:
- 200 – binary image or html
Example:
$curl -X GET http://api.giscloud.com/1/maps/4/render.png?width=64&height=64&invalidate=1 ...binary... $ curl -X GET http://api.giscloud.com/1/maps/4/render.iframe?height=300 <iframe src="http://beta.giscloud.com/embed/?map=4" width="100%" height="300" frameborder="0"></iframe>
List Map Layers
URL: /maps/{id}/layers
List layers in a map, also alternative entry point to /layers.
Take a look at layers below.
Delete Map Cache
URL: /map_cache/{id}/{init}?layers=layer1,layer2...
Protocol: HTTP, HTTPS
Method: DELETE
Returns:
- 204 if successful
- 404 if the resource wasn’t found
This operation is required in order for the GIS Cloud application to see modifications to the map made through the API. Currently, the init parameter must have the value of 2.
You can choose to delete cache for select layers by adding the layers parameter and setting layer ids.