[Geomoose-users] configuring scaleLine.js

Brent Fraser bfraser at geoanalytic.com
Wed Jul 29 08:23:06 PDT 2015


Bob,

I copied the code from v2.4's main.js:

     if(CONFIGURATION.scale_line.enabled) {
         Map.addControl(new OpenLayers.Control.ScaleLine({
             bottomOutUnits: CONFIGURATION.scale_line.bottom_units,
             topOutUnits: CONFIGURATION.scale_line.top_units,
             maxWidth: CONFIGURATION.scale_line.width
         }));
     }

and pasted it into v2.6.1's build\dojo\dojo.js (yes, I know that is not 
the right way) just before "this.configureMapTools();":


     if(CONFIGURATION.scale_line.enabled) {
         Map.addControl(new OpenLayers.Control.ScaleLine({
             bottomOutUnits: CONFIGURATION.scale_line.bottom_units,
             topOutUnits: CONFIGURATION.scale_line.top_units,
             maxWidth: CONFIGURATION.scale_line.width
         }));
     };

this.configureMapTools();

(You should really put this in Application.js and do a dojo compile.)

But it did show the OpenLayers scale bar in v2.6.1:



Best Regards,
Brent Fraser

On 7/29/2015 8:29 AM, Bistrais, Bob wrote:
>
> Brent, Jim, thanks for the suggestions.
>
> I’ve downloaded 2.4 from the site.  What code files do I find the 
> scale_line object?  Will simply copying this line to my current 
> version 2.6.1 work?
>
> Jim- if you have a chance, can you elaborate on the contents of the 
> mapfile for making the scale bar?
>
> Thanks again,
>
> Bob
>
> *From:*Brent Fraser [mailto:bfraser at geoanalytic.com]
> *Sent:* Tuesday, July 28, 2015 1:51 PM
> *To:* Bistrais, Bob; geomoose-users at lists.osgeo.org
> *Subject:* Re: [Geomoose-users] configuring scaleLine.js
>
> Bob,
>
>   As Jim points out, one approach is to use a mapserver layer to 
> create an empty map with just a scale bar.  Another approach is to 
> look at GeoMoose v2.4 and see where the scale_line object is used in 
> the JavaScript.  It basically just configures the OpenLayers 
> scalebar.  The advantage of this approach is that it can support the 
> ground distance instead of just the map distance by including
>
> if(CONFIGURATION.scale_line.enabled) {
>         :            geodesic: true,
>
> This difference can be significant depending on your map projection 
> and where your are mapping.
>
>
> Best Regards,
> Brent Fraser
>
> On 7/28/2015 10:54 AM, Bistrais, Bob wrote:
>
>     Thanks for the response, Brent.  I haven’t found ScaleLine.js either.
>
>     But then, how do I get a scale bar to appear?
>
>     *From:*Brent Fraser [mailto:bfraser at geoanalytic.com]
>     *Sent:* Tuesday, July 28, 2015 12:36 PM
>     *To:* Bistrais, Bob; geomoose-users at lists.osgeo.org
>     <mailto:geomoose-users at lists.osgeo.org>
>     *Subject:* Re: [Geomoose-users] configuring scaleLine.js
>
>     Bob,
>
>     Looks like the ScaleLine object was deprecated in v2.6
>     (http://www.geomoose.org/releases/2.6.html), and it was suggested
>     to use the ScaleLine.js extension, which I never found
>     (http://lists.osgeo.org/pipermail/geomoose-users/2013-April/004895.html)
>
>
>
>     Best Regards,
>
>     Brent Fraser
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20150729/2fbe9230/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ceiifdcb.png
Type: image/png
Size: 92952 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20150729/2fbe9230/attachment-0001.png>


More information about the Geomoose-users mailing list