8-2 Oracle Fusion Middleware Users Guide for Oracle MapViewer
or application contents. The dynamic FOIs and the static cached map tiles enable you to build Web mapping applications.
The JavaScript mapping client is a browser side map display engine that fetches map content from the servers and presents it to client applications. It also provides
customizable map-related user interaction control, such as map dragging and clicking, for the application. The JavaScript mapping client can be easily integrated with any
Web application or portal.
8.1.1 Architecture for Oracle Maps Applications
Figure 8–1 shows the architecture of Web mapping applications that are developed
using Oracle Maps.
Figure 8–1 Architecture for Oracle Maps Applications
Referring to Figure 8–1
, applications interact with the Oracle Maps architecture as follows:
■
The application is developed using JavaScript, and it runs inside the JavaScript engine of the Web browser.
■
The application invokes the JavaScript map client to fetch the map image tiles from the map tile server, and then it displays the map in the Web browser.
■
The application invokes the JavaScript map client to fetch dynamic spatial features from the FOI server and display them on top of the map tiles.
MapViewer
Database JDBC
HTTP
Map Rendering Engine
Spatial or Locator
Web Browser JavaScript Engine
JavaScript Map Client JavaScript API
Web Mapping Application External Map
Provider
Map Tile Server FOI Server
Adapter
Oracle Maps 8-3
■
The JavaScript map client controls map-related user interaction for the application.
■
When the map tile server receives a map image tile request, it first checks to see if the requested tile is already cached. If the tile is cached, the cached tile is returned
to the client. If the tile is not cached, the map tile server fetches the tile into the cache and returns it to the client. Tiles can be fetched either directly from the
MapViewer map rendering engine or from an external Web map services provider.
■
When the FOI server receives a request, it uses the MapViewer map rendering engine to generate the feature images and to send these images, along with feature
attributes, to the client.
8.1.2 Simple Example Using Oracle Maps
Figure 8–2 shows the interface of a simple application created using Oracle Maps. This
example is shipped with MapViewer, and can be accessed at http:host:portmapviewerfsmcsampleApp.html. To run this application,
follow the instructions in http:host:portmapviewerfsmctutorialsetup.html to set up the
database schema and the necessary map tile layers.
8-4 Oracle Fusion Middleware Users Guide for Oracle MapViewer
Figure 8–2 Application Created Using Oracle Maps
The application shown in Figure 8–2
displays customers on the map. The map consists of two layers:
■
The map tile layer displays the ocean, county boundaries, cities, and highways. The whole map tile layer displayed in the Web browser consists of multiple map
image tiles that are rendered by the map tile server.
■
The FOI layer displays customers as red dot markers on top of the map tile layer. If the user clicks on the marker for a customer, an information window is displayed
showing some attributes for that customer. The customer markers and attributes are rendered by the FOI server.
In addition to these two layers, a scale bar is displayed in the lower-left corner of the map, and a navigation panel is displayed in the upper-right corner.
Oracle Maps 8-5
The application user can use the mouse to drag the map. When this happens, new image tiles and FOIs are automatically fetched for the spatial region that the map
currently covers. The user can also use the built-in map navigation tool to pan and zoom the image, and can show or hide the customers red dot markers by checking or
unchecking the Show customers box.
Example 8–1 shows the complete source code for the simple application shown in
Figure 8–2 .
Example 8–1 Source Code for the Simple Application
html head
META http-equiv=Content-Type content=texthtml charset=UTF-8 TITLEA sample Oracle Maps ApplicationTITLE
script language=Javascript src=jslibloadscript.jsscript script language=javascript
var themebasedfoi=null function on_load_mapview
{ var baseURL = http:+document.location.host+mapviewer;
Create an MVMapView instance to display the map var mapview = new MVMapViewdocument.getElementByIdmap, baseURL;
Add a map tile layer as background. mapview.addMapTileLayernew MVMapTileLayermvdemo.demo_map;
Add a theme-based FOI layer to display customers on the map themebasedfoi = new MVThemeBasedFOIthemebasedfoi1,mvdemo.customers;
themebasedfoi.setBringToTopOnMouseOvertrue; mapview.addThemeBasedFOIthemebasedfoi;
Set the initial map center and zoom level mapview.setCenterMVSdoGeometry.createPoint-122.45,37.7706,8307;
mapview.setZoomLevel4; Add a navigation panel on the right side of the map
mapview.addNavigationPaneleast; Add a scale bar
mapview.addScaleBar; Display the map.
mapview.display; }
function setLayerVisiblecheckBox {
Show the theme-based FOI layer if the check box is checked and hide the theme-based FOI layer otherwise.
ifcheckBox.checked themebasedfoi.setVisibletrue ;
else themebasedfoi.setVisiblefalse;
} script
head body onload= javascript:on_load_mapview
h2 A sample Oracle Maps Applicationh2 INPUT TYPE=checkbox onclick=setLayerVisiblethis checkedShow customers
div id=map style=width: 600px; height: 500pxdiv body
html
The components of this sample application and the process for creating a client application are described in
Section 8.5.3 .
8-6 Oracle Fusion Middleware Users Guide for Oracle MapViewer
8.1.3 How Map Content Is Organized