Google map addon

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?

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?

thanks again

Henrii, any help on my last reply?

thanks

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.

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.
11294.jpg

Me is sitting and clicking on


click here


and nothing happens. :slight_smile: 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?

Which one? :wink:

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?

This sounds like a bug. Which browser are you using?

Behind the scenes it uses the official
gwt-maps wrapper
which currently only supports the API version 2.


Morgan Eugenne Potter:

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!