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

Andreas Hocevar ahocevar at opengeo.org
Mon Jul 8 06:40:28 PDT 2013


Hey,

are you sure that your map actually uses the 'PLANETB' projection? Show a
bit more code, especially which layers you add, or preferably point us to a
fully configured example. Note that the base layer's projection - if
specified - overrides the map projection.

Andreas.


On Mon, Jul 8, 2013 at 2:51 PM, a.lucas at geolnet.net <a.lucas at geolnet.net>wrote:

> 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
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130708/ee0fdac7/attachment.html>


More information about the Users mailing list