Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Google map addon
Use this thread from now on when discussing the map addon.
I just updated the Google map addon to version 0.9.2. It includes the following enhancements implemented by Petri Heinonen:
- Added methods for removing a single marker and all markers
- Added handler to catch marker move events that fires when a marker has been dragged to a new location. The coordinates are also available at server side from the Marker object. (feature sponsored by Propentus Oy)
- Added handler to catch marker click events, works only if marker has information window content for now.
Please give it a spin and report any problems on this thread.
New version 0.9.3 is up. It has no functional changes, but instead it is now Java 1.5 compatible.
Thanks Petri!
Thank you very much!
And how about the function to provide Google Map key, instead of modifying GWT configuration.
Kai Cao: And how about the function to provide Google Map key, instead of modifying GWT configuration.
I'm afraid that there is no schedule for the missing features, and I don't know when someone will have the time to work on them. However, if you need the feature quickly, could your company consider sponsoring it? Contact ville.ingman@itmill.com for more information and a quote.
0.9.4 is up. Still no functional changes, just more Java 1.5 related fixes. Also tested it briefly with IE6 and added it as a compatible browser.
hey henry, where can i download the latest version? I've checked the official svn repo but coulndt find it.
do you also knwo that the since today an error about the api key is displayed?
I've got an idea, I would like to update a position on the map, initialted by the server (aka server push). is this possible with the current map plugin?
michael vogt: hey henry, where can i download the latest version? I've checked the official svn repo but coulndt find it.
You can find both the ZIP package and source link from the Directory page for the add-on.
do you also knwo that the since today an error about the api key is displayed?
The API key is required to deploy to a production server. If the key is missing a warning message is displayed when the page is loaded, but the map should work just fine. I'm not aware of any recent change to this, and the live demo seems to work.
If you want to get rid of the message just get a API key for your domain, specify it in the widgetset XML and recompile the widgetset.
I've got an idea, I would like to update a position on the map, initialted by the server (aka server push). is this possible with the current map plugin?
I'm afraid Vaadin does not (yet) include a server push mechanism, but you can easily get similar functionality using the refresher add-on.
thanks for your quick reply. in the add on directory is the lastest versuib 0.9.3.
michael vogt: thanks for your quick reply. in the add on directory is the lastest versuib 0.9.3.
Yes, that's the current version.
Hi!
I've just finished trying your add-on just two minutes ago. For me there is no joy with any of the add-ons, if on GlassFish/Liferay. :unsure: Everything looks as same as in this post that I've made for a while ago with the only difference that I am no more getting pop-up alert, but built-in nag-screen, as follows on the screen-shot below.
And by the way, any support of their usage in NetBeans instead of Eclipse, please? :smug:
Henri Muurimaa: 0.9.4 is up. Still no functional changes, just more Java 1.5 related fixes. Also tested it briefly with IE6 and added it as a compatible browser.
Henri Muurimaa:
michael vogt: thanks for your quick reply. in the add on directory is the lastest versuib 0.9.3.
Yes, that's the current version.
I'm confused :S
Bo M: I've just finished trying your add-on just two minutes ago. For me there is no joy with any of the add-ons, if on GlassFish/Liferay. :unsure: Everything looks as same as in this post that I've made for a while ago with the only difference that I am no more getting pop-up alert, but built-in nag-screen, as follows on the screen-shot below.
I think that your map addon issue will be fixed when you manage to resolve the problem in the abovementioned post.
Dale Wijnand: I'm confused :S
Ah yes, 0.9.4 was uploaded but not published, sorry. My mistake, but it's published now.
Hi Henri,
this looks like a great component, congrats.
But I'm noob with Widgets, so I tried a lot of things to make your component work, but nothing works.
Could you give me a help?
Is there any demo source? Tutorial? Steps?
I'm using eclipse with the vaadin plugin.
thanks.
I have already put the JARs in the WEB-INF/lib. And when I click the button "Compile Vaadin Widgets" I have this message:
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder.updateWidgetSet(WidgetSetBuilder.java:60)
at com.vaadin.tools.WidgetsetCompiler$1.run(WidgetsetCompiler.java:56)
at java.lang.Thread.run(Thread.java:619)
Do you know what it stands for?
JoaoGalli : I have already put the JARs in the WEB-INF/lib. And when I click the button "Compile Vaadin Widgets" I have this message:
java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder.updateWidgetSet(WidgetSetBuilder.java:60)
at com.vaadin.tools.WidgetsetCompiler$1.run(WidgetsetCompiler.java:56)
at java.lang.Thread.run(Thread.java:619)Do you know what it stands for?
Another Henri answering to this...
As there is no widgetset in your project, the widgetset builder tries to create one. This fails due to one of two possible reasons: the source directory is not writable or the widgetset is being created in the wrong directory. Also the web.xml file needs to be writable when creating a widgetset, but according to the stack trace the execution wasn't that far yet.
If you suspect the latter might be the issue, try moving your main source path first on your classpath and retry.
If all else fails, create a MyWidgetset.gwt.xml with the e.g. contents given below (also an almost empty XML file with just the root "xml" element should work) at the location of your choice within your source tree. Note that any custom widgets you may develop in the future will be in subpackages of that location. Then select the file in Eclipse and click the compile button again. This way, you are explicitly saying where the widgetset is.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />
<!--
Uncomment the following to compile the widgetset for one browser only.
This can reduce the GWT compilation time significantly when debugging.
The line should be commented out before deployment to production
environments.
Multiple browsers can be specified for GWT 1.7 as a comma separated
list. The supported user agents at the moment of writing were:
ie6,ie8,gecko,gecko1_8,safari,opera
The value gecko is used for Firefox 3 and later, gecko1_8 is for
Firefox 2 and safari is used for webkit based browsers including
Google Chrome.
-->
<!-- <set-property name="user.agent" value="gecko"/> -->
</module>
For a very brief tutorial (which does more or less what you did), see here.
Hi Henri!
Congratulations to you googlemap add-on.
Unfortunatelly I have a problem with MarkerClickListener.
I added this Code, but the method never fires. Do you have an idea?
googleMap.addListener(new MarkerClickListener()
{
@Override
public void markerClicked(Marker clickedMarker)
{
System.out.println("Clicked: " + clickedMarker.getTitle());
}
});
I don't know why, but it works now ;-). Sorry for possible annoyence.
Hi Henri,
thanks for your reply.
I could noticed that the gwt.xml file is being created, although the error in the stack trace seems to be in creating it,
there I could see that the INHERITS for the GoogleMap widgetset is not inserted:
"<inherits name="org.vaadin.hezamu.googlemapwidget.widgetset.GooglemapwidgetWidgetset" />"
I think it couldn't edit the file, but I took all the precautions you told.
So I decided to try it in new Vaadin project and it has worked fine.
Don't no why in my main project it doesn't work, have a clue?
Henri,
maybe I found a bug.
I tried with a lot of new Vaadin Projects, to find out what is the error,
and it seems to get this error when the project package is too big. Like:
br.com.uniblanc.client.vaadin
I tried with uniblanc.vaadin" and it works. Both were new projects. :wacko:
hi everyone!
i'v a interesting problem when i use the marker draggable function:
BasicMarker.setDraggable(boolean);
when i first set marker draggable true ,and then set draggable false, all are correct,but
when i first set marker draggable false, and then set draggable true,the marker cann't move.i must refresh the browser to get the correct result.
do you meet the problem?or mybe i 'v do something wrong?
Henri,
where to configure the Google Maps API key?
I haven't found where.
JoaoGalli: where to configure the Google Maps API key?
I haven't found where.
There is a new version being tested that includes an constructor that takes the API key. It will be published probably later this week.
The feature was kindly sponsored by Propentus Ltd.
For more info on sponsoring add-on features see this post.
I've noticed a possible bug.
It happens only on IE.
If I add many markers to a map when initing the view IE seems to just give up drawing markers on map.
With many I mean anything between 7 and 1000, it usually works on smaller amounts, but 1000 takes very long to show up, or then nothing happens. All other browser manage to show the markers.
So I was wondering if calling this method in GoogleMap for 1000 times in a loop
causes 1000 requestrepaints and chokes IE?
public void addMarker(Marker marker) {
if (markerSource == null) {
markerSource = new BasicMarkerSource();
}
markerSource.addMarker(marker);
requestRepaint();
}
And if I could work around it with (haven't tried it yet):
MarkerSource source =new BasicMarkerSource();
for(...){
source.addMarker(newMarker)
}
googleMap.setMarkerSource(source)
Or is this just IE-related stuff that can't be worked around?
Hi,
(Disclaimer: I don't know about the Google map addon specifically)
That is server-side code, right? Calls to requestRepaint() do not actually cause anything to happen in the browser directly, it just marks the component as "dirty" so that the updates get sent to the client with the next response. I.e you can call requestRepaint() as often as you like; it's quite inexpensive, and calling it multiple time vs once will have the same effect in the browser.
Best Regards,
Marc
requestRepaint() just marks the component as "dirty" which will cause it to be rendered at the end of the request. This means that calling repeatedly within a request has no effect over calling it once.
The problem is probably that the browser chokes on the amount of marker draw commands.
One way to circumvent it is not to use BasicMarkerSource, and implement a lazy MarkerSource that will only send visible markers to the client.
So, there is no way to put a new GMaps key in this 0.9.4 version?
Joao Eduardo Galli: So, there is no way to put a new GMaps key in this 0.9.4 version?
You can put it into the script tag in the widgetset XML. Note that you need to compile your widgetset after the change.
Ok Henrii, but this is my problem, I tried to put it in the widgetset.xml from my project. But it doesn´t work.
Is this right, or I must put it in the widgetset.xml from your project/addon?
"org.vaadin.hezamu.googlemapwidget.widgetset.GooglemapwidgetWidgetset"
How should it be in the xml?
Would it be like this?
<script src="http://maps.google.com/maps?gwt=1&file=api&v=2.x&key=<myKeyHere>" />
thanks again
Henrii, any help on my last reply?
thanks
Joao Eduardo Galli: Ok Henrii, but this is my problem, I tried to put it in the widgetset.xml from my project. But it doesn´t work.
Is this right, or I must put it in the widgetset.xml from your project/addon?
"org.vaadin.hezamu.googlemapwidget.widgetset.GooglemapwidgetWidgetset"How should it be in the xml?
Would it be like this?
<script src="http://maps.google.com/maps?gwt=1&file=api&v=2.x&key=<myKeyHere>" />thanks again
Yeah, that's the script tag you need to add, and it goes into your app's widgetset.xml, it should work there.
Anyway we hope to get the new version with a API for the key out in the beginning of next week.
Joao Eduardo Galli: maybe I found a bug.
I tried with a lot of new Vaadin Projects, to find out what is the error,
and it seems to get this error when the project package is too big. Like:
br.com.uniblanc.client.vaadinI tried with uniblanc.vaadin" and it works. Both were new projects. :wacko:
Just a guess, but the problem might be the "client" part of the package name, which has a special meaning for GWT - at least under a directory containing a GWT module, unless you say otherwise in the GWT module.
Due to this, it might also be treated specially by the Eclipse plugin in some cases (I cannot recall) - but maybe also in cases where it should not be.
Hi Mr Henri ,
I'm a new beginner on the Vaadin framework, actually I'm processing into the Googlemap addon.
I'm using the netbeans version 6.8 , after inserting the package (2 jars) and recompiling them into my project I wrote this short code , figuring below,to test the addon.
/*
* MyApplication.java
*
* Created on May 28, 2010, 7:44 AM
*/
package com.example.vaadin;
import com.vaadin.Application;
import com.vaadin.ui.*;
import java.awt.geom.Point2D;
import org.vaadin.hezamu.googlemapwidget.GoogleMap;
import org.vaadin.hezamu.googlemapwidget.overlay.BasicMarker;
public class MyApplication extends Application {
@Override
public void init() {
Window mainWindow = new Window("MyApplication");
// Create a new map instance centered on the IT Mill offices
GoogleMap googleMap = new GoogleMap(this, new Point2D.Double(22.3, 60.4522), 8);
googleMap.setWidth("640px");
googleMap.setHeight("480px");
// Create a marker at the IT Mill offices
googleMap.addMarker(new BasicMarker(1L, new Point2D.Double(22.3,
60.4522), "Test marker"));
mainWindow.addComponent(a);
mainWindow.addComponent(googleMap );
setMainWindow(mainWindow);
}
}
Unfortunately the system display an internal error, could you help me to under pass this pb.
thx for your help and your time best regards.
Me is sitting and clicking on click here and nothing happens. :) I mean, all the interesting stuff is actually buried in your server's logs. Maybe better to post its traceback contents here in the meanwhile, please?
F.L elanouar: Hi Mr Henri ,
Which one? ;)
F.L elanouar: I'm a new beginner on the Vaadin framework, actually I'm processing into the Googlemap addon.
I'm using the netbeans version 6.8 , after inserting the package (2 jars) and recompiling them into my project I wrote this short code , figuring below,to test the addon.
Just to check, did you recompile the widgetset as explained e.g. here for NetBeans.
Hi! , i'm new on vaadin ... just a few days and now i'm in love !.
Everything is working ok , but i found that when i add marker to the map only the first one is actually drawed , i try a couple of things like using "addmarker" ,"markersource" , "basicmarkersource" , using the refresher add-on , but only the first marker is drawed , once the marker is on the map i can delete it , but it's not drawed again when i try to do it.The refresher add-on works fine , as i can do zoom o position changes on time intervals , etc.
The problem is the same with polyoverlay , any help on this ?.Thanks.
Hi,
which version of Google Maps API is used by this library?
Morgan Eugenne Potter: Hi! , i'm new on vaadin ... just a few days and now i'm in love !.
Everything is working ok , but i found that when i add marker to the map only the first one is actually drawed , i try a couple of things like using "addmarker" ,"markersource" , "basicmarkersource" , using the refresher add-on , but only the first marker is drawed , once the marker is on the map i can delete it , but it's not drawed again when i try to do it.The refresher add-on works fine , as i can do zoom o position changes on time intervals , etc.The problem is the same with polyoverlay , any help on this ?.Thanks.
This sounds like a bug. Which browser are you using?
Michal Stehlik: which version of Google Maps API is used by this library?
Behind the scenes it uses the official gwt-maps wrapper which currently only supports the API version 2.
Hi, I had the same problem!! It was a simple code error!!
Do you remember to change the long param?
BasicMarker bm1=new BasicMarker(1L, new Point2D.Double(1.200,1.300), "Test1");
BasicMarker bm2=new BasicMarker(2L, new Point2D.Double(0.200,0.300), "Test2");
BasicMarker bm3=new BasicMarker(3L, new Point2D.Double(0.700,0.900), "Test3");
googleMap.addMarker(bm1);
googleMap.addMarker(bm2);
googleMap.addMarker(bm3);
Hi , i've been out of the city a few days so i can't read the forum , i fixed the problem , it seems tha tomcat was the problem because i update to tomcat 6.0.26 and everything works fine , but something new is going wrong .
When i delete a marker or a bunch of them i can't add new marker with the same ID that i delete , for example create a marker with the ID 1L then i delete it and again create a marker with that ID and it's not drawed , is this normal ? or maybe tomcat again ?, and the other thing is the the setvisible() method for a marker it's not working , it's not a big problem just want it to create a blinking mark , but i replace it with an animated icon for the marker.
Thank's for all responses.
Morgan.
Yes....I have the same problem!! If are adding markers and remove them. Can not add a new Marker with the same id.
If you reload the page works again and the markers are drawed.
Is it a bug??
Xavier
Hello,
We have been trying out Vaadin and your Google Map widget in particular for an educational game project, where interaction with a map is our primary functionality. We really like Vaadin, particularly in terms of how rapidly we can develop and prototype, but as the Map is very central to game play, we have a few questions.
I realize that you have stated there isn't a schedule for feature releases, but I wanted to be sure I wasn't missing features that are already there or misunderstanding...
There are some features from Google Maps that don't appear to be implemented at this point - correct me if I am wrong:
- Display satellite images instead of map layers
- Turning off labels (if above)
- The zoom and pan controls that are typically on the left side of a google map
Other questions:
- Is it possible to set the default zoom level when a map is rendered?
- Is it possible to change a marker icon when it is clicked? I have the marker rendering with the icon, and the click event working for the marker, but changing the icon as part of that event doesn't seem to redraw.
Thanks in advance. We are very much hoping to be able to use your component, and by extension this framework, for this project and lots more to come!