[GIS] OpenLayers and custom Proj4 Projection

coordinate systemdatumopenlayers-2proj

I am trying to map some planetary data on my webMap server using OpenLayers. I defined a proj4 projection as follow:

Proj4js.defs["MYDATUM"] = "+proj=longlat +a=1740000 +b=1740000 +units=m +no_defs";

In the html file I also call the proj4js.js, and then I added the following lines:

 map = new OpenLayers.Map('map', {
       controls: [
               new OpenLayers.Control.Navigation(),
               new OpenLayers.Control.PanZoomBar(),
               new OpenLayers.Control.ScaleLine({bottomOutUnits: ''}),
               new OpenLayers.Control.MousePosition(),
               new OpenLayers.Control.Graticule()

               ],
       Projection:  new OpenLayers.Projection("MYDATUM")
  });

My issue is that the scaleline does not show the correct distance and seems not to take into account my own projection. Actually I tried a couple of example and it seems that the line:

   projection:  new OpenLayers.Projection("MYDATUM")

does not have any effect on the ScaleLine size. How can I display correctly a scale bar using my own projection/datum ? Again, I'm not working with terrestrial data, so I do not want wgs84 or any of it's friends.

Best Answer

Not sure about teh java, but your proj string looks wrong. +units=m does not look right for a longlat projection. Try removing it, and in it's place also add +towgs84=0,0,0,0,0,0,0. I think you need this because you are not specifying a datum or nadgrids. It means no Helmert transformation. It will though then transform between ellipsoids. I think.

Not sure if you need to switch from degrees to radians then back to degrees after ?