[OpenLayers-Users] (no subject)

David J. Renz David.Renz at cityofmedford.org
Wed Jan 9 12:22:15 EST 2008


hello.
i am new to the list and to openLayers.

i am trying to load a wms service from geoserver.

when i go to geoserver (administrator on my local machine) and look at
the demo requests for the service i am trying to load i can connect to
it fine, using either a standard wms request or an openLayers request.

however, when i try to load the wms layer in OpenLayers it fails.
the error is "bounds has no properties", in my OpenLayers.js file on
line 533. i am using the "Link to the hosted version" file from the
website.

i am pretty sure that i have the projection/extent messed up, but don't
really know where the problem is.

any leads would be appreciated.


ie (these work from geoserver):

geoserver demo: openLayers WMS
----------------------------------
http://127.0.0.1:8080/geoserver/wms?bbox=4154738.29412617,104907.9070201
7272,4463982.597581711,516373.2919801983&styles=&Format=application/open
layers&request=GetMap&layers=MED_POST:cadstreets&width=550&height=250&sr
s=EPSG:2270

geoserver demo: wms
----------------------------------
http://127.0.0.1:8080/geoserver/wms?bbox=4154738.29412617,104907.9070201
7272,4463982.597581711,516373.2919801983&styles=&Format=image/png&reques
t=GetMap&layers=MED_POST:cadstreets&height=600&width=600&srs=EPSG:2270


open layers code is below (fails):
-----------------------------

var bounds = new
OpenLayers.Bounds(4154738.29412617,104907.90702017272,4463982.597581711,
516373.2919801983);

alert("Bounds are \n" + bounds);  

var map = new OpenLayers.Map('map', { projection: "EPSG:2270",
units: "ft", maxExtent: bounds,});

var gs_wms = new OpenLayers.Layer.WMS( "Med",
"http://127.0.0.1:8080/geoserver/wms",{layers: 'MED_POST:cadstreets' ,
'transparent':"true",'format': "image/png"});

gs_wms.setVisibility(false);
map.addLayers(gs_wms])

map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());

map.zoomToMaxExtent();   


Thanks,
david








More information about the Users mailing list