[Google Services] Discussion

Forge Component
Published on 2014-11-05 by Labs
13 votes
Published on 2014-11-05 by Labs
Com o google maps pode-se obter as coordenadas ao clicar no mapa?
I was palying around a bit with the google component and found the following:
1- the centerlatitude and centerlongitude are in the wrong order, well you can easily fix that  (GoogleMaps espace->googlemap webblock->google map generation expression->expression property  and change

.setCenter(new GLatLng(" +  CenterLongitude + ","+ CenterLatitude  + "),   etc

to this
.setCenter(new GLatLng(" +  CenterLatitude + ","+ CenterLongitude  + "),   etc

Now, when you add some polylines to the map and also add for instance an action to be executed every couple of seconds, using for example a javascript  setInterval("func;", 10000);, you get a "failed" error, at least in IE browser.

It happens with list_lateload from richwidgets as well.
Ok this is what i mean;

Suppose you have the  googlemaps component in your page, but you want to keep track of movement (your points are moving in time and you want to see their position changing over time in your google map), furthermore, you want to draw the lines.

Well, you can draw the polylines on the map, and add new coordenates to the polylines overtime. But to do that you need an action that is fired every soo seconds, lets say 30 seconds.
The problem is that when you add that action (fired for example with the setinterval javascript function), IE browser - it seems to work fine in firefox - immediatelly sends the following error box

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.5; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Fri, 19 Nov 2010 12:48:46 UTC

Message: Failed
Line: 451
Char: 23
Code: 0
URI: http://maps.gstatic.com/intl/pt-PT_ALL/mapfiles/285c/maps2.api/main.js

also  the error feedback message box also says:

An exception occured in the client script

Error: failed 

The same happens if you use the list_lateload action from richwidgets to load the polylines to the map or even in the tablerecords


Fernando Duarte

Hi Fernando,

It seems like you're doing some interesting things with our Google Maps component, I'm interested in seeing how it turns out to be!

However, for such an issue, I would research in Google, since it seems to be a problem with IE and Google Maps directly, namely because of its DOM changes handling, and not an Agile Platform related one. Unless someone has actually faced that same problem, I guess we can only give you some generic pointers about how to try and get it to work.

I've found two links reporting similar situations that you might want to look into:

ASP.NET Polyline Javascript Error


IE problem with polyline

I hope these help, or at least get you in the right direction.

Let us know if you manage to work it out, and let us know how you did it!


Paulo Tavares
Thanks Paulo

I'll look into it.


Fernando Duarte
hi all,

It's very nice but who is the documentation? Arguments description for GoogleMap and GoogleMapBallon Web Block?


i've re-written the Googlemaps implementation using the latest googlemaps JS-api.

I needed to be able to click on the map, and retreive the clicked coordinates back into the platform to create polylines interactively.

Also, I needed the possibility to show KML files on the google map.

I'll be uploading this new implementation to the network when I have had time to clean it up a bit, but if anyone needs the mentioned features sooner just let me know ;)

Great job Hans, and thanks for sharing it!

Let us know if you need anything in order to publish it in the Network :)


Paulo Tavares
Is it possible to change the language of google maps like "híbrido" to "hybrid"?
Hello, I would like to measure a distance from one known address to any new possible address collected during a phone interview. I am looking to present the end user with the distance between their address entered and one of our 9 locations. 

your thoughts, ideas are greatly appreciated. Also, if anyone is freelancing and would like to take on small project we can discuss it further over email/phone.

Thanks, Nabil Ismail 
Hello Nabib, 

does not sound too complicated:

- lookup the lat/lon coordinates using the google api, and calculate the distance would be the easiest option.

If you need to calculate the route over the road, I believe google also has an API for that.

For the first solution, I can give you an easy example if you like.

Thank you very much for the fast response. an example would be great! I am new to the platform and I am loving it!

Thanks, Nabil
I'm definitely going to need this.  Mapping is a big part of our apps.  Over time, it will become a big part of everyone's apps.

I didn't see a response to the question regarding an English version.   Is there a switch for this component to have it use English?      Thank you.
Frank -

It works fine in English, with no modifications needed. The map language is based on your browser settings, it looks like. To try the sample, you'll need to work backwards a little since the code is old and needs to be updated:

1. Download the whole thing, and use the Solution Tool to extract it locally.
2. Open the extensions in the following order, upgrade them, and publish them:
a. MathHelper
b. GoogleMarkers
3. Open the GoogleMaps OML file, upgrade it, publish it (refresh the references when you do)
4. Open the GoogleMaps_Sample solution, upgrade it, publish it (refresh the references when you do)
5. Run the GoogleMaps_Sample solution.

Dear all,

I've just updated the Google Maps component for use with Google API V3 (http://code.google.com/apis/maps/documentation/javascript/)

@Hans de Vries: I only read your post after finishing this version; let me know if you find anything missing.

@Sérgio Gonçalves: Argument descriptions were added for web screen and webblocks.

Have fun!
Hello Everyone, is it possible that someone that already worked with this solution , can make a small explanation on how can i relate a address on the Table Records Colum [ Address ]and put a action there that on click the address on the Table goes like a search string value to the google component . and show on the map below were is the current address that the user just click.
Hello everybody.

I'm an absolute newbie in what concerns the Outsystems technology, although I'm pretty familiar with its concepts and approaches.

I'm trying to understand if Outsystems, with this Google Maps component, would be appropriate for a specific task that would require an intensive use of the map component. As an example, imagine that one would like to track a fleet of trucks, being able to place them on the map, to click them and to retrieve information, to draw paths in the map and so on.

I would also like to know if any other technologies are supported (I'm interested in Openlayers)

Thanks :)
Jorge -

Google switches stuff around so often, any answer given today will not be true tomorrow. Some things to keep in mind though, when discussing a Google service:

* Google changes things frequently
* Google tends to allow API users lots of access at first, and narrows that access over time to restrict you to activities that make them money
* If Google can't make money on your use of the system, do not expect that you will be able to use the system like that in the future

In other words, don't build a commercial application on Google Maps even if you can do what you want. Instead, use a service that won't be changing things in 6 months and destroy your application. You really want to be using something like Microsoft MapPoint for this, trust me. It's better for your purpose AND it's not going to suddenly be shut down on you tomorrow, even if Microsoft ends it your license will still work.

Thanks Justin.
One of my concerns is exactly the Google Terms of Service, which implies that a commercial application can not rely on its service. That's why I am considering open layers the application interface to the map service.

I will analyze the MS MapPoint solution - thanks for the suggestion.
Anyone tested with ajax refresh map? it seems that doesnt work

Is it possible to save large map instead of what appear in the screen.
I found below link useful but the images i saved using the firefox add
on can't be open(blank images)
Do someone know a better option/method of saving large images

Hi - I have just tried to install the GoogleMaps to my V6 platform .... it failed, badly. Should it work on V6, are there prerequistes for the install?
I've got an error when I try to publish the extension to my server, as it is the version and he says that Service Pack Tool
Should I donwgrade my version or is there any way to go arround this problem ?

Found a way arround it.

 @ Peter Thirlby, this may solve your problem:
Go to Service Center, and upload the Solution pack from there.
Anyone has a solution with ajax refresh map?
The version of this component that used the API V2 had an cool feature that was the GoogleMapsCoordenatesPicker.

Any chance it will be done with this 3rd version of the API?

Best regards,
Where and how do you plug in the API for this?
This doesn't seem to work with https. Any thoughts?

the webblock "GoogleMap_ScriptInclude"
does not take into account if the connection is via http or https.

In my example I am going through https and the script will fail to load. (I have changed the script with isSecureConnection)

furthermore, after I have fixed it, the console complains about
"Warning: you have included the Google Maps API multiple times on this page. This may cause unexpected errors. "

I did not check that yet

Hello everyone..
Can anybody tell me how can I refresh the google maps widget using Ajax?
I just can put it working using submit, but need to use with Ajax..

Hi Nuno,

As a matter of fact I had this issue today and didn't had time to check for a workaround.
So if anyone have a solution, I would be very thankful to..
I try to refresh it with a new address from a list, by selecting a radio button..

Kind Regards,
Hello Nuno and Gonçalo,

I found a solution that will work, you just need to add a RunJavascript() action inside your screen action and remove the ajax call, after you just need to add the following JS code in the run javascript action:

map_map.setCenter(new google.maps.LatLng(39.7501847,-7.9246712));
"map = name of your map"

You have more options here: https://developers.google.com/maps/documentation/javascript/reference?csw=1#LatLng

Can we have this action included in the component code?

Kind Regards,
Hugo Pinheiro
Hello Hugo,

This moorning I also found a resolution very similar.
I use a script like the following to refresh/redraw the map, instead of using the Ajax refresh:

map_map= null;
map_coder = new google.maps.Geocoder();
map_map = new google.maps.Map(document.getElementById('" + DivId + "'), null);
showMarkerWithIcon(map_map,map_coder,'" + Address + "','',true,createGIcon('','',0,0,0,0));
Where the divId is the identifier of the container where the map is enclosed and the Address is the updated address, in each step.
It's working like a charm :)

Kind Regards,
Gonçalo M.
Works for me too :)
Tks a lot