Hi,
That’s similar to what I tried before, ie.
yx: { ‘EPSG:27700’: false }
Strangely, the error goes away when I set the above to ‘true’ but then of
course the coordinates are all wrong so the tiles won’t load. I can’t
understand why setting it to false would bring up an error when false is still
a valid value?
--
Dylan Parry
Blue Fox Technology Ltd
Tel: 01492 532100
Web: http://www.bluefoxtech.co.uk
Registered in England and Wales, Company No. 0508226.
Registered office: Windsor House, 26 Mostyn Avenue, Craig-Y-Don,
Llandudno, Conwy LL30 1YY
From: Jerome A. Wendell
Sent: Friday, 18 October 2013 13:25
To: Dylan Parry, [email protected]
Dylan,
I have added the following to the same section of code that you referred to for
some of my layers:
yx : {'EPSG:4326' : true}
See if adapting it to your projection makes any difference.
Jerome Wendell
From: [email protected]
[mailto:[email protected]] On Behalf Of Dylan Parry
Sent: Friday, October 18, 2013 8:06 AM
To: [email protected]
Subject: [OpenLayers-Users] Cannot read property 'yx' of undefined
Hi,
I’m trying to use a WMS with the EPSG:27700 projection. The WMS uses version
1.3.0, which is causing a few problems. I have got to a point where I cannot
figure out what’s wrong.
I am currently getting the following error:
Cannot read property ‘yx’ of undefined
and having read up a little, it appears that it’s due to the WMS version
wanting to know whether to reverse the coordinates or not for the bbox
parameter, but as the projection is unknown to OpenLayers there’s no yx
property to query.
My problem is that I have no idea where to add that property to.
Here’s the code I have so far:
<script src="~/Scripts/proj4js.js"></script>
<script>
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2
+k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m
+no_defs";
</script>
<script src="/Scripts/openlayers/openlayers.js"></script>
<script>
var map, opus;
function init() {
OpenLayers.ImgPath = "/Scripts/openlayers/img/";
var options = {
maxExtent: new OpenLayers.Bounds(0, 0, 700000, 1300000),
restrictedExtent: new OpenLayers.Bounds(0, 0, 700000, 1300000),
projection: new OpenLayers.Projection('EPSG:27700'),
units: 'm',
scales: [10000, 25000, 50000, 75000, 100000, 150000, 175000,
200000],
controls: [
new OpenLayers.Control.Navigation({ 'zoomWheelEnabled': false
}),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher()
]
};
map = new OpenLayers.Map('map', options);
opus = new OpenLayers.Layer.WMS(
'OpenStreetMap via Opus',
'http://server/wms',
{
layers: 'OpenStreetMap',
version: '1.3.0',
crs: 'EPSG:27700',
format: 'image/png',
},
{
isBaseLayer: true,
transitionEffect: 'resize'
}
);
map.addLayer(opus);
map.zoomToMaxExtent();
map.zoomToScale(10000, true);
map.setCenter(new OpenLayers.LonLat(195775, 223755));
}
</script>
I also have an onload event that calls the init() function to draw the map on
the page.
Any idea how to fix the error I’m getting? I’ve tried adding an xy property to
the WMS bit of the code where ‘isBaseLayer’ is defined, but that didn’t seem to
work.
Thanks,
--
Dylan Parry
Blue Fox Technology Ltd
Tel: 01492 532100
Web: http://www.bluefoxtech.co.uk
Registered in England and Wales, Company No. 0508226.
Registered office: Windsor House, 26 Mostyn Avenue, Craig-Y-Don,
Llandudno, Conwy LL30 1YY_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users