aglaforge's Google Maps API

1 view
Skip to first unread message

mfuller

unread,
Jul 18, 2007, 7:35:04 AM7/18/07
to Google Web Toolkit
I've been trying out aglaforge's very nice library Google Maps API
http://sourceforge.net/projects/gwt/ . I was wondering if anyone has
an example of using a custom map with this library.

Thanks.

loewen...@googlemail.com

unread,
Jul 19, 2007, 3:18:34 AM7/19/07
to Google Web Toolkit
I'm looking for an example as well. Trying now for a while to get
a custom map working but I'm totally lost with the JSNI syntax.
If you find a way to get a custom map running, please let me know!

Have a nice day!

Frederik

On Jul 18, 1:35 pm, mfuller <davout1...@gmail.com> wrote:
> I've been trying out aglaforge's very nice library Google Maps APIhttp://sourceforge.net/projects/gwt/. I was wondering if anyone has

mfuller

unread,
Jul 19, 2007, 4:35:55 AM7/19/07
to Google Web Toolkit
I could be wrong, but with the library I don't think you need to use
the JSNI.

On Jul 19, 3:18 am, "loewenspr...@gmail.com"

krispy

unread,
Jul 19, 2007, 10:05:36 AM7/19/07
to Google Web Toolkit
mfuller is right, you don't need JSNI:

1) create a custom tile layer - extend the GAbstractTileLayer class
and implement the methods isPng(), getOpacity(), and getTileUrl()
2) create a GCopyright to pass to the tile layer's constructor (the
API will put your copyright over your tiles)
3) add the tile layer to either a new GMapType or a new
GTileLayerOverlay
4) add the new map type or the new overlay to the map

I just helped Frederick with this:

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/4908a9884c4802f0/9d1e0cccc587b97b#9d1e0cccc587b97b

Feel free to ask more questions if this doesn't make sense - HTH!

-krispy

Romain

unread,
Jul 19, 2007, 10:14:44 AM7/19/07
to Google Web Toolkit
Hi,

We are using this very well done library on our project : a huge
collaborative wiki project of world description
You can see it live here : http://tellmewhere.com

Regards,
Romain
http://tellmewhere.com
http://dismoiou.fr

On 18 juil, 13:35, mfuller <davout1...@gmail.com> wrote:
> I've been trying out aglaforge's very nice library Google Maps APIhttp://sourceforge.net/projects/gwt/. I was wondering if anyone has

mfuller

unread,
Jul 20, 2007, 7:51:41 AM7/20/07
to Google Web Toolkit
Thanks. But I'm still having problems. Right now I'm just trying to
display my image, no panning of the image. Any help is greatly
appreciated. It compiles and runs, but it displays the map of Palo
Alto. Thanks.

Here is my GoogleMap.html:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-
microsoft-com:vml">
<head>
<title>GoogleMaps Application</title>
<meta name='gwt:module'
content='com.wikidot.davout.googleMaps2.GoogleMaps'>
<link rel=stylesheet href="GoogleMaps.css">
<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;key=ABQIAAAAXvSq2pmB72gJN9HTc6vRGhTwM0brOpm-
All5BF6PoaKBxRWWERSph8E1pMO_32yVZ7DPQYhLBLJ2NA"
type="text/javascript"></script>

<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>

</head>
<body>
<script language="javascript" src="gwt.js"></script>
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></
iframe>
<h1>GoogleMaps Application</h1>

<div id="map">

</div>
</body>
</html>

image.gif is in the public directory with the html page

Here is my entry point class:
public class GoogleMaps implements EntryPoint {
public void onModuleLoad() {
final GMap2Widget mapWidget = new GMap2Widget();
mapWidget.setHeight("400");
mapWidget.setWidth("400");
RootPanel.get("map").add(mapWidget);
GMap2 map = mapWidget.getGmap();

GCopyright copyright = new GCopyright(0, new GLatLngBounds(new
GLatLng(0.0, 0.0), new GLatLng(4.0, 4.0)), 0, "copyright");
GCopyrightCollection copyrightCollection = new
GCopyrightCollection();
copyrightCollection.addCopyright(copyright);
GTileLayer tileLayer = new GTileLayer(copyrightCollection, 0,
5);
GTileLayerOverlay tileLayerOverlay = new
GTileLayerOverlay(tileLayer);
map.addOverlay(tileLayerOverlay);
}
}

And my CustomTileLayer class:
public class CustomTileLayer extends GAbstractTileLayer {
public CustomTileLayer(GCopyrightCollection gCopyrightCollection,
int i, int i1) {
super(gCopyrightCollection, i, i1);
}


public String getTileUrl(GPoint gPoint, int i) {
return "image.gif";
}

public boolean isPng() {
return false;
}

public double getOpacity() {
return 1.0;
}
}

On Jul 19, 10:05 am, krispy <cplum...@integrity-apps.com> wrote:
> mfuller is right, you don't need JSNI:
>
> 1) create a custom tile layer - extend the GAbstractTileLayer class
> and implement the methods isPng(), getOpacity(), and getTileUrl()
> 2) create a GCopyright to pass to the tile layer's constructor (the
> API will put your copyright over your tiles)
> 3) add the tile layer to either a new GMapType or a new
> GTileLayerOverlay
> 4) add the new map type or the new overlay to the map
>
> I just helped Frederick with this:
>

> http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...

krispy

unread,
Jul 20, 2007, 10:06:40 AM7/20/07
to Google Web Toolkit
This line is the problem:

GTileLayer tileLayer = new GTileLayer(copyrightCollection, 0, 5);

You need to use your custom tile layer! How else is the map supposed
to figure out where your tile images are? You should replace the
above with:

CustomTileLayer tileLayer = new CustomTileLayer(copyrightCollection,
0, 5);

-krispy

Mike Fuller

unread,
Jul 20, 2007, 10:49:00 AM7/20/07
to Google-We...@googlegroups.com
Duh! You're a genius. Thanks.
Reply all
Reply to author
Forward
0 new messages