<div dir="ltr">Hello Folks,<div><br></div><div><br></div><div style>I intend to use <span class="" style>OpenLayers</span> for an educational project dealing with planetary data. </div><div style>I tried to get an accurate scale bar (i.e., <span class="" style>ScaleLine</span> object) from a custom projection but it seems that <span class="" style>ScaleLine</span> does not understand non-terrestrial sphere/ellipsoid.<br>
</div><div style><br></div><div style>Here is what I have done:</div><div style><br></div><div style>I first call proj4js:</div><div style><script <span class="" style>src</span>="http://<span class="" style>svn</span>.<span class="" style>osgeo</span>.org/<span class="" style>metacrs</span>/proj4js/trunk/lib/proj4js-compressed.<span class="" style>js</span>"></script><br>
</div><div style>then <span class="" style>OpenLayers</span></div><div style><br></div><div style>and in a javascript sequence I do this: </div><div style><br></div><div style>Proj4js.<span class="" style>defs</span>["<span class="" style>PLANETB</span>"] = "+<span class="" style>proj</span>=<span class="" style>eqc</span> +a=4500000 +b=4500000 +units=m +no_<span class="" style>defs</span>";<br>
</div><div style><br></div><div style><div>      function <span class="" style>init</span>(){</div><div><br></div><div>               map = new <span class="" style>OpenLayers</span>.Map('map', {</div><div>                    controls: [</div>
<div>                        new <span class="" style>OpenLayers</span>.Control.Navigation(),</div><div>                        new <span class="" style>OpenLayers</span>.Control.<span class="" style>PanZoomBar</span>(),</div>
<div>                        new <span class="" style>OpenLayers</span>.Control.<span class="" style>ScaleLine</span>({<span class="" style>bottomOutUnits</span>: '',geodesic: true}),</div><div>                        new <span class="" style>OpenLayers</span>.Control.<span class="" style>MousePosition</span>(),</div>
<div>                        new <span class="" style>OpenLayers</span>.Control.Graticule()</div><div>                    ],</div><div>                    <span class="" style>pprojection</span>:  new <span class="" style>OpenLayers</span>.Projection("<span class="" style>PLANETB</span>")</div>
<div>                });</div><div><br></div><div style>Unfortunately, when displaying the page, the scale bar is totally wrong. I played with different values of "a" and "b", ScaleLine does NOT take into account these values. The Proj4 syntax seems correct as it works smoothly under QGIS for instance. For me, OpenLayers just does not understand correctly proj4 projection. </div>
<div style><br></div><div style>Any idea if OpenLayer can really understand proj4 syntax? and if not, how can I contribute (i.e., where, which files?) in order to get this right?</div><div style><br></div><div style>thank you for any feedback/ideas</div>
<div style><br></div><div style>A. </div><div><br></div></div></div>