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 6721161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:17:49+00:00 2026-05-26T09:17:49+00:00

I am using this explanation of how to color a google maps marker by

  • 0

I am using this explanation of how to color a google maps marker by setting the icon using a MarkerImage, and the coloring works well. But I can’t make the scaledSize argument change the size of the marker.

    var pinColor = 'FFFF00';
    var pinIcon = new google.maps.MarkerImage(
        "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + pinColor,
        new google.maps.Size(21, 34),
        new google.maps.Point(0,0),
        new google.maps.Point(10, 34),
        new google.maps.Size(2, 4));
    marker.setIcon(pinIcon);

What is the correct use of the scaledSize argument to change the marker size? For example, how can I double the marker size?

  • 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-26T09:17:49+00:00Added an answer on May 26, 2026 at 9:17 am

    This answer expounds on John Black’s helpful answer, so I will repeat some of his answer content in my answer.

    The easiest way to resize a marker seems to be leaving argument 2, 3, and 4 null and scaling the size in argument 5.

    var pinIcon = new google.maps.MarkerImage(
        "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|FFFF00",
        null, /* size is determined at runtime */
        null, /* origin is 0,0 */
        null, /* anchor is bottom center of the scaled image */
        new google.maps.Size(42, 68)
    );  
    

    As an aside, this answer to a similar question asserts that defining marker size in the 2nd argument is better than scaling in the 5th argument. I don’t know if this is true.

    Leaving arguments 2-4 null works great for the default google pin image, but you must set an anchor explicitly for the default google pin shadow image, or it will look like this:

    what happens when you leave anchor null on an enlarged shadow

    The bottom center of the pin image happens to be collocated with the tip of the pin when you view the graphic on the map. This is important, because the marker’s position property (marker’s LatLng position on the map) will automatically be collocated with the visual tip of the pin when you leave the anchor (4th argument) null. In other words, leaving the anchor null ensures the tip points where it is supposed to point.

    However, the tip of the shadow is not located at the bottom center. So you need to set the 4th argument explicitly to offset the tip of the pin shadow so the shadow’s tip will be colocated with the pin image’s tip.

    By experimenting I found the tip of the shadow should be set like this: x is 1/3 of size and y is 100% of size.

    var pinShadow = new google.maps.MarkerImage(
        "http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
        null,
        null,
        /* Offset x axis 33% of overall size, Offset y axis 100% of overall size */
        new google.maps.Point(40, 110), 
        new google.maps.Size(120, 110)); 
    

    to give this:

    offset the enlarged shadow anchor explicitly

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

Sidebar

Related Questions

using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
So I'm using this pretty standard jquery plugin pattern whereby you can grab an
I'm planning on using this plugin in my form. But I just want an
Using this to load the json var jsonParsed = JSON.parse(localStorage.getItem('test')); Using this to save
Using this page, http://developer.android.com/sdk/compatibility-library.html , I have installed the Android Support Package, added a
Using this C# application pick a start and ending date range, that SAP will
Using this tutorial: http://www.c-sharpcorner.com/uploadfile/UrmimalaPal/creating-a-windows-phone-7-application-consuming-data-using-a-wcf-service/ I have created sample/hello world application on the windows phone
Using this code, i am able to send a notification to my own device.
Using this piece of code in the head of a page: <script type=text/javascript> function
Using this standard code: NSMutableDictionary *params = [NSMutableDictionary dictionary]; [params setObject:image forKey:@photo]; [params setObject:text

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.