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

52

Posted by Hafed | Posted in Forms, oracle, PJCs/Javabeans | Posted on 02-01-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.

Similar Posts:

Comments (52)

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

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

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.

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

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

Thanks

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: 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.

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

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: I will have to check that point. I will get back to you. Thanks

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?

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

@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?

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

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: Here is the best introduction to PJCs and javabeans within Forms: http://sheikyerbouti.developpez.com/forms-pjc-bean/first-bean/first_bean.pdf

@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.

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

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: 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.

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

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

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

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

@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 ?

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’.

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….

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?

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: make sure to use your own google key

Very nice

Hi Hafed,
its nice work.
its working on different map services?

i want integrate with ArcGisServer maps and oracleForms is it possible please tell me.

Hi Hafed,
its nice work.
i want integrate with ArcGisServer maps and oracleForms is it possible please tell me.

Hello Hafed,
This is a great post and help to many like us. I have a similar requirement and you help is highly appreciatble.

I have a form where user enters the address based on the entered address the longitude and lattitude co-ordinates are fetched from the database and these need to be passed into a modal window where google maps should appear with the passed address. Once the user selects a diffrent location on the google map the longitude and lattitude co-ords need to be passed back to the calling form and the address of the new co-ordinates should be shown in the address field.

I will be glad if you could extend your help here.

Hello

Love your bean :)
It’s nice seeing someone working with “legacy” forms…

I have a somewhat differente requirement: I have coordenates (in variable number), but I want to draw a line using them.

Can thios bean be adapted to do so?

@nr: yes, it can be done.

Not Work !: message:

access denied java.net.socketpermission maps.google.com:80

Yes,! Work.
tks

hi Hafed,
I want to use this jb in my project.
I kept the gmap.jar in to forms/java folder.And also updates formsweb.cfg file.
But when i run this form I got the FRM : 92100 error.On clicking Details It shows Error:
java.security.AccessControlException :access denied (java.net.SocketPermission maps.google.com resolve)
How can i solve this error?

Hi, can use with only LATITUDE and LONGITUDE ??

Dears,
I need touse with only LATITUDE and LONGITUDE ??
any help,
Thank you

Hi, can use with only LATITUDE and LONGITUDE ??

Hello Hafed,
Thank you Hafed, and you help is highly appreciatble.

Still wating for your help in using only LATITUDE and LONGITUDE …

I will be glad if you could extend your help here.

It is OK now,
Just fill the LATITUDE and LONGITUDE in the Addr & city field the call the URL
Regards

i used this and getting an error

error geocoding from google “connection lost with 403″… dont really understand why this is not working… plzzz help

Dear Hafed,
I think Google stop the version since sep 2013 , could you update the files please?

Thank you for your great effort.

I am using your GMAP Facility in our forms. And getting this below error when I was run the demo form

“Error geocoding form Google.java.io.IOException: Connection failure with 403”

When the same url if I run in the browser then it will giving the response.

Kindly help me out for the issue.

Thanks in advance.

Sachin Barad

http://maps.google.com/maps/geo?q=&output=csv&sensor=false&key=ABQIAAAAE3WfGRybLGo3GgMf9MvRERQo7gT_lO3wObmJAt4dnZGByIpzGxREhPKSCS7cMD3bG-c2bxqrq-KZxQ|NO POSEE|NO POSEE
network: No se ha encontrado entrada de caché [URL: http://maps.google.com/maps/geo?q=&output=csv&sensor=false&key=ABQIAAAAE3WfGRybLGo3GgMf9MvRERQo7gT_lO3wObmJAt4dnZGByIpzGxREhPKSCS7cMD3bG-c2bxqrq-KZxQ%7CNO%20POSEE%7CNO%20POSEE, versión: null]
network: Conectando http://maps.google.com/maps/geo?q=&output=csv&sensor=false&key=ABQIAAAAE3WfGRybLGo3GgMf9MvRERQo7gT_lO3wObmJAt4dnZGByIpzGxREhPKSCS7cMD3bG-c2bxqrq-KZxQ%7CNO%20POSEE%7CNO%20POSEE con proxy=HTTP @ ap-server-22.sodexho-pass.com.ve/10.58.10.254:8080
network: No se ha encontrado entrada de caché [URL: http://maps.google.com:80/crossdomain.xml, versión: null]
network: Conectando http://maps.google.com:80/crossdomain.xml con proxy=HTTP @ ap-server-22.sodexho-pass.com.ve/10.58.10.254:8080
network: No se ha encontrado entrada de caché [URL: http://maps.google.com:80/crossdomain.xml, versión: null]
network: Conectando http://maps.google.com:80/crossdomain.xml con proxy=HTTP @ ap-server-22.sodexho-pass.com.ve/10.58.10.254:8080
java.io.IOException: Authentication failure
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.deploy.net.CrossDomainXML$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.net.CrossDomainXML.privilegedConnect(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.check(Unknown Source)
at com.sun.deploy.net.CrossDomainXML.check(Unknown Source)
at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at oracle.forms.jv.StaticGMap.getGeocoding(StaticGMap.java:220)
at oracle.forms.jv.StaticGMap.setProperty(StaticGMap.java:148)
at oracle.forms.handler.ComponentItem.setCustomProperty(Unknown Source)
at oracle.forms.handler.ComponentItem.onUpdate(Unknown Source)
at oracle.forms.handler.JavaContainer.onUpdate(Unknown Source)
at oracle.forms.handler.UICommon.onUpdate(Unknown Source)
at oracle.forms.engine.Runform.onUpdateHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
at oracle.forms.engine.Runform.onMessage(Unknown Source)
at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source)
at oracle.forms.engine.Runform.startRunform(Unknown Source)
at oracle.forms.engine.Main.createRunform(Unknown Source)
at oracle.forms.engine.Main.start(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.security.AccessControlException: access denied (java.net.SocketPermission maps.google.com:80 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.plugin2.applet.Applet2SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at oracle.forms.jv.StaticGMap.getGeocoding(StaticGMap.java:220)
at oracle.forms.jv.StaticGMap.setProperty(StaticGMap.java:148)
at oracle.forms.handler.ComponentItem.setCustomProperty(Unknown Source)
at oracle.forms.handler.ComponentItem.onUpdate(Unknown Source)
at oracle.forms.handler.JavaContainer.onUpdate(Unknown Source)
at oracle.forms.handler.UICommon.onUpdate(Unknown Source)
at oracle.forms.engine.Runform.onUpdateHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
at oracle.forms.engine.Runform.onMessage(Unknown Source)
at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source)
at oracle.forms.engine.Runform.startRunform(Unknown Source)
at oracle.forms.engine.Main.createRunform(Unknown Source)
at oracle.forms.engine.Main.start(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Hi Team,

We had implemented Geocoding API in our application. It was working fine till we had Java 1.7 version. After upgrading to Java 1.8 version, application started throwing security pop up. To resolve the security pop Up we signed the Jar files with CA certificate, but after signing JAR files it stops working properly. Locator gives incorrect results. Seems like after signing Java code does not work properly.
Is there a new version of API that needs to be implemented with Java 1.8 version or we need to customize something in existing Jar/ Java code to make it work.

Write a comment