|
From: Jon B. <man...@go...> - 2010-04-19 13:54:48
|
I use OSM and gwt-openlayers successfully using the following code. This is
for the Mapnik rendering but the same can be done for Osmarender. I don't
think I needed to download anything extra to do this, it just worked out of
the box.
MapOptions defaultMapOptions = new MapOptions();
defaultMapOptions.setControls(new JObjectArray(new JSObject[] {}));
defaultMapOptions.setProjection("EPSG:900913");
defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326"));
defaultMapOptions.setMaxExtent(new
Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34));
defaultMapOptions.setNumZoomLevels(19);
defaultMapOptions.setUnits("m");
MapWidget mw = new MapWidget("100%", "100%", defaultMapOptions);
mw.getMap().addLayer(OSM.Mapnik("Mapnik"));
Obviously, the key line is the last line :-)
Jon
On 19 April 2010 08:09, Edwin Commandeur <com...@gm...> wrote:
> Hi Hans,
>
> I am not sure about TMS, but in OL I think it has been superseded by
> OSM. For OSM you need to include a small javascript library created by
> OSM itself.
>
> However, I am not an OSM user, so I can't tell you the details.
>
> The easiest way is to look in a recent OpenLayers example and then see
> if you can do sth similar with GWT-OL.
>
> Greetings,
> Edwin
>
> 2010/4/19 Hans Terje Møller <han...@ho...>:
> > Hi.
> >
> > I wrote you a few days ago, but didn't get a response, so I'm trying
> again.
> >
> > I am currently trying to use OSM in gwt-openlayers but have gotten stuck.
> I
> > try importing OSM by creating a TMS layer.
> > This is how the code look so far:
> >
> > TMSOptions tmsOptions = new TMSOptions();
> >
> > tmsOptions.setFormat("image/png");
> >
> > tmsOptions.setDisplayOutsideMaxExtent(false);
> >
> > tmsOptions.setProjection("EPSG:4392");
> >
> > TMS tmsLayer = new TMS("OpenStreetMaps", "http://tile.openstreetmap.org/
> ",
> > tmsOptions);
> >
> > map.addLayers(new Layer[] {tmsLayer});
> >
> > This only loads a bunch of red tiles which tells me that the image can't
> be
> > loaded. And when I right click one of those tiles I get this url:
> > http://tile.openstreetmap.org/1.0.0/undefined/2/1/1.undefined.
> > And the url I need is this: http://tile.openstreetmap.org/2/1/1.pngwhich is
> > a working url that I have from another example. From what I understand, I
> > haven't managed to define the format, but how do I do this?
> >
> > I would greatly appreciate some guidelines on how to get OSM working!!
> >
> > Regards,
> > Hans Terje Møller
> >
> >
> >
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Gwt-openlayers-users mailing list
> Gwt...@li...
> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users
>
|