Hello, here is the full code I wrote. I have some images for the background and a vector layer I can display over the base map.
Thanks for any help. <script type="text/javascript"> Proj4js.defs["PLANETB"] = "+proj=eqc +a=4500000 +b=4500000 +units=m +no_defs"; var map, vectors, formats; var graticuleCtl1, graticuleCtl2; 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") }); var ls = new OpenLayers.Control.LayerSwitcher() map.addControl(ls);ls.maximizeControl(); var iss = new OpenLayers.Layer.Image( 'ISS (Base 3)', 'Data/ISS.gif', new OpenLayers.Bounds(-180, -90, 180, 90), new OpenLayers.Size(800, 400),{numZoomLevels: 4}); var topo = new OpenLayers.Layer.Image( 'Topography (Splined)','Data/spline.png',new OpenLayers.Bounds(-180, -90, 180, 90),new OpenLayers.Size(800, 400),{numZoomLevels:1}); var blank = new OpenLayers.Layer.Image( 'Blank (No Base Map)', '', new OpenLayers.Bounds(-180, -90, 180, 90), new OpenLayers.Size(800, 400),{numZoomLevels: 4}); var blue_unit = new OpenLayers.Layer.Vector("Blue Unit", { protocol: new OpenLayers.Protocol.HTTP({ url: "Data/blue_unit.gml", format: new OpenLayers.Format.GML() }), strategies: [new OpenLayers.Strategy.Fixed()],visibility: true,//wrapDateLine: true,style: {fillColor: "#0066cc",fillOpacity:0.4 , strokeWidth: 1, strokeColor: "#0066cc", strokeOpacity: 1 }, projection: map.displayProjection, }); map.addLayers([blank, topo,iss,vims,sar,rad,dark_unit,blue_unit,dunes]); map.zoomToMaxExtent(); var options = { hover: true, onSelect: serialize }; updateFormats(); map.setCenter(new OpenLayers.LonLat(0, 0), 1); } </script> On Mon, Jul 8, 2013 at 3:40 PM, Andreas Hocevar <ahoce...@opengeo.org>wrote: > 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.lu...@geolnet.net > <a.lu...@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 >> us...@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/openlayers-users >> >> > > > -- > Andreas Hocevar > OpenGeo - http://opengeo.org/ > Expert service straight from the developers. >
_______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users