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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:31:36+00:00 2026-05-26T01:31:36+00:00

I’m trying to implement class for handling Multipolygon (derived from OpenGIS Multipolygon specification). My

  • 0

I’m trying to implement class for handling Multipolygon (derived from OpenGIS Multipolygon specification). My primary goal was extend MVCObject and internally manage an array of google.maps.Polygon. But when I’m trying to bind my Multipolygon’s properties (with .bindTo method) to underlying Polygons in the loop, it seems that only the last polygon finally binded .

google.maps.MultiPolygon.prototype = new google.maps.MVCObject();
...
for (var n = 0; n < this.polygons.length; n++)
{
  for (var i in MultiPolygonOptions) this.bindTo(i, this.polygons[n], i);
}
...

Is it possible to bind MVCObject’s property to multiple targets in google maps v3? If no, maybe there are some workarounds? Thanks.

  • 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-26T01:31:36+00:00Added an answer on May 26, 2026 at 1:31 am

    As I considered, after some illegal digging of gmaps puzzly source code, it became clear – it is not possible to add multiple targets when binding some key using MVCObject.bindTo.


    But I’ve discovered some workaround. I’ve put targets (polygons) I wanted to bind into MVCArray, then binded array to property using someObject.bindTo(your_key, MVCArray_with_targets). Then I’ve attached arrays change function to listen and to pass changed properties to array elements. Surely, this works only one way, but it is sufficient in my case.

    google.maps.MultiPolygon = function(options)
    {
      var self = this;
    
      ...
    
      var gpolys = new google.maps.MVCArray();
      // creating polygons from paths
      polysOptions.forEach(function(value, number)
      {
        gpolys.push(self.__createPolygon(value));
      });
    
      // bind all parent properties to array and set it before (or this turns parent keys undefined)
      for (var i in MultiPolygonOptions) { gpolys.set(i, this.get(i)); this.bindTo(i, gpolys); }
      // pass changes to array members which is google.maps.Polygon instances
      gpolys.changed = function(prop)
      {
        this.forEach(function(poly)
        {
          poly.set(prop, self.get(prop));
        });
      }
    
      this.set('polys', gpolys);
    }
    
    google.maps.MultiPolygon.prototype = new google.maps.MVCObject();
    

    Now, I can control appearance of all child polygons in my MultiPolygon in one place, just like with simple Polygon.

    var mpoly = new google.maps.MultiPolygon({ options });
    mpoly.setMap(map);
    mpoly.setValues({
      fillOpacity: 0.5,
      fillColor: 'yellow'
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.