Issues with newest updates to Google Maps

19 views
Skip to first unread message

Jonathanccwong

unread,
May 10, 2010, 3:11:26 PM5/10/10
to gwt-maps3-discuss
Hi, I've just started a project using gwt and maps v3 for gwt.
I wanted to use the new KmlLayer function from the new JS Maps API,
but I get a "Cannot Read property KmlLayer" of undefined. I was
wondering if there are any thing I am over looking.

The following is in JSNI.
Part of my code is as follows:

//map defined previously

var nyLayer = new google.maps.KmlLayer('sample.kml',
{suppressInfoWindows: true});
nyLayer.setMap(map);
google.maps.event.addListener(ctaLayer, 'click', function(kmlEvent) {
var text = kmlEvent.featureData.description;
$wnd.alert(text);
});

Thanks
Jon

Jonathanccwong

unread,
May 11, 2010, 1:30:33 PM5/11/10
to gwt-maps3-discuss
So I read on other forums that I cannot use a locally hosted KML file.
I changed the source of the KML file to http://www.searcharoo.net/SearchKml/newyork.kml
which is the one on google's example but I still get the same error.

Do I have to do anything else special to include the newly added
functions of the Google Maps JS API?

Thanks
Jon

Jonathanccwong

unread,
May 11, 2010, 1:38:49 PM5/11/10
to gwt-maps3-discuss
After carefully reading the error message, it says
Cannot read property 'KmlLayer' of undefined.
Which leads me to believe that the variable map is undefined.

I have this as my definition:

var map = this.@com.company.mapbase.client.MapBase::getMapObject();
....
....

and this as the getter that returns the map object.

public JavaScriptObject getMapObject(){
//javascript mapWidget getter
return mapWidget.getMap().getJso();

}

Is this the wrong way to pass a map object created from gwt to
javascript?

Jon

On May 11, 10:30 am, Jonathanccwong <jonathanccw...@gmail.com> wrote:
> So I read on other forums that I cannot use a locally hosted KML file.
> I changed the source of the KML file tohttp://www.searcharoo.net/SearchKml/newyork.kml

Vinay Sekhri

unread,
May 11, 2010, 1:49:48 PM5/11/10
to gwt-maps...@googlegroups.com, jonatha...@gmail.com
Hi Jon,

Somehow this mail got archived off my inbox.
GWT library does not currently wrap KmlLayer, neither do I know much about it. Let me look over it and see if I can help. If you would like KmlLayer support, raise a feature request for it on the project page.

Cheers!
Vinay Sekhri
Google India
+91.124.451.2822 Direct
+91.9910.195.609 Mobile

Jonathanccwong

unread,
May 11, 2010, 2:06:08 PM5/11/10
to gwt-maps3-discuss
Hello,

Thank you for your Reply.
I will go ahead and raise a feature.

One thing though I am not clear about is that if I were to use JSNI to
write native javascript,
it should include all functions that is not included in gwt maps api.
So anything that is not implemented in gwt or gwt maps api should
still be accessible via the native javascript api.

Is that assumption correct or am I missing something?

Thanks
Jon

On May 11, 10:49 am, Vinay Sekhri <vin...@google.com> wrote:
> Hi Jon,
>
> Somehow this mail got archived off my inbox.
> GWT library does not currently wrap KmlLayer, neither do I know much about
> it. Let me look over it and see if I can help. If you would like KmlLayer
> support, raise a feature request for it on the project page.
>
> Cheers!
> Vinay Sekhri
> Google India
> +91.124.451.2822 Direct
> +91.9910.195.609 Mobile
>
> On Tue, May 11, 2010 at 11:08 PM, Jonathanccwong
> <jonathanccw...@gmail.com>wrote:
>
>
>
> > After carefully reading the error message, it says
> > Cannot read property 'KmlLayer' of undefined.
> > Which leads me to believe that the variable map is undefined.
>
> > I have this as my definition:
>
> > var map = th...@com.company.mapbase.client.MapBase::getMapObject();

Vinay

unread,
May 11, 2010, 9:07:33 PM5/11/10
to gwt-maps...@googlegroups.com
Yes, JS API is accessible through JSNI. Do not forget to use "$wnd.google.maps" in place of "google.maps".
Reply all
Reply to author
Forward
0 new messages