MapViewer PLSQL API 6-3
6.2.2 Creating a MapViewer Client Handle
Before each database session, you must create a MapViewer client handle before using any functions or procedures of the SDO_MVCLIENT package. The following example
creates a MapViewer client handle:
connect scott Enter password: password
call sdo_mvclient.createmapviewerclient http:www.mycorp.com:8888mapvieweromserver ;
The preceding example creates, in the current session, a unique MapViewer client handle to the MapViewer service URL
http:www.mycorp.com:8888mapvieweromserver. To use this example, change www.mycorp.com to the host on which the MapViewer service is running.
After you have created a MapViewer client handle, you can perform the following query to check that MapViewer is running correctly:
select sdo_mvclient.getdatasources datasources from dual; The SQL function sdo_mvclient.getdatasources is part of the MapViewer
PLSQL package API; and when it is executed, it connects to the remote MapViewer server and gets a list of all known data sources. If the installation is successful and the
MapViewer server is running, the result of the preceding example is output similar to the following, with the string array containing the names of the data sources that are
defined in the MapViewer server:
DATASOURCES --------------------------------------------------------------------------------
SDO_1D_STRING_ARRAYmvdemo, wms
6.2.3 Preparing a Map Request
Call various methods in the PLSQL package to prepare a map request, which will eventually be sent to the MapViewer server for processing. You can specify the basic
characteristics of the map to be created, and you can add temporary styles and multiple themes to the current map request.
Example 6–1 sets the data source and other map characteristics, adds a dynamically
defined color style to the map request, and manipulates a theme.
Example 6–1 Preparing a Map Request
call sdo_mvclient.setDataSourceNamemvdemo; call sdo_mvclient.setImageFormatPNG_URL;
call sdo_mvclient.setAntiAliasingtrue; call sdo_mvclient.setBaseMapNameqa_map ;
call sdo_mvclient.setBox-122.3615, 37.4266, -121.1615, 37.6266; call sdo_mvclient.setDevicesize500,400;
call sdo_mvclient.addColorStylecolorst, blue, yellow, 100,100; select sdo_mvclient.addJDBCThememvdemo, theme1,
select geom from states where state_abrv = CA, geom, 8307, C.RED, null, null, FALSE from dual ;
6-4 Oracle Fusion Middleware Users Guide for Oracle MapViewer
6.2.4 Sending the Request to the MapViewer Service
The following example effectively sends the current map request to the remote MapViewer server for processing. It will return after the request has been processed at
the server.
select sdo_mvclient.run from dual; You can also use such methods as sdo_mvclient.zoomIn and sdo_
mvclient.zoomOut to get zoomed maps.
6.2.5 Extracting Information from the Map Request
The following example extracts the URL string of the generated map image: select sdo_mvclient.getgeneratedMapImageURL from dual;
After you have the URL of the map image, you can do various things, such as fetch and store the image in a database table, or present the map with other information on
a HTML page.
7
MapViewer XML Requests: Administrative and Other 7-1
7
MapViewer XML Requests: Administrative and Other
The main use of MapViewer is for processing various map requests. However, MapViewer also accepts through its XML API various administrative non-map
requests, such as to add a data source, as well as other general-purpose requests useful in developing applications, such as to list available themes and base maps. All
MapViewer administrative requests require that you log in to the MapViewer administration Admin page, for which there is a link on the main MapViewer page;
the general-purpose requests can be made from an application without the requirement to log in. This section describes the format for each request and its
response.
All XML requests are embedded in a non_map_request element and all responses are embedded in a non_map_response element, unless an exception is thrown by
MapViewer, in which case the response is an oms_error element described in Section 3.5
. The administrative requests are described in sections according to the kinds of tasks
they perform:
■
Managing Data Sources