for the last couple of hours, I try to get a custom map layer running
on the Google Maps Package by Mapitz. I couldn't find any example
Projects or complete tutorials to help me get started with this. I'm
relatively new to GWT and especially the Syntax regarding JSNI totally
confuses me. I have pictures of a region in better resolution than
Google has and would like to put them on top of my application, I
successfully sliced them into tiles including the coordinates and zoom
levels.
The Class that I want to handle my custom layer is not compiling at
all as soon as I implement those JSNI methods. Have to admit that I
don't understand what this syntax is about..
Any help is highly appreciated or just even a link to some tutorial or
example project would be great.
The errors the compiler is throwing:
Error acquiring source for com.myPackage.client.map.client.map.Overlay
The class:
package com.myPackage.client.map;
import com.mapitz.gwt.googleMaps.client.*;
public class Overlay {
public Overlay() {
GCopyright copyright = new GCopyright(1, new GLatLngBounds(new
GLatLng(-90, -180), new GLatLng(90, 180)),0,"©2006 Something.com");
GCopyrightCollection ccollection = new GCopyrightCollection("this is
my nice copyright");
ccollection.addCopyright(copyright);
GTileLayer tilelayer = new GTileLayer(ccollection, 16, 16);
initLayer(tilelayer.getJSObject(), this);
}
public String getTileUrl(int x, int y, int zoom)
{
int z = zoom;
String f = "/maps/?x="+x+"&y="+y+"&zoom="+z;
return f;
}
public String getOpacity(){ return "adas";};
private native void initLayer(JSObject layer, Overlay tileUrlHandler)
/*-{
layer.getTileUrl = function(t,z)
{
return m...@com.myPackage.map.Overlay::getTileUrl(III)
(t.x, t.y, z);
};
layer.isPng = function()
{
return true;
};
layer.getOpacity = function()
{
return m...@com.myPackage.map.Overlay::getOpacity()();
};
}-*/;
}
Hi There,
for the last couple of hours, I try to get a custom map layer running
on the Google Maps Package by Mapitz. I couldn't find any example
Projects or complete tutorials to help me get started with this. I'm
relatively new to GWT and especially the Syntax regarding JSNI totally
confuses me. I have pictures of a region in better resolution than
Google has and would like to put them on top of my application, I
successfully sliced them into tiles including the coordinates and zoom
levels.
The Class that I want to handle my custom layer is not compiling at
all as soon as I implement those JSNI methods. Have to admit that I
don't understand what this syntax is about..
Any help is highly appreciated or just even a link to some tutorial or
example project would be great.
The errors the compiler is throwing:
Error acquiring source for com.myPackage.client.map.client.map.Overlay
The class:
package com.myPackage.client.map;
import com.mapitz.gwt.googleMaps.client.*;
public class Overlay {
public Overlay() {
GCopyright copyright = new GCopyright(1, new GLatLngBounds(new
GLatLng(-90, -180), new GLatLng(90, 180)),0,"(c)2006 Something.com");
1) extend the GAbstractTileLayer class with your own.
2) implement the getOpacity(), isPng(), and getTileUrl() functions
3) make the copyright like you do above and add it to your custom tile
layer
4) add the custom tile layer to a new GMapType OR add the custom layer
to a new GTileLayerOverlay (the difference is that the GMapType will
create a button next to the "Satellite" and "Hybrid" buttons which
will only show your tiles when clicked, but the GTileLayerOverlay will
just make an overlay on top of the existing GMapType tiles).
Feel free to ask any more questions - HTH!
-krispy
On Jul 18, 7:38 am, "loewenspr...@gmail.com"
Is this going to be created using the JSNI wrapper stuff that Bob V.
has been doing on the Contributors forum? If so, it ought to be very
interesting - it's one of those things that I've been waiting in
anticipation for. The ability to wrap any Javascript library without
any JSNI needed would be an incredible addition to GWT - I've also
thought before that this could work in conjunction with Ray Cromwell's
Exporter to produce "instant" GWT APIs that 3rd party developers could
create plug-in applications with. Anyways, I'm excited to see what's
coming up next - keep up the great work!
-krispy
On Jul 19, 8:43 am, "Miguel Méndez" <mmen...@google.com> wrote:
> FYI, we are working on a version of the Maps API which will be part of the
> gwt-google-apis <http://code.google.com/p/gwt-google-apis/> project. This
> is one of the use cases that we are considering. I would expect the
> discussion on this version of the Maps API to start rolling within the next
> week or so; once the next 1.4 RC takes shape.
>
> Stay tuned.
>
> Cheers,
>
> --
> Miguel
thanks again for your kind help. I followed the steps you recommended
and I am some steps further now. Now the compiler and some
InternetExplorer popup (think it belongs to hosted browser) are
throwing the following errors:
The popup:
Stack overflow at line: 0
and the compiler:
[ERROR] Unable to load module entry point class
es.vicomtech.floelhoeffel.client.GMapsGWT (see associated exception
for details)
com.google.gwt.core.client.JavaScriptException: JavaScript Error
exception: Espacio de pila insuficiente
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
481)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
270)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
137)
at
com.mapitz.gwt.googleMaps.client.GMap2Impl.addOverlay(GMap2Impl.java:
244)
at com.mapitz.gwt.googleMaps.client.GMap2.addOverlay(GMap2.java:358)
at es.vicomtech.floelhoeffel.client.map.MapView.<init>(MapView.java:
56)
at
es.vicomtech.floelhoeffel.client.ApplicationController.<init>(ApplicationController.java:
29)
at
es.vicomtech.floelhoeffel.client.ApplicationController.getInstance(ApplicationController.java:
64)
at
es.vicomtech.floelhoeffel.client.GMapsGWT.onModuleLoad(GMapsGWT.java:
20)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:342)
I extended GAbstractTileLayer like this:
public class Overlay extends GAbstractTileLayer {
public Overlay(GCopyrightCollection copyrights, int minResolution,
int maxResolution) {
super( copyrights, minResolution,maxResolution);
}
public String getTileUrl(int x, int y, int zoom)
{
int z = zoom;
String f = "/images/map-tiles/"+x+"_"+y+"_"+z+".gif";
return f;
//return "http://kh3.google.com/kh?n=404&v=14&t=t";
}
public double getOpacity(){
return 0;
};
public boolean isPng() {
return false;
}
}
Any ideas what this could cause?
Thanks a lot in advance!
Frederik
-krispy
On Jul 20, 4:48 am, "loewenspr...@gmail.com"
thanks a lot for your help again and sorry for the spanish version of
"Stack overflow" :) The problem was, that I was missing some arguments
in getTileURL(). I used
public String getTileUrl(int x, int y, int zoom)
instead of
public String getTileUrl(GPoint point, int zoom)
Eclipse compiled fine but when testing, JavaScript crashed because of
the wrong arguments. So finally I got my custom map overlay working!
To pay back to the community I upped an example project on my webspace
that includes some custom tiles and the custom overlay.
Its available at:
http://www.loewensprung.de/tutorials/gwt-custom-map-overlay#comment
Regards
Frederik
> > > 4) add the custom tile layer to a newGMapTypeOR add the custom layer