[OpenLayers-Users] Cannot read property 'yx' of undefined

Ian Turton ijturton at gmail.com
Fri Oct 18 07:29:37 PDT 2013


I don't think that page applies to EPSG:27700 which is always XY (no matter
which WMS version).

Dylan,
Have you tried taking the CRS: line out of your code? OpenLayers should
fill that in for you from the map object.

Ian


On 18 October 2013 15:23, Jerome A. Wendell <jawendell at suddenlink.net>wrote:

> Dylan,****
>
> ** **
>
> Have you looked at the following page in the documentation:****
>
> ** **
>
>
> http://docs.geoserver.org/stable/en/user/services/wms/basics.html#differences-between-wms-versions
> ****
>
> ** **
>
> Jerome Wendell****
>
> ** **
>
> ** **
>
> *From:* Dylan Parry [mailto:dylan.parry at bluefoxtech.co.uk]
> *Sent:* Friday, October 18, 2013 10:12 AM
> *To:* openlayers-users at lists.osgeo.org; jawendell at suddenlink.net
> *Subject:* Re: [OpenLayers-Users] Cannot read property 'yx' of undefined**
> **
>
> ** **
>
> 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 <jawendell at suddenlink.net>
> *Sent:* ‎Friday‎, ‎18‎ ‎October‎ ‎2013 ‎13‎:‎25
> *To:* Dylan Parry <dylan.parry at bluefoxtech.co.uk>,
> openlayers-users at lists.osgeo.org****
>
> ** **
>
> 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:* openlayers-users-bounces at lists.osgeo.org [
> mailto:openlayers-users-bounces at lists.osgeo.org<openlayers-users-bounces at lists.osgeo.org>]
> *On Behalf Of *Dylan Parry
> *Sent:* Friday, October 18, 2013 8:06 AM
> *To:* openlayers-users at lists.osgeo.org
> *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
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
Ian Turton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20131018/4e803f29/attachment-0001.html>


More information about the Users mailing list