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

Bart van den Eijnden bartvde at boundlessgeo.com
Fri Oct 18 07:31:54 PDT 2013


What is the axis order of your CRS? yx or xy?

The default for WMS 1.3 is xy, yx is only used if your CRS uses yx as the axis order.

It doesn't make any sense to set yx for a certain key to false, it is only meant to store a list of CRSs that have yx as the axis order.

Best regards,
Bart

On Oct 18, 2013, at 4:11 PM, Dylan Parry <dylan.parry at bluefoxtech.co.uk> wrote:

> 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, 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] 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

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


More information about the Users mailing list