Wednesday, March 5, 2008

Oracle Maps in JDeveloper 11g - Perfectly Fits into Enterprise

Let's get back to Oracle Maps topic again, in this post I will describe how spatial logic in JDeveloper 11g can be combined with traditional non-spatial operations. Before reading this post, I suggest to read my previous post - Oracle Maps in JDeveloper 11g - Even More Simple, I describe there how to develop and run basic Oracle Maps application.

Developed sample application - OraMaps11.zip, demonstrates how Search functionality can be implemented with Spatial technology. I'm using MVDEMO datasource for this application, you can download this datasource from OTN. Sample application implements a form with a table for search results, however there is no traditional search parameters in this form. Search criteria is defined using Oracle Maps functionality. Based on this criteria, query in database is executed and table with results is refreshed. It also allowed to update rows available in results table, changes are reflected in generated map as well.

Ok, let's describe this with pictures. Here you see Oracle Maps screen and table with Search results:


Oracle Maps comes with Circular selection tool, you don't need to develop it, just use it. So, five customers are selected spatially - results table is refreshed and shows information only about those five selected customers:


Now let's select only one customer - EMBARCADERO CENTER 3, Sales here are around 181:


If row contained in results table is updated, related point on the map is updated as well. I have updated Sales to 70, and you can notice it's reflected on the map:


Oracle Maps comes not only with Circular selection, but with Rectangular, Multy-Point and simple Click selection. Rectangular selection:


And refreshed table with selection results:


And it's really not complex to develop all this stuff. There are three main points:

1. Map Theme Selection Listener

I have defined Selection Listener for Customers theme. This listener receives all events related to Customers theme selection:


You can find code for this listener in Backing bean class. Developed code manages keys for selected points, invokes query and executes results table visual refresh.

2. Search results table refresh

When keys for selected points are prepared, selectCustomers method in Model layer is executed to query database and refresh View object:


This method is defined in Page Definition file and is invoked from Backing bean class:


In order to refresh table visually, from Selection Listener available in Backing bean class, it's enough to use only one line of code:

AdfFacesContext.getCurrentInstance().addPartialTarget(this.getTable1());

3. Search results editing

To update edited rows in Search results table, standard Commit action is used. However, it's important here to refresh both after Commit action is done - table and map. So, I have enabled PartialSubmit for Save button and provided PartialTriggering for table and map components pointing to Save button.

In my future posts, I will describe more sample application related to Spatial functionality.

11 comments:

gareth said...

hi andrejus,

can we implement this using oracle 10.1.3.3?

gareth

Andrej Baranovskij said...

Hi Gareth,

Described functionality comes only with 11g. But sure, you can implement something similar in 10.1.3.3, however you will need to develop all map related components yourself.

Regards,
Andrejus

Andrej Baranovskij said...

Hi,

I have noticed, Oracle changed Base Maps in their http://elocation.oracle.com/mapviewer public map service. In order to run developed sample application, change Base Map name:

1. In JDeveloper 11g select dvt:map component
2. In Property Inspector tab press Edit Component Definition... icon
3. In opened Create Geographical Map wizard select ELOCATION_MERCATOR for Data Source and WORLD_MAP for Base Map
4. Press OK and change dvt:map component Id to "map".

Regards,
Andrej

renvaldas said...

link not working http://uosis.mif.vu.lt/~anba1548/blog/OraMaps11.zip

Andrej Baranovskij said...

Hi,

Yes, I'm in the process now of migration to new server.

If you drop me an email, I will forward you this archive.

Thanks,
Andrejus

Unknown said...

Hi Andrejus:

I am a new guy in "Oracle MAPS: MapViewer" trying to know if it is possible to use Oracle MAPS to view high resolution photographic pictures? Instead of viewing maps, I want to view my pictures that I will store into a database and use the same features available with Oracle MAPs/MapViewer. Also, the pictures will need to be tiled to be able to zoom at different levels.

Thanks for considering my question.

rafiou

Andrej Baranovskij said...

Hi,

Sure its possible. I suggest to check Oracle Spatial site on OTN, they have pretty good guidelines and documentation.

Regards,
Andrejus

JAVIER said...

I can not find a clear example of how it should be the Object View of Business Compoenent to create the theme color on the map. CAN YOU HELP ME
THANKS

Marcelo A. Vasquez said...

Hi Andrejus.

I have a table with the data of geometric circles. It is possible to show the circle? MapColorTheme should I use?

Regards,
Marcelo

Unknown said...

hi andrejus,
can i use jdeveloper 11g only to show oracle spatial data or i need third party tools to do that such as MapViwer ,AspMap , .... etc.

Regards,
Maher

Andrej Baranovskij said...

You need to have MapViewer, its Oracle product.

Andrej