[OpenLayers-Users] ScaleLine and non-terrestrial projections

a.lucas at geolnet.net a.lucas at geolnet.net
Fri Jun 21 01:45:04 PDT 2013


Hello Folks,


I intend to use OpenLayers for an educational project dealing with
planetary data.
I tried to get an accurate scale bar (i.e., ScaleLine object) from a custom
projection but it seems that ScaleLine does not understand non-terrestrial
sphere/ellipsoid.

Here is what I have done:

I first call proj4js:
<script src="http://svn.osgeo.org/metacrs
/proj4js/trunk/lib/proj4js-compressed.js"></script>
then OpenLayers

and in a javascript sequence I do this:

Proj4js.defs["PLANETB"] = "+proj=eqc +a=4500000 +b=4500000 +units=m +no_defs
";

      function init(){

               map = new OpenLayers.Map('map', {
                    controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoomBar(),
                        new OpenLayers.Control.ScaleLine({bottomOutUnits:
'',geodesic: true}),
                        new OpenLayers.Control.MousePosition(),
                        new OpenLayers.Control.Graticule()
                    ],
                    pprojection:  new OpenLayers.Projection("PLANETB")
                });

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.

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?

thank you for any feedback/ideas

A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130621/3f788a99/attachment.html>


More information about the Users mailing list