How To Build Dynamic Maps Using JDeveloper 10g and Oracle Application Server MapViewer

An Oracle JDeveloper How To Document
Justin Lokitz
October 2004

Contents

      Introduction
      Setting up the MapViewer Extension for JDeveloper 10g
      Using the JDeveloper 10g, MapViewer Tag Libraries and API to Create Dynamic, Web-based Maps
      Conclusion

Introduction

In this document we will discuss how to use Oracle JDeveloper 10g and Oracle Application Server MapViewer to create dynamic, web-based maps. Oracle Application Server MapViewer is a J2EE service for rendering maps using spatial data managed by Oracle Locator or Spatial. Oracle Application Server MapViewer provides Java and XML API's as well as a JavaServer Page Tag Library such that anyone, from a beginning developer to a more advanced developer, will find it easy (and quite powerful) to integrate maps into existing and new development projects.

For more information on Oracle Application Server MapViewer see: http://www.oracle.com/technology/products/mapviewer/index.html

Setting up the MapViewer Extension for JDeveloper 10g

Setting up the Oracle Application Server MapViewer (MapViewer) extension for JDeveloper 10g is quite easy to do. After you have downloaded and deployed the MapViewer kit from OTN ( http://download.oracle.com/otn/other/mapviewer/mapviewer1012pre_ear.zip), download the MapViewer extension here: http://download.oracle.com/otn/other/spatial/mapviewer1012_jdev_10g.zip. The MapViewer Extension for JDeveloper 10g comes with three JAR files, mvclient.jar (MapViewer Client Java API), mvpalette.jar (JSP tags that will appear in JDeveloper's Component Palette), and mvconnection.jar (MapViewer metadata connection that will enable you to make a MapViewer metadata connection from which you can browse the existing mapping metadata such as styles, themes and basemaps). To install these, shutdown JDeveloper 10g and simply unzip the three JARS into the JDeveloper 10g extensions directory, found at $JDEV_HOME/jdev/lib/ext. Then restart JDeveloper 10g.

Using the JDeveloper 10g, MapViewer Tag Libraries and API to Create Dynamic, Web-based Maps

In the following sections, we will step through creating a very simple dynamic, web-based map using the MapViewer JavaServer Page Tag Library. After we have created our simple JSP, we will gradually add functionality to this map using standard JavaServer Page and MapViewer API's

Creating a map using the MapViewer JavaServer Page Tag Library:

Open JDeveloper 10g and add a new Application Workspace called "WebMap" using the "Web Application [default]" Application Template. Expand the newly created WebMap workspace, right click on the "View Controller", click "new" then select the"JavaServer Pages (JSP)" and "JSP Page"; click "ok". Change the title of your JSP to "webmap.jsp" and click "ok".

Now we are ready to test our map. With your MapViewer instance running and initialized against your database, save your webmap.jsp and click on the run button at the top of your page. You should now see your JSP WebMap.

Adding to the WebMap using standard JavaServer Page and MapViewer API's:

Now, we will add some interactivity and features to our WebMap via JSP and MapViewer API's as well as URL parameters.

Once again, we are ready to run our map.

The WebMap should be centered around San Francisco, California (-122.4,37.8) and should be zoomed into to a level of "2". Also, you will notice that a red star has appeared at the center of the map (-122.4,37.8). This of course was drawn dynamically via the MapViewer API (addPointFeature()) we inserted before the "run" tag.

Conclusion

Oracle Application Server MapViewer provides a powerful and flexible way to create dynamic, web-based maps based on location data managed by Oracle Locator or Spatial. With the addition of the MapViewer API's and extension for JDeveloper 10g, map (GIS) application development just became easier, more efficient and more effective.

For more information about Oracle Locator, Spatial and Mapviewer, please see the following:
http://www.oracle.com/technology/products/spatial/index.html
http://www.oracle.com/technology/products/mapviewer/index.html

false ,,,,,,,,,,,,,,,