Thursday, February 21, 2008

Oracle Maps in JDeveloper 11g - Even More Simple

With JDeveloper 11g we have standard support for Databound Geographic Maps. This means we don't need anymore to be GIS (Geographic Information System) specialists to enable Location-Based functionality in our enterprise applications. It sounds cool? Yes, but also it works :). It took for me 10 minutes (or little bit more) to develop sample application for this blog post.

Before I will start to describe implemented application, let's remember little bit how it was in JDeveloper 10g. You can check my older blog post - JavaScript in ADF Faces - Oracle Maps. It was easy as well, but it wasn't so elegant as it is now. In JDeveloper 11g you don't need to care about JavaScript or Oracle Maps API, it's because you don't need to develop - just use provided components. And most important, there is no need to deploy developed application on the same OC4J, where Oracle MapViewer is deployed.

You can download developed application - OraMapsSimple11.zip and run it directly from JDeveloper 11g TP3. Base map in this sample is retrieved from open Oracle service - http://elocation.oracle.com/mapviewer, so in order to run application you need to have Internet connection. In this sample I'm using Customers point theme, data for this theme is retrieved from MVDEMO datasource. You can download this datasource from Oracle MapViewer page on OTN.

When I was developing sample application, I discovered that MDSYS.SDO_GEOMETRY object type is not supported yet by map component in current JDeveloper 11g Technology Preview. But no matter of this I wanted to use point theme from my database, so I applied workaround. Workaround is to add two read-only attributes for X and Y coordinates:


As you can notice, I'm accessing information from spatial column directly - using LOCATION.SDO_POINT.X and LOCATION.SDO_POINT.Y definition.

I have generated map area in View layer using steps described in section 25.6 Creating Databound Geographic Maps from Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1. To add point theme to the map, it's needed only to provide required values and click Ok:


If you will not be lazy to run developed sample application, you will notice how cool are Oracle Maps in JDeveloper 11g. To run this application, you need to open it in JDeveloper 11g TP3 and select Run for main.jspx page, you will get similar view:


All functionality available in this screen, comes with standard component in JDeveloper 11g, you don't need to develop it, you can just use it:

28 comments:

Anonymous said...

How do I highlight a particular region in the map?

Andrej Baranovskij said...

Hi,

You can use selection tool that comes with Oracle Maps.

Or you can use Color theme to display different regions on the map.

Regards,
Andrejus

Anonymous said...

What if I want the base maps to be served from my internal server in JDeveloper (I am new to JDeveloper).

Anonymous said...

How do I get the internal Jdeveloper server to serve the maps?

Andrej Baranovskij said...

Hi,

You can just deploy Oracle MapViewer on the internal JDeveloper server.

Regards,
Andrejus

Anonymous said...

I have been trying to deploy the mapviewer.ear to the internal server. I added entries to the server.xml and default-web-site.xml files (and the ones in the template directory) and it still won't deploy. I am new to JDeveloper, I must be missing something obvious. If you have specific steps on how to deploy this ear, it would be a great help. Thanks.

Andrej Baranovskij said...

Hi,

You can deploy it to JDeveloper internal OC4J. To do this you need to start OC4J from command line. At first set memory configuration with set command:

set OC4J_JVM_ARGS=-mx512M -ms256M -Xrs -XX:MaxPermSize=128M

Now you can start OC4J

JDEV_HOME/bin/oc4j -start

When OC4J will be running, deploy MapViewer EAR with admin_client.jar utility. This utility is described in this doc.

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

Anonymous said...

Andrejus, I get the following errormessage:
DVT-26016: Unable to connect to mapviewer at http://elocation.oracle.com/mapviewer

Any idea how to solve this?

Andrej Baranovskij said...

Hi,

I have tested, for me this sample works perfectly. May be there was no internet connection?

Regards,
Andrej

Anonymous said...

Is possible to use programatically a dvt:map component to send a command to mapviewer server (for example Zoom-In) ?

Andrej Baranovskij said...

Hi,

I guess yes, but need to check in docs. Will follow up.

Regards,
Andrejus

Anonymous said...

Is possible to use programatically a dvt:map component to send a command to mapviewer server (for example Zoom-In) ?

Where to find information about that?

Anonymous said...

please help me I'm tried GEOMETRY.SDO_POINT.X OR GEOMETRY.SDO_POINT.Y NOT WORK IN mapviewer11R1 and jdeveloper 11.1.2

Anonymous said...

I tried to run this example on JDeveloper 11.1.1.2.0. I am getting an error message on the main.jspx saying 'Invalid parent for af:panelWindow' what should be done about this?

Anonymous said...

can be join multiple points in the map programmatically

Anonymous said...

Can we use google map as the basemap instead?

Freitas said...

How can i make a route? I have a list of node with lats and lngs, and i want to follow this route...

Anonymous said...

"As you can notice, I'm accessing information from spatial column directly - using LOCATION.SDO_POINT.X and LOCATION.SDO_POINT.Y definition"

This is what you have mentioned in ur blog. I have a geometry column and I need to do the same for a point theme. Can you please give the steps to do so as early as possible. I have been trying to add these two coulms but I have not succeeded yet. Please help as I am new to jdeveloper.

Thanks

Anonymous said...

Hi,

I have created two columns x and y as you have said. But when I add the theme and run my project, only base map is displayed. Can you please tell me why the theme is not being displayed.

Thanks

Anonymous said...

Hi, I cannot see datasource created in Mapviewer config file in Jdev. I cannot see it on weblogic console/service/datasource either. Why? Please explain. How does Jdev see mapviewer data source?
Thanks,
Regards,
Michael

Andrej Baranovskij said...

Hi,

For MapViewer, it just using MapViewer URL. There is no Data Source.

Andrejus

Darjan said...

Hello Andrejus,
I have started developing some GIS in JDeveloper 11.1.1.3. and mapviewer. When I started with developing I had a many problems with different things like getting coordinate from map(i.e. on click), and insert into db point or line with this coordinates. I solved this problems on different ways, but in every of this cases I used mapviewer api (oraclemaps.js).
In your example above you wrote the next sentence: "In JDeveloper 11g you don't need to care about JavaScript or Oracle Maps API, it's because you don't need to develop - just use provided components".
I am interested, if you can tell me, can I do that in another way, without using javascript, at least not explicitly?
Best regards,
Darjan

Sachin said...

Dear Andrejus,
I built one application using MAP, which is working fine standalone. I am deploying the same Jar in Webcenter and it is giving error because mapViewer (in Connection.xml) was not deployed along with this. Can you please help me in adding mapViewer properties/configuration to the Weblogic running the Webcenter. Many Thanks.

Jun said...

Hi Andrejus,

Would like to ask if there's a way using DVT map component to control the legend's position? I would like to display the legend in the left side or right side of the map. That is without overlapping the map.
I think they are in the same frame or div, so is there are to separate the map and legend?

Thanks,
Jun

Jun said...

Hi Andrejus,

I'm trying to implement map color theme but unable to display it, I created and attribute in JDeveloper to access the SDO_ORDINATES but when I look for it in the bindings, I'ts not there. Is there a special way on how to display the SDO Ordinates in a map?

Thanks,
Jun

Daisy said...

Hi Adrejus,

I am using jdev 11g ... In map point theme, can you tell me any way to draw lines between two points,given longitude and latitude of two points.

Also how to make the maps dynamic.So that he lines are rendered with respect to the changing positions


Unknown said...

Hi Andrejus

I am using dvt map to show the location-from latitude and longitude values getting from db. Will it be possible to show the direction between two locations in the same map?