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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:45:01+00:00 2026-05-31T04:45:01+00:00

This is my first time working with the Google Maps API. I have a

  • 0

This is my first time working with the Google Maps API. I have a styled map with multiple polygons that each need their own infobox. The infoboxes need to be styled. My problem is that I can’t get the infoboxes to work at all. I’ve been looking for a solution for days now, I’ve even tried this http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.9/examples/infobox-basic.html I must obviously be doing something wrong.

Here’s my code: http://pastebin.com/M23PPXpn

  • 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-31T04:45:02+00:00Added an answer on May 31, 2026 at 4:45 am

    I noticed that attaching an Infobox to a polygon results in this error in infobox.js

    Uncaught TypeError: Object #<V> has no method 'getPosition'
    

    It could be because a polygon represents an area, while a marker represents a point. I suggest creating a single invisible marker somewhere inside your polygons to anchor each infobox.

    With this idea, I added a infobox to the Australia polygon. The click listener is still created for the polygon, but it opens the infobox tied to the invisible marker.

    // ... this is near the end of your code...
    
    australia_new_zealand.setMap(map);
    google.maps.event.addListener(australia_new_zealand, 'mouseover', function() {
        this.setOptions({fillColor: "#28d1e9"}); 
    });
    google.maps.event.addListener(australia_new_zealand, 'mouseout',function(){
     this.setOptions({fillColor: "#06376a"});   
    });
    
          // marker inside the Australia polygon, LatLng was manually defined
          var australia_new_zealand_center = new google.maps.Marker({
            map: map,
            position: new google.maps.LatLng(-24.5271348225978, 134.296875),
            visible: false
          });
    
          var boxText = document.createElement("div");
          boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;";
          boxText.innerHTML = "City Hall, Sechelt<br>British Columbia<br>Canada";
    
          var myOptions = {       
            content: boxText,
            maxWidth: 0,
            pixelOffset: new google.maps.Size(-140, 0),
            zIndex: null,
            boxStyle: {  background: "url('tipbox.gif') no-repeat", opacity: 0.75, width: "280px" } ,
            closeBoxMargin: "10px 2px 2px 2px",
            closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",
            infoBoxClearance: new google.maps.Size(1, 1),
            isHidden: false,
            pane: "floatPane",
            enableEventPropagation: false
          }
    
          // listener responds to a click inside polygon
          google.maps.event.addListener(australia_new_zealand, "click", function (e) {
            ib.open(map, australia_new_zealand_center);
          });
    
          var ib = new InfoBox(myOptions);
    
    //(end) REGION - AUSTRALIA NEW ZEALAND
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used maps many times before, but this is the first time I
hi this is the first time i am working with google analytics and php.
Today I was tasked with working with the Google API for the first time
I have just installed a custom WordPress theme (this is my first time working
I'm working with google maps. When i run my app for the first time
This is my first time with Web services. I have to develop web services
this is my first time posting here, I have a question which I have
I'm working on an application that generates a large number of Google Map markers
I'm playing around with Google maps for the first time, so I looked at
No idea why this is not working. It's the first time I am working

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.