Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6363229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:00:42+00:00 2026-05-25T00:00:42+00:00

as referenced at http://laudontech.com/GISBlog/?p=28 , I know the scale in meters for google map

  • 0

as referenced at http://laudontech.com/GISBlog/?p=28, I know the scale in meters for google map zoom levels:

Zoom level 0 1:20088000.56607700 meters

Zoom level 1 1:10044000.28303850 meters

Zoom level 2 1:5022000.14151925 meters

Zoom level 3 1:2511000.07075963 meters

Zoom level 4 1:1255500.03537981 meters

Zoom level 5 1:627750.01768991 meters

Zoom level 6 1:313875.00884495 meters

Zoom level 7 1:156937.50442248 meters

Zoom level 8 1:78468.75221124 meters

Zoom level 9 1:39234.37610562 meters

Zoom level 10 1:19617.18805281 meters

Zoom level 11 1:9808.59402640 meters

Zoom level 12 1:4909.29701320 meters

Zoom level 13 1:2452.14850660 meters

Zoom level 14 1:1226.07425330 meters

Zoom level 15 1:613.03712665 meters

Zoom level 16 1:306.51856332 meters

Zoom level 17 1:153.25928166 meters

Zoom level 18 1:76.62964083 meters

Zoom level 19 1:38.31482042 meters

I want to use this information to create a function like so:

function getZoomLevel(meters) {
    //take input in whole meters
    //return best match for zoom level as integer
}

I’ve thought about doing nested if else greater/less then conditions, but isn’t there a more streamlined approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:00:43+00:00Added an answer on May 25, 2026 at 12:00 am

    Each decrease of the zoom level means doubling the meters, so you don’t have to store each individual value.

    You could try this:

    function getZoomLevel(m){
        var z=0;
        var i=20088000;
        while(i/2>=m && z<19){
            z++;
            i=i/2;
        }
        return z;
    }
    

    it returns the next smaller zoom level as soon as meters is exceeding the current level.

    or better:

    function getZoomLevel(m){
        var z=Math.floor((Math.log(20088000/m))/Math.log(2));
        if (z>19) z=19;
        if (z<0) z=0;
        return z;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Map Shaded http://demo.silkea.com/map_shade.png I am trying to accomplish drawing a referenced area for example.
http://msdn.microsoft.com/en-us/library/dd997415.aspx Per the article referenced above I am trying to handle exceptions in a
Hello StackOverflow community, The air.swf file referenced here: http://livedocs.adobe.com/flex/3/html/help.html?content=distributing_apps_3.html used to launch AIR applications
I see this referenced a lot: http://ajaxify.com/run/crossframe/ And I noticed now it's no longer
I am using the following PNG fix for IE6: http://www.dillerdesign.com/experiment/DD_belatedPNG/ It is referenced thus
I referenced this website: http://biega.com/special-char.html to aid me in adding special characters in my
I want to rewrite pagination URLs http://mydomain.com/category?start=15 to http://mydomain.com/category/start/15 , but I don't know
Attempting to cache my SSRS reports as referenced in http://blogs.technet.com/b/rob/archive/2010/02/11/caching-ssrs-reports-for-performance.aspx ...I am to understand
I am using sqlitegen(http://code.google.com/p/sqlitegen/) plugin in eclipse for android. The documentation for using it
I have placed the corresponding code at http://cssdesk.com/QSwDG The sprite (referenced as 'circle.png' in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.