# OpenLayers and custom Proj4 Projection

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.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.

• Have you tried setting the geodesic parameter of the Scaleline to true or false? – AndreJ Jun 20 '13 at 14:59
• Have you added the proj4js library too? For projection others than 4326 and 900913 you need proj4js lirary – EricSonaron Jun 20 '13 at 15:08
• Geodesic boolean does not affect the scaleline size...thanks though. – Antwan Jun 20 '13 at 15:12
• As I said, I added the proj4js. – Antwan Jun 20 '13 at 15:12
• the way I call proj4js is: <script type="text/javascript" src="jscssbin/proj4js/lib/proj4js.js"></script> is that enough? – Antwan Jun 20 '13 at 15:13