SynerGIS is providing a simple test page in order to check out the possibilities to integrate a JSON map preview to other websites. The file 'preview.jsp' can be accessed either via http://<WebOffice web application>/client_preview/preview.jsp or via the WebOffice Administration pages and the Application Tab - Demo for synservice.
(For further information see chapter Service API).
The test page is divided into three different areas:
•map preview
•simple form to generate requests
•Request and Responses

Demo for synservice - preview.jsp
Following examples demonstrate how to create requests and are based on WebOffice_SampleProject.
Example A: Get the full extent of a project
Best practise:
•format: JSON
•project: WebOffice_SampleProject (every project of the application will be selectable)
•authentication: 'URL, username/password as url parameters'
•width (px) and height (px)
•x (map units), y (map units) and scale: leave blank in order to get the full extent
•With clicking the „SEND REQUEST“ Button a map image will be displayed.

Configuration JSON-API
Example B: To do a external query
With extending the topic 'Functionality' it's possible to define requests for querying or editing. This example demonstrates how to configure a query. (For further information on how to create requests for editing see chapter URL Call interface for Editing for Service API.)
Best practise:
1.activate the checkbox of 'query'
2.Adapt the example request to the certain project: e.g. query=NCC&keyname=CITY_NAME&keyvalue=Vaduz
3.x (map units) and y (map units): leave blank in order to get, to generate the center point of the map image
4.scale: Scale to be used for displaying search results

Configure a Query
All necessary requests and responses are listed in the topic 'Communication'.
The complete request for example B:
../synservice?project=WebOffice_SampleProject&query=NCC&keyname=CITY_NAME&keyvalue=VADUZ&x=&y=&scale=&width=&height=&r=0.24527861108136323
The response could be:
{"MAP":{"url":"http://w-ws-rainer/WO_10R3_20120515/output/Demo-Projekt_f_r_WebOffice_Demo-Projekt_f_r_WebOffice_20120515_150341_761_61.jpg",
"x":4284637.5931,"y":2670055.2709,"scale":300000,"width":640,"height":400,"upp":79.37515875031251},"FEATURES":{"COORDS":[{"x":320,"y":200}]},
"response_id":"ae3a1998-14af-4f20-b0d8-11c46f61e7c3"}
This response contains several parameters:
•URL of the generated map image
•X and Y- coordinates of the center point of the map image
•scale of the map image
•width and hight of the map image
•„upp“: defines the value how many geounits define a pixel

Request and Responses
Example C: external query with parameters "returnkey" and "geometry"
I. "&returnkey"
The parameter "&returnkey" can be complemented to the prior request :
query=COUNTRY&keyname=CNTRY_NAME&keyvalue=Austria&returnkey=LONG_NAME
The response would look like this:
{"MAP":{"url":"http://w-ws-rainer/WO_10R3_20120515/output/Demo-Projekt_f_r_WebOffice_Demo-Projekt_f_r_WebOffice_20120515_172844_806_8c.jpg",
"x":4570333.84795,"y":2744950.30755,"scale":3698238.472425819,"width":640,"height":400,"upp":978.4942194843752},"FEATURES":{"keyname":["CNTRY_NAME"],
"COORDS":[{"x":382,"y":216,"keyvalue":["Austria"]}]},"response_id":"f4b7408b-85d9-478f-b227-3aeee6929ff2"}
II. "&geometry=(geometry)"
If you don't want to generate a Query or Selection attributive, you can do this by certain coordinates. Therefore use the parameter geometry=(geometry) in the area of 'query' instead of the parameters keyvalue keyname. Activate the option 'click appends coordinates' before digitizing a polygon in the map preview. The corners of this polygon are used as coordinates for the request and are listed in the area of 'geometry'.
The response would look like this:
{"MAP":{"url":"http://w-ws-rainer/WO_10R3_20120515/output/Demo-Projekt_f_r_WebOffice_Demo-Projekt_f_r_WebOffice_20120515_174159_228_ac.jpg","x":4820637.819250001,
"y":2807579.80765,"scale":1256055.7877890104,"width":200,"height":200,"upp":332.33209185000516},"FEATURES":{"keyname":["CITY_NAME"],"COORDS":[{"x":191,"y":100,"keyvalue":["Bratislava"]},
{"x":9,"y":100,"keyvalue":["Vienna"]}]},"response_id":"ac4cb877-f7fd-4380-84d9-f0b2571a8af7"}
Example C: Reprojection from WGS84 coordinates (lat/lon) into coordinates of the main map service (x/y)
This example shows how to reproject WGS84 coordinates (decimal degree) into coordinates (x/y) of the main map serivice.
Choose the following properties:
•format: JSON
•project: WebOffice_SampleProject (all projects of the application are available)
•width (px) and height (px)
•Functionality: assign additionally the parameters lat/lon and coordmarker_lat_lon (optional, displays the coordinates) to the query

Request to reproject coordinates from decimal degrees into the coordinates of the main map service
With a click on "Send Request" the lat/lon coordinates will be transmitted, the response provides amongst others the x/y coordinates of the main map service:
{"MAP":{"url":"http://w-ws-wintner/WebOffice_LatestBuild/output/Demo-Projekt_f_r_WebOffice_Demo-Projekt_f_r_WebOffice_20120830_150759_483_0d.jpg",
"x":4733761.190721357,"y":2676911.7681118418,"scale":3563077.8624002244,"width":1440,"height":775,
"upp":942.7329032258065},"response_id":"63cc0761-95c1-4302-bf4e-a7c49ed4ff53"}