[OpenLayers-Users] Can't display WMS using Spherical Mercator
Josh Livni
mailing_lists at umbrellaconsulting.com
Sun Dec 30 15:32:49 EST 2007
Maria,
You mention it doesn't work -- does the google maps show, and your WMS
do not? Does nothing show? Do you get pink tiles? Do you get an error
message in firebug? If so, what's the error message?
Assuming the Google Maps displays, but your WMS does not, can you give
an example of a tile url for your WMS that OpenLayers is trying to
load? You can find one by going to Tools -> Page Info -> Media, and
scrolling down till you find a local tile (in Firefox).
Also, I note you center the map on centerM - which I didn't see defined
in your javascript - is the centerM point in spherical mercator, and
does it fit within your defined maxextent and restricted extent?
Finally, on that note - perhaps you should remove these extra
restrictions till you get it basically working ..
Cheers,
-Josh
Maria Panagou wrote:
> I have tried using the Spherical Mercator example with my data with no
> success. I have transformed my WMS layer 'Quakes' in Spherical mercator ( I
> can see the .map file is allright using MapBrowser) and I have used the
> following code for openlayers which doesn't work. Any ideas?
>
> var blow = OpenLayers.Layer.SphericalMercator.forwardMercator(20, 34.8);
> var bhigh = OpenLayers.Layer.SphericalMercator.forwardMercator(28.4,
> 41.6);
>
> function init(){
> var options = {
> projection: "EPSG:900913",
> units: "m",
> maxExtent: new OpenLayers.Bounds(blow.lon, blow.lat, bhigh.lon,
> bhigh.lat),
> restrictedExtent: new OpenLayers.Bounds(blow.lon, blow.lat, bhigh.lon,
> bhigh.lat),
> controls: [new OpenLayers.Control.LayerSwitcher(),
> new OpenLayers.Control.PanZoomBar(),
> new OpenLayers.Control.MouseToolbar(),
> new OpenLayers.Control.MousePosition({prefix: 'x: ', separator: ', y:
> '})],
>
> theme:null
> }
> map = new OpenLayers.Map('map', options);
>
> var satellite = new OpenLayers.Layer.Google( "Google Satellite"
> , {type: G_SATELLITE_MAP, 'sphericalMercator':true} );
> var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" ,
> {type: G_HYBRID_MAP, 'sphericalMercator':true });
> var dtm = new OpenLayers.Layer.WMS( "ICEDS (Integrated CEOS European
> Data Server) WMS",
> "http://iceds.ge.ucl.ac.uk/cgi-bin/icedswms?", {layers:
> "srtm"});
>
>
> var quakes = new OpenLayers.Layer.WMS( "Earthquakes",
> "http://127.0.0.1:80/cgi-bin/mapserv.exe?",
> { map: '../htdocs/mpanagou/Quakes2.map',
> layers: 'Quakes', 'format':'png'},
> {transparent:true, isBaseLayer:false,
> reproject:false});
>
> map.addLayers([satellite, hybrid, dtm, quakes]);
>
> map.setCenter(new OpenLayers.LonLat(centerM.lon, centerM.lat), zoom);
>
> }
>
More information about the Users
mailing list