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

  • SEARCH
  • Home
  • 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 7715367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:22:03+00:00 2026-06-01T02:22:03+00:00

Gmaps APIV3 accepts my x variable, but rejects my weight variable, although both are

  • 0

Gmaps APIV3 accepts my x variable, but rejects my weight variable, although both are numbers. Whats going on here?

google.maps.event.addListener(map, 'zoom_changed', function() {
        var zoomLevel = map.getZoom(); //something between 18-12
        var weight =  zoomLevel - 5;
        var x = 3;
        console.log(typeof(x)); // number 
        console.log(typeof(weight)); //number
        $.each(paths, function(i, path){
            path.setOptions({strokeWeight: x}); //works
         // path.setOptions({strokeWeight: weight}); //doesn't work
        })
    });

Added javascript as a tag because I am unsure of whether this is strictly Gmaps related or a language thing I’m unaware of. Remove it if I’m wrong.

  • 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-06-01T02:22:04+00:00Added an answer on June 1, 2026 at 2:22 am

    can it be that zoomLevel sometimes has not the expected value(18-12) and is <6 ? If yes, weight would be <=0 what is an illegal value.

    Assign at least 1:

    var weight =  Math.max(1,zoomLevel - 5);
    

    With a zoomLevel >5 your script works for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just recently Google made available Maps GL on the GMaps platform. We have an
My Google maps code is all squared away and valid, but it doesn't load
I am trying to implement a Maps API V3 and Local Search but I
I'm trying to get an overlay in google maps api v3 to appear above
I have an array with 10 different latitude and longitude numbers gathered from GMaps.
I have a google maps app which plots markers as it loads. One of
I am working with google map api ... http://code.google.com/p/gmaps-samples-flash/source/browse/trunk/samplecode/GeocodingSimple.mxml What i want to do
Google Maps has the Drawing library to draw Polylines and Polygons and other things.
I want to have different size maps on differernt pages...but i can't see to
I have been using google maps for a web app where we enter our

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.