Oracle Forms 10g- Using Static Google Maps with HTTP geocoding service

Posted on January 2nd, 2009.

Here is an update with the files for implementing a javabean that displays a static google map for a given location.

In a number of back-end applications, users as well as entities are registered with their address information. In some cases, it is desired to provide a visual representation of this address information.
A free service that is provided by Google allows us to obtain the map for a given address as well as additional info such as directions from a given point to this address.

This is a bit difficult to implement in Oracle Forms 10g since the Google API is based on Javascript. In those cases where Javascript is blocked or not possible, Google provides another service which is called Google Static maps.

What this service provides is a static image of the map based on the address information. This can be sufficient in a number of Forms applications.

In this note, we provide a javabean that will display the static map in addition to the latitude and longitude corresponding to the address provided by the user (or fetched from a table).

First, we will use the Google Maps HTTP geocoding service to retrieve the latitude and longitude. Then, we use this data to fetch the static map from the Google static map service.

Static Google Map Javabean output-Oracle forms 10g

This javabean can be used either with the SUN JRE or Oracle Jinitiator. It has been tested with Jinitiator 1.3.1.22 and 1.3.1.29.

Download the jar, java file, sample FMB and the technical note

Please note that the javabean has also been submitted to the Pluggable Java Component & JavaBean ’s library website maintained by Francois Degrelle.

Make a Comment

Make A Comment: ( 31 so far )

blockquote and a tags work here.

31 Responses to “Oracle Forms 10g- Using Static Google Maps with HTTP geocoding service”

RSS Feed for Oracle Developer Tools and Thoughts Comments RSS Feed

Hi Hafed,

Thanks for the great bean.
I’ve implemented it in an existing form and it works fine if I don’t make the map/bean area too big. When I enlarge it, let’s say 800×600 pixels, it crashes (and even for smaller sizes). I loose my connection to the application server.
Any ideas why this can happen ?

Kind regards,

Sven

Sven Smets
January 8th, 2009

Hi Sven,

From the Google Static Map website, I have this info regarding the image size:

Image Sizes

Images may be retrieved in sizes up to 640 by 640 pixels. The size parameter takes a string with two values separated by the x character. 640×640 is the largest image size allowed.

So I guess, it causes problems with the size you selected.

I will test the bean with different sizes and will report the results here.

Thanks

degenio_mhafod
January 8th, 2009

Yes, the size is causing your loss of connection. I will make a change so that the size is checked when the bean is instantiated.

Hafed
January 8th, 2009

I updated the size handling. Please see changelog.txt for the changes. Use the above link to download the new version. Thanks.

Hafed
January 12th, 2009

Dear Sir / Madam ,
I have checked the gmap form in oracle. Can it be possible to enable dragging facility in this.

Thanks

Amit
January 19th, 2009

Hi Hafed,
I already done it with your Installing the JAR,
When I is exec.. this form, it show the error msg “FRM-13008: Cannot find JavaBean with name ‘oracle.forms.jv.StaticGMap.’ “.
Is there any others step I miss it?

Venassa
January 30th, 2009

@Venassa: did you follow the technical note. Most likely, you did not include the jar name in the formsweb.cfg file. There is a line there that starts with archive_jini. You should include gmap.jar there.

Also, make sure that you are using the right one at runtime. For example, if you have a number of named config, gmap.jar should be added to the config you are using at runtime.

Hafed
January 30th, 2009

Hi Hafed,
Appreciate your answer.
It’s a great help to me for resolving
my problem.
Thank you again.

Venassa
February 2nd, 2009

Dear Hafed,

Thanks for the great bean.

I have a question. Google map cover “user created content” in http://maps.google.com.

Can I utilize this feature in your bean ?

Because by utilizing this feature I am able to view the mostly location which I want.

Regards

Fahed
February 14th, 2009

@Fahed: I will have to check that point. I will get back to you. Thanks

Hafed
February 14th, 2009

First of all this is an excellent Bean!. However, I have a problem in that when I add any extra text to search on I get a Legal Problem exception. I used:

10+downing+street,+,+UK,+funeral directors&output=csv&1|10||true|false||ABQIAAAAE3WfGRybLGo3GgMf9MvRERQo7gT_lO3wObmJAt4dnZGByIpzGxREhPKSCS7cMD3bG-c2bxqrq-KZxQ

Do you know why this is and is there a workaround?

keni robson
February 26th, 2009

Hi. Thnx for your JB.
Hafed, how can i use LATITUDE & LONGITUDE instead ADDRESS. It is possible?
Thnx. Good luck!

observer
February 27th, 2009

@observer: very good question indeed. The way I structured the algorithm, the user has to enter the address, then based on this info, the latitude and longitude is fetched and from this par is submitted to the google static map service. So, I should have provided for a way to enter directly latitude and longitude. I will add it to the bean in a couple of days with the other modifs.
Thanks for suggesting this. Can you wait a week or so?

