[OpenLayers-Users] Non-terrestrial datum [proj4] and ScaleLine

a.lucas at geolnet.net a.lucas at geolnet.net
Mon Jul 8 05:51:07 PDT 2013


Hello Folks,

I already asked but got no reply, so I repost my question, sorry for
spamming you on that.




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()
                    ],
                    projection:  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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130708/b5f60dee/attachment.html>


More information about the Users mailing list