<< Click to Display Table of Contents >>

 

REST User Manual

 

Before using REST, you need to create a public folder in SuperGIS Server. Then you are able to access all the folders and resources under the public folder by following the instructions of this manual.

 

1.Access all the folders and resources under public folder:

To access all the folders and resources under public folder, type in the following URL:

http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/?format=

where “xxx” are the IP address of your server. For example,

http://localhost/SGSPWS/SGSPAgent.ashx/REST/?format=

 

There are 3 different format options:

a.HTML:

http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/?format=HTML

b.XML: http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/?format=XML

c.JSON: http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/?format=JSON

 

If you leave format empty, then the default format is HTML.

 

2.Access the content of a specific resource

To access a specific resource, type in the following URL: http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/?format=

where “path” is the directory of your folder, and “resource” is the resource name. For example:

a.http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/?format= allows you to access the test.cfg resource under public folder.

b.http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/A/test.cfg/?format= allows you to access the test.cfg under A folder, which is in the public folder.

 

3.Access the nth layer of a specific resource

To access the nth layer of a specific resource, type in the following URL:

http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/n/?format=

where n is a number begins from 0, which means the first layer of the resource. For example, the URL http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/1/?format= allows you to access the second layer of the test.cfg under public folder.

 

4.Query

To query, you can use either WKT or SQL.

a.To query using SQL, type in the following URL: http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/n/Query/?format=&expr=

Also type in the SQL after “&expr=”. For example, the URL http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/0/Query/?format=&expr= %5BKIND%5D+%3D+%27School%27 allows you to query the first layer of test.cfg under public folder using the SQL: [KIND] = ‘School’

 

Here’s how you get the converted SQL in URL style:

1.Type in the following URL in your web browser: http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/n/Query/

2.Type in the SQL in the browser, as shown in the figure below.

 

 

 

3.Click ‘Query’, and then you can get the converted SQL, as shown in the figure below.

 

 

 

b.To query using WKT, type in the following URL: http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/n/Query/?format=&geom=

And type in the WKT after “&geom=”. For example, the URL http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/0/Query/?format=&geom=POINT+%28121+25%29 allows you to query the first layer of test.cfg under public folder using the WKT: POINT (121 25). Note that the format of the coordinates should be modified depending on your coordinate system.

 

Here are some other examples of spatial query:

 

 

Type

Examples

Point

POINT (30 10)

LineString

LINESTRING (30 10, 10 30, 40 40)

Polygon

POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))

POLYGON ((35 10, 10 20, 15 40, 45 45, 35 10),
(20 30, 35 35, 30 20, 20 30))

 

Type

Examples

MultiPoint

MULTIPOINT ((10 40), (40 30), (20 20), (30 10))

MultiLineString

MULTILINESTRING ((10 10, 20 20, 10 40),
(40 40, 30 30, 40 20, 30 10))

MultiPolygon

MULTIPOLYGON (((30 20, 10 40, 45 40, 30 20)),
((15 5, 40 10, 10 20, 5 10, 15 5)))

MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),
((20 35, 45 20, 30 5, 10 10, 10 30, 20 35),
(30 20, 20 25, 20 15, 30 20)))

 

 

5.Access an image of the published service

To access the published image, type in the following URL:

http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/MapImage/?format=&left=&top=&right=&bottom=&width=&height=

Also type in the map extent and the image width and height. For example, the URL http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/MapImage/?format=&left=121&top=25&right=123&bottom=22&width=256&height=256 allows you to get an image whose size is 256 x 256, and the map left extent is 121; top, 25; right, 123; bottom, 22. Note that the 4 numbers should be modified depending on your coordinate system.

 

To get different image formats, type in the format after ‘?format=’. For example,

http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/MapImage/?format=image/png&left=121&top=25&right=123&bottom=22&width=256&height=256

 

6.Access a tile image of the published service

To access a tile image of the published service, type in the following URL:

http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/Tile/S/C/R/L

where S is the scale level; C, the nth column; R, the nth row; L, the legend index.

For example, the URL

http://localhost/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/Tile/0/0/0/0

allows you to access the tile image at row 1, column 1, in the first layer of the

test.cfg under public folder. The scale level of the tile image is the first level.

 

7.Access a legend image of a layer in one specific resources

To access a legend image, type in the following URL: http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/path/resource.cfg/n/Legend/?format=

For example, the URL http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/public/test.cfg/0/Legend/?format= allows you to access the legend image of the first layer in test.cfg under public folder.

 

 

Notes:If you want to access folders and resources other than ‘public’, you have to log in first. To do so, type in “http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.htm” in your web browser, and enter Username and Password to log in. As shown in the figure below.

 

 

 

 

Then type in http://xxx.xxx.xxx.xxx/SGSPWS/SGSPAgent.ashx/REST/?format= in your web browser, and you will be able to see folders and resources other than ‘public’. As shown in the figure below.

 

 

 

 

To REST, logging in is a ‘state’, and one of the REST constrains is stateless. Therefore, it is not recommended to log in for making applications. It is best for you to publish your services under the ‘public’ folder.

 

 


©2017 Supergeo Technologies Inc.