Business logic of developed sample - OraMapsWithTable.zip, is to provide a possibility of browsing through a table with cities data and to show selected city on the map. For the data source is used CITIES table from MVDEMO schema. Geometry theme for the CITIES table is declared using Oracle MapBuilder product. Oracle MapViewer, Oracle MapBuilder, MVDEMO schema and other spatial products you can download from - OTN. In the application Model layer EJB and TopLink are used, and ADF Faces components in the View layer.
Ok, if you have successfully deployed and configured MVDEMO schema, Oracle MapViewer and Oracle MapBuidler, it is time to describe how I have developed this sample application.
As you may notice, I'm using cities data, however cities geometry theme declaration doesn't come with MVDEMO. So, we need to declare it. You can declare it in the less than a minute, just use Oracle MapBuilder tool. There are two main things you should define, when declaring geometry theme for cities - hidden info field and query condition. In the hidden info field you should define all fields you want to show in pop-up window when city's point on the map will be clicked. In the query condition, data selection criteria is defined. More information on this topic is available in MapViewer User's Guide section - 8.3.1 Theme-Based FOI Layers. Shortly, cities geometry theme declaration for this application should look like this:
Application Model layer is generated using JDeveloper wizards, and there is no any custom code added. However, I have deleted default session definition and created - oramaps session definition with data source location pointed to jdbc/OraMapsDS data source.
I have tested this sample on standalone Oracle Application Server (deployment profile is included into application workspace). Finally, we have a table and a map:
Let's say, we select Milwaukee city in the cities table, then similar map will be displayed:
So, what is better - to have a table or to have spatially enabled table? ;-)