From: Armando F. <arm...@gm...> - 2011-01-23 15:14:39
|
Hi, I thought this was a simple enough exercise... I did refrain myself from asking for help here... but after two days of messing around with all the combinations I could try and getting a massive headhache, here I am. I am trying do display a GeoServer WMS layer on top of OSM and gMap base layers. I would be more than happy with a single base layer though! I understand that both OSM and gMap are in EPSG:900913 and, unless I host my own OSM, I'm stuck with this projection. But that's fine, I'll reproject my own WMSs (originally in EPSG:27700, British Coord Sys). Only it does not work. All sorts of things happen: the WMS display correctly on top of OSM only to disappear when I zoom further in (and this is the closest I got to a working app!). Is there a working example somewhere? Again, all I'm trying to achieve is displaying my own WMSs (and perhaps WMSs too) on top of a base layer (osm, gmap, bing, anything). Below is what I've done. Thank you. MapOptions defaultMapOptions = new MapOptions(); defaultMapOptions.setAllOverlays(true); MapWidget mapWidget = new MapWidget("400px", "300px", defaultMapOptions); WMSParams wmsParams = new WMSParams(); wmsParams.setFormat("image/png"); wmsParams.setLayers("my_wms"); // this is forced declared in GeoServer from its native 27700 to 900913, but I tried a native 900913 too with no luck wmsParams.setStyles(""); wmsParams.setIsTransparent(true); WMS wmsLayer = new WMS("WMS Layer", "http://myip:8080/geoserver/wms", wmsParams); wmsLayer.setIsBaseLayer(false); GoogleOptions googleLayeroptions= new GoogleOptions(); googleLayeroptions.setSphericalMercator(true); GMapType gmapType = GMapType.G_NORMAL_MAP; googleLayeroptions.setType(gmapType); Google googleLayer = new Google("Goole Layer",googleLayeroptions); OSM osm = OSM.Osmarender("Osmarender"); // as I said, I could do with a single base layer. Map map = mapWidget.getMap(); map.addLaye(wmsLayer); map.addLayer(osm); map.addLayer(googleLayer); map.addControl(new LayerSwitcher()); map.addControl(new MousePosition()); |