Hafed
February 27th, 2009

It is a good news, Hafed. Thnx. I will wait as long as nesessary!

observer
February 27th, 2009

hi

i want to run or implement java beans in developer 10g

please someone send me steps regarding that?

my email is smalipaki@yahoo.com

thanx in advance

Ali
March 9th, 2009

@Ali: Here is the best introduction to PJCs and javabeans within Forms: http://sheikyerbouti.developpez.com/forms-pjc-bean/first-bean/first_bean.pdf

Hafed
March 9th, 2009

@keni: and those with a similar error. You have to use the info needed to locate the address. In this case, you are feeding “funeral directors” as the postal code to the google API. It is not going to locate your address with this info!!
Also, I have to point out that spaces are converted to the + sign if you submit your own address info from the Oracle forms module. One trick to follow is to look at the sample FMB and check the google url item. There, you have the exact address info that will be fed to google.
One last note: if you really don’t have the exact wording for the address, best thing is to start with geocoding first (get the Lat/Long) and then feed this info to the bean. I will be updating the bean this week to get it to take the Lat/Long as an alternative to addresses.

Hafed
March 9th, 2009

can anybody tell me about ‘how to put image in oracle forms builder 6i’

sreeramgarapati
April 21st, 2009

I have tried running this but
no luck yet. I downloaded the
zip file and put the gmap.jar
in my forms/java directory.
Also put it in my archive in
the formsweb.cfg but when I
run the form and press the
button nothing happens. What
could be the issue?

Syed
June 9th, 2009

@Syed: make sure that you are using the signed jar. If you do use it, rename it to gmap.jar and then put it in the java folder (of your devsuite if you are using that path). Also, modify the formsweb.cfg in the archive_jini and add gmap.jar

For more debugging help, double click on the java console (you can find it in the windows tray bar if you use windows) and see what the messages are. If you want, post them here and I will try to help.

Hafed
June 9th, 2009

Everything works now as expected. I think the issue had to do with the signed version of the JAR file. But thanks a lot.

Syed
June 10th, 2009

hi Hafed ,
pl,how can i use this Java bean in oracle forms6i .

mudd
June 13th, 2009

hello sir,

My name is Aamir, i am working as Oracle Developer in Doha, Qatar.
Actually sir, i need your help, i wanted to get the static map through longitude and latitude.. i am not using location and anything else. we got address with Google longitude and latitude. Kindly help me with this matter as i am facing problem understanding this java bean.

Thanks and Regards,
Aamir Arif
aamir_ocppk@hotmail.com

Aamir
June 13th, 2009

@mudd: The bean does not work in Client/server mode. You can use it in 9i/10g with IC4j or Oracle app server.

Hafed
June 13th, 2009

@Aamir: the new version takes into account Longitude/Latitude. Did you read the user guide. It explains how to setup the bean with Forms.
Otherwise, what step did you miss ?

Hafed
June 14th, 2009

This does not seem to be in line with http://code.google.com/intl/fr/apis/maps/terms.html

10.8 use the Static Maps API other than in an implementation in a web browser.

So to be used with ‘care’.

Mario
July 16th, 2009

Hello, Everybody
Thanks for the great bean
I’ve implemented it, but when i complier it get this error

Error geocoding from Google. java.net.UnknowHostException: maps.google.com
Could you help me how to configure this error ? who know how to configure please send email to me.

ton_liu@hotmail.com

that’s a very very kind of your

thank you very much..

ps : i’am waiting for answer….

jaroanchai
August 20th, 2009

Hi, I’ve implemented it in my application and it worked fine until a few days ago. I now get the error : Error geocoding from Google. java.io.IOException: Bad Key. It’s on a tabbed canvas. When I go to another tab and back I see the map. What could that be?

Sascha
October 25th, 2009

Hi Hafed

I’m facing the following error: “Error geocoding from Google. java.io.IOException: Legal problem”.

Here is my URL:
http://maps.google.com/maps/geo?q=Bahnhofstrasse,+Wien,+&output=csv&|17|satellite|true|false|ABCDMYKEY

Do you know why this is and is there a workaround?

Simon

Simon
December 10th, 2009

@Simon: make sure to use your own google key

Hafed
December 10th, 2009

Very nice

Arif
February 4th, 2010

Where's The Comment Form?

About

Enterprise IT Tools and Thoughts, dealing mainly with Oracle Developer tools (Forms & Reports)

By Hafed Benteftifa

Recent Comments

RSS

Subscribe Via RSS

  • Subscribe with Bloglines
  • Add your feed to Newsburst from CNET News.com
  • Subscribe in Google Reader
  • Add to My Yahoo!
  • The latest comments to all posts in RSS