×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    3

    Change initial scale unit

    Hello,

    I would like to change the initial unit used by the scale component of a map, so I can force it to match my user's preferences. I've tried using the switchUnit method of the scale bar component, but it doesn't appear to change the scale's units.

    Is this the correct way to achieve this, or am I missing something ?

    Regards

  2. #2
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: Change initial scale unit

    The API reference shows that the scale unit is controlled by a boolean showImperialUnits parameter. As a general rule it is best to update these parameters using the set() method.

    You'll need to initialise your code using something like this.
    Code:
    var mapContainer = document.getElementById("mapContainer");
    var scaleBar = new nokia.maps.map.component.ScaleBar();
    
    var map = new nokia.maps.map.Display(mapContainer, {
    	// initial center and zoom level of the map
    	center: [52.51, 13.4],
    	zoomLevel: 10,
    	components: [
    		// ZoomBar provides a UI to zoom the map in & out
    		new nokia.maps.map.component.ZoomBar(), 
    		new nokia.maps.map.component.Behavior(),
    		new nokia.maps.map.component.TypeSelector(),
    		scaleBar
    	]
    });
    
    scaleBar.set("showImperialUnits" , true);
    1. Initialise ScaleBar
    2. Add ScaleBar to Map
    3. Finally update the units of the ScaleBar
    Last edited by jasfox; 2013-05-14 at 12:39.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    3

    Re: Change initial scale unit

    Thanks Jason, the set() method solved the issue.

Similar Threads

  1. Initial Configuration
    By sourabh0612 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2010-05-29, 21:21
  2. How to change the gray scale of mask?
    By schmeichel in forum Symbian
    Replies: 5
    Last Post: 2009-11-13, 05:40
  3. Replies: 1
    Last Post: 2009-05-24, 03:21
  4. APS for S60 v3.0 Initial release?
    By shuveb in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2009-01-06, 08:41
  5. APP with no initial UI.
    By kdallan in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-09-28, 05:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •