Hello
I got OSM working with:
MapOptions mapOptions = new MapOptions();
mapOptions.setNumZoomLevels(19);
mapOptions.setProjection("EPSG:900913");
mapOptions.setUnits("m");
mapOptions.setDisplayProjection(new Projection("EPSG:4326"));
mapOptions.setMaxExtent(new Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34));
mapOptions.setMaxResolution(156543.0399f);
// let's create map widget and map objects
MapWidget mapWidget = new MapWidget("350px", "350px", mapOptions);
map = mapWidget.getMap();
LonLat center = new LonLat(11, 55);
center.transform("EPSG:4326", "EPSG:900913");
TMSOptions o = new TMSOptions();
o.getJSObject().setProperty("type", "png");
// o.getJSObject().setProperty("displayOutsideMaxExtent", true);
TMS osm = new TMS("Backdrop",
"http://a.tile.openstreetmap.org/", o);
osm.getJSObject().setProperty("getURL", createURL());
map.addLayers(new Layer[] { osm});
map.addControl(new LayerSwitcher());
OverviewMapOptions overviewMapOptions = new OverviewMapOptions();
//overviewMapOptions.setLayers(new Layer[] { wmsLayer });
map.addControl(new OverviewMap(overviewMapOptions));
map.addControl(new MousePosition());
map.addControl(new Navigation());
public static native JSObject createURL() /*-{
return function (bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left - this.maxExtent.left) / (res *
this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) / (res *
this.tileSize.h));
var z = this.map.getZoom();
var limit = Math.pow(2, z);
if (y < 0 || y >= limit) {
return $wnd.OpenLayers.Util.getImagesLocation() + '404.png';
} else {
x = ((x % limit) + limit) % limit;
return this.url + z + '/' + x + '/' + y + '.' + this.type;
}
}
}-*/;
BR
Carsten
On 12/01/2009 10:54 AM, Philipp Verhoeven wrote:
> Greetings,
>
> I'm new in devoloping with openlayers-gwt and I tried to use a
> different WMS than the one that is used in the gwt-openlayers-showcase
> (http://labs.metacarta.com/wms/vmap0...).
> And I also tried to change the position of Map Controls (like
> NavToolBar, MousePosition, PanZoom, ...).
>
> So far, my effort was not very effective.
>
> My goal is to use an openstreetmap layer (if possible to display the
> whole world, if not at least asia) and to have the Map Controls in
> some sort of toolbar at the top.
>
> I would be thankful for anything, especially code snippets.
>
> Cheers,
> Philipp
>
>
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
>
>
> _______________________________________________
> Gwt-openlayers-users mailing list
> Gwt...@li...
> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users
>
|