on 01-13-2009 4:30 PM
Hi all,
Can someone tell how I can create a Google Url and show this Url in a Iframe in a Web dynpro. I can create an url but I see the google webpage with the map. I just want only see the map in my Iframe!
Kind Regards,
Richard
Hi Kunal,
%20 does not work I used '' instead of <space>. Now have to change the '' to space again in the javascript for the text in the marker!
Kind regards,
Richard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Richard,
visit this link for sample to replace
http://www.w3schools.com/jsref/jsref_replace.asp
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
Actually %20 worked in the sample I test. I had seemingly put of this sort of string - "The%20Taj%20Hotel%20Mumbai"...
Ideally, u can use %20 or +, this to only make sure the well-formedness of URL. You can use any of the character to represent your meaning of space. It doesnot matter afterall unless u make a valid URL out of it..
This aint big hurdle
just google it and you wil sail thru'
http://www.google.co.in/search?hl=en&q=JavaScriptsubstringreplace+example
Edited by: kunal kotak on Jan 19, 2009 9:11 PM
Hi Kunal,
Thank for your support!!!! The only issue is sending the complete address via de parameter! For the rest it works perfectly.
Kind regards,
Richard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kunal Kotak,
Tanks for your input! I still have one issue. My input data like street and city is change during eventing. How can I get my address data in to the html file?
Kind Regards,
Richard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi kunal kotak,
I have build a portal application which is showing me all my outlook contacts. When I select a contact several iViews are triggered by evenenting like Business address. In this iView want to show the business address via Google Maps.
When I select a different contact the Business Address is changed by eventing but I need also change the Google Map. When I test your solution and i works fine when I fill in the addresses in the input fields of the Google Map sample. So If I can send a parameter to your solution I have the solution for my problem.
Kind regards,
Richard
Hi Richard,
One solution that comes to mind is to have a URL parameter embedded. So the path that you have set to the iframe can be extended say for example http://<your path to HTML file in Mimes>?undefined=<address specific to the user>
Next thing to do is extract the URL parameter undefined by JavaScripting. So you can pass the address value to this param.
Once you have this you can trigger this by passing different addresses to URL parameter each time.
Replace the wdDoInit() by following code:
public void wdDoInit()
{
//@@begin wdDoInit()
try {
String resourcePath = WDURLGenerator.getWebResourceURL(wdComponentAPI.getDeployableObjectPart(), "GoogleMapAPI.html");
wdThis.wdGetContext().currentContextElement().setPath(resourcePath + "?undefined=Mumbai");
} catch (WDURLException e) {
wdThis.wdGetAPI().getComponent().getMessageManager().reportException(e.getMessage(),true);
} catch (WDRuntimeException e) {
wdThis.wdGetAPI().getComponent().getMessageManager().reportException(e.getMessage(),true);
}
//@@end
}
Though I have hardcoded the location in above URL, i guess you got what i am indicating at!!
Even after all this, be carefull in preparing the URL which might result invalid URL due to special chars.
For Example: New York will result in invalid URL as <space> is not allowed. Ideally, it would have been New%20York. But then google API will no understand %20. Hence, I recommend you to replace %20 by <space> before calling Google API [You will have to write it in initialize() method of HTML file].
Also, replace the function initialise() in GoogleMapAPI.html
function initialize() {
if (GBrowserIsCompatible()) {
// This function is anonymous, is executed immediately and
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars<i>.split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
query_string[pair[0]] = pair[1];
//this.address.value = pair[1];
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
showAddress(pair[1]);
}
}
I hope your address issue is addressed by me now!!
kunal kotak
Hi Richard,
I have got a solution for you. Follow this steps to locate a city or any place by typing in the name in an input box:
1. Create a iFrame with a context value attribute (type string) to store the path.
2. Copy the below HTML file in your Mimes folder and name the file as say GoogleMapAPI.html
http://code.google.com/apis/maps/documentation/examples/geocoding-simple.html
Open this link in new window. Right click on the page and get the source code. Use it as-is. Only change the key as mentioned in following step #4.
3. Write the code to fetch the path of the above mentioned file in wdDoInit() method of the view.
public void wdDoInit()
{
//@@begin wdDoInit()
try {
String resourcePath = WDURLGenerator.getWebResourceURL(wdComponentAPI.getDeployableObjectPart(), "GoogleMapAPI.html");
wdThis.wdGetContext().currentContextElement().setPath(resourcePath);
} catch (WDURLException e) {
wdThis.wdGetAPI().getComponent().getMessageManager().reportException(e.getMessage(),true);
} catch (WDRuntimeException e) {
wdThis.wdGetAPI().getComponent().getMessageManager().reportException(e.getMessage(),true);
}
//@@end
}
4. Change the key in above HTML file by registering with google. Its free. Sign Up Link= http://code.google.com/apis/maps/signup.html
Please be careful in registering your domain name properly!!
5. Build, Deply and Run.
Note: I have implemented this and so it should work for you.
Caveat Factor: The result will depend on the address you provide in the input box of HTML page. Common places such as major cities, districts, institutions, and other organizations are very well displayed.
For Example: Search for World Trade Center, New York. And you will be happy with the results.
Revert in case you need more info.
Regards,
Kunal Kotak
Edited by: kunal kotak on Jan 15, 2009 12:33 PM
Edited by: kunal kotak on Jan 15, 2009 12:35 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
visit this blog on Google Maps
/people/prem.mascarenhas/blog/2007/12/11/google-map-services-for-your-siteportal
kunal kotak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the solution works please let me know.
Regards.
Rajat
Edited by: Rajat Jain on Jan 14, 2009 4:24 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can simply right click on the link where the google map is shown> View encoding> Create your html or use it in your implementation and provide the link for that.
Hope it helps.
Regards.
Rajat
Edited by: Rajat Jain on Jan 14, 2009 4:21 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, you can do it by using the URL that comes up when you click on the "Link" anchor on the top right of a Google maps page. Don't use the browser URL.
Open the map you want to show in a normal browser window and then click on the "Link" anchor after the "Print | Send" anchors. You will see a HTML to use for embedding that map on a web site. Use the URL that's mentioned in the "src" attribute of the iframe.
Also check [this|http://www.google.com/intl/en/press/annc/embed_maps.html] press announcement by Google.
Regards,
Satyajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.