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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:07:34+00:00 2026-05-16T18:07:34+00:00

I successfully installed epoly.js for V2 and got it working. However in V3 I

  • 0

I successfully installed epoly.js for V2 and got it working.

However in V3 I get this error in my console:

ReferenceError: Can’t find variable: GPolygon

Any ideas?

  • 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-16T18:07:35+00:00Added an answer on May 16, 2026 at 6:07 pm

    OK I have found a solution courtesy of the guy(s) at http://dyve.posterous.com/?tag=googlemaps

    They provide 2 routines:

    if (!google.maps.Polygon.prototype.getBounds) {
        google.maps.Polygon.prototype.getBounds = function(latLng) {
            var bounds = new google.maps.LatLngBounds();
            var paths = this.getPaths();
            var path;
            for (var p = 0; p < paths.getLength(); p++) {
                path = paths.getAt(p);
                for (var i = 0; i < path.getLength(); i++) {
                    bounds.extend(path.getAt(i));
                }
            }
            return bounds;
        }
    }
    
    if (!google.maps.Polygon.prototype.contains) {
        google.maps.Polygon.prototype.contains = function(latLng) {
            // Outside the bounds means outside the polygon
            if (!this.getBounds().contains(latLng)) {
                return false;
            }
            var lat = latLng.lat();
            var lng = latLng.lng();
            var paths = this.getPaths();
            var path, pathLength, inPath, i, j, vertex1, vertex2;
    
            // Walk all the paths
            for (var p = 0; p < paths.getLength(); p++) {
    
                path = paths.getAt(p);
                pathLength = path.getLength();
                j = pathLength - 1;
                inPath = false;
                for (i = 0; i < pathLength; i++) {
                    vertex1 = path.getAt(i);
                    vertex2 = path.getAt(j);
                    if (vertex1.lng() < lng && vertex2.lng() >= lng || vertex2.lng() < lng && vertex1.lng() >= lng) {
                        if (vertex1.lat() + (lng - vertex1.lng()) / (vertex2.lng() - vertex1.lng()) * (vertex2.lat() - vertex1.lat()) < lat) {
                            inPath = !inPath;
                        }
                    }
                    j = i;
                }
                if (inPath) {
                    return true;
                }
            }
            return false;
        }
    }
    

    I then simply add this code

    function initialize() {
      var areas = [];
      var coords = [];
      var latlng = new google.maps.LatLng(53.85, -2.15);
      var myOptions = {
        zoom: 12,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      var marker = new google.maps.Marker({
          position: latlng, 
          map: map,
          title:"Hello World!",
          draggable: true
      });   
      coords[0] = [
          new google.maps.LatLng(53.9, -2.15),
          new google.maps.LatLng(53.91, -2.05),
          new google.maps.LatLng(53.85, -2.10),
          new google.maps.LatLng(53.9, -2.15)
      ];
      areas[0] = new google.maps.Polygon({
        paths: coords[0],
        strokeColor: "#FF0000",
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: "#FF0000",
        fillOpacity: 0.35
      });
      areas[0].setMap(map);
      coords[1] = [
          new google.maps.LatLng(53.9, -2.14),
          new google.maps.LatLng(53.88, -2.05),
          new google.maps.LatLng(53.85, -2.09),
      ];
      areas[1] = new google.maps.Polygon({
        paths: coords[1],
        strokeColor: "#00FF00",
        strokeOpacity: 0.8,
        strokeWeight: 2,
        fillColor: "#00FF00",
        fillOpacity: 0.35
      });
      areas[1].setMap(map);
      google.maps.event.addListener(marker, 'dragend', function(point) {
        for(var area = 0; area <= areas.length; area++) {
          alert(area+" "+areas[area].contains(point.latLng));
        }
      });
    }
    

    Drag the pin over 1 or both of the triangles to get true/false.

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

Sidebar

Related Questions

I can't get my site running with south. I've successfully installed south, and I
Can iPhone applications compiled against 2.1 be successfully installed via iTunes on a 2.0
I successfully installed the latest QuantumGrid from DevExpress, but I've never worked with this
I have just successfully installed CakePHP and I see that I can edit the
I've successfully installed native Oracle on 10.6, and can successfully compile and execute the
Has anyone successfully installed VS 2008 Team Developer edition on the Windows 7 beta
I can successfully connect to MySQL from a DOS prompt, but when I try
I can successfully include main jquery files in /Scripts, but if my custom test.js
I successfully installed and set it up searchlogic for basic (keyword) searching. I have
I successfully installed PyQt in both mac and PC. To do so I had

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.