[OpenLayers-Users] MousePosition displayProjection problem ortho->epsg:4326

Mike Adair madair at dmsolutions.ca
Wed Apr 21 09:39:36 EDT 2010


Heiko,

The problem might be that the implementation of the ortho code in 
Proj4js hasn't been validated yet (see the bottom of this page 
http://trac.osgeo.org/proj4js/wiki/UserGuide).  However there is a bug 
report with a proposed fix in the trac system 
(http://trac.osgeo.org/proj4js/ticket/42) that I haven't got to 
implementing and testing yet. 

Mike



Heiko Schröter wrote:
> Hello,
>
> i have a problem with the MousePosition Control. The relevant code snippets are as follows: 
>
>
> Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
> Proj4js.defs["EPSG:0815"] = "+proj=ortho +lon_0=0 +lat_0=90";
> Proj4js.defs["EPSG:0816"] = "+proj=ortho +lon_0=0 +lat_0=-90";
>
>     var myoptions = {
> 	eventListeners: {
> 	    "changebaselayer": hd_mapBaseLayerChanged
> 	},
> 	units: "dd",
> 	maxResolution: 'auto',
> 	maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
> 	controls: [
> 		   new OpenLayers.Control.PanZoom(),
> 		   new OpenLayers.Control.Navigation(),
> 		   new OpenLayers.Control.MousePosition({"numDigits": 2,
> 							 displayProjection: new OpenLayers.Projection("EPSG:4326")}),
> 		   new OpenLayers.Control.LayerSwitcher({"ascending": true}),
> 		   new OpenLayers.Control.Attribution()
> 		   ],
>
> 	numZoomLevels: 5
>     };
>     map = new OpenLayers.Map('map', myoptions);
>
> The MousePosition works ok in EPSG:4326. Changing to 0815/0816 stalls the output of the MousePosition. Changing back to EPSG:4326 everything is ok again.
> Omitting the "displayProjection" Option displays the MousePosition in meters in the 0815/0816 projection and in degrees in EPSG:4326 projection.
>
> So what i want is to display the MousePosition in "degrees" in the 0815/0816 projection as in EPSG:4326.
> As far as i understand the docs the transformation should be done automatically when proj4js is used.
> What do i do wrong ?
>
> Thanks and Regards
> Heiko
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   

-- 
   Michael Adair
   Senior Software Architect
   DM Solutions Group Inc.

   Office: (613) 565-5056 x26
   madair at dmsolutions.ca
   http://www.dmsolutions.ca
   http://research.dmsolutions.ca





More information about the Users mailing list