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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:45:13+00:00 2026-06-17T09:45:13+00:00

I have drawn a polygon on Google Maps. But I am unable to verify

  • 0

I have drawn a polygon on Google Maps. But I am unable to verify whether a point exists within that area. How can I achieve this? Any suggestion would be appreciated.

<!DOCTYPE html>
<html>
<head>
    <title>Polygon</title>
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=my_API_key&sensor=false&libraries=geometry"></script>
    <script>
        var centerPoint = new google.maps.LatLng(22.65, 88.45);
        var centerPoint2 = new google.maps.LatLng(28.3, 86.3167);
        var centerPoint3 = new google.maps.LatLng(22.65, 88.45);
        var centerPoint4 = new google.maps.LatLng(20.6333, 84.3167);
        var centerPoint5 = new google.maps.LatLng(24.6333, 85.3167);
        function Initialize() {
            var mapProp = {
                center: centerPoint,
                zoom: 4,
                mapTypeId: google.maps.MapTypeId.HYBRID
            };
            var map = new google.maps.Map(document.getElementById("MyMap"), mapProp);
            var marker = new google.maps.Marker({
                                                  position: centerPoint,
                                                  animation: google.maps.Animation.BOUNCE
                                               });
    var myTrip = [centerPoint2, centerPoint3, centerPoint4];
    var flightPath = new google.maps.Polygon({
                        path: myTrip,
                        strokeColor: "#0000FF",
                        strokeOpacity: 0.2,
                        strokeWeight: 2,
                        fillColor: "#B0F0FF",
                        fillOpacity: 0.4,
                        editable: true
                        });
            marker.setMap(map);
    flightPath.setMap(map);
    var locationExists = new  google.maps.geometry.poly.containsLocation({
                                    point: centerPoint5,
                                    polygon: flightPath
                                });
    document.getElementById("MyData").innerHTML = locationExists;
         }
         google.maps.event.addDomListener(window, 'load', Initialize);
    </script>
</head>
<body>
    <div id="MyMap" style="height: 500px; width: 500px;"></div>
    <div id="MyData" style="height: 500px; width: 500px;"></div>
</body>

Is the containsLocation() used properly? If not please suggest.

enter image description here

  • 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-17T09:45:14+00:00Added an answer on June 17, 2026 at 9:45 am

    Use google.maps.geometry.poly.containsLocation

    Note: the geometry-library isn’t loaded by default, you must load it by using the libraries-parameter of the maps-api

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

Sidebar

Related Questions

Hi there I have to calculate the area of drawn polygon on google map
I have the code that draw a point inside a polygon. Each time I
I have drawn an object on NSView subclass. How can the object know that
I have a Google Maps Circle drawn on v3 api. When the user has
I want to fill a polygon shape that I have drawn via Core Graphics
I have drawn a circle and applied radial gradient. fine. But when i changed
I have a MyCanvas class that extends JComponent. On this canvas I have drawn
I have 4 days of experience with Google Maps Javascript API and i find
I am having trouble with overlays. I have drawn a polygon overlay on the
I'm working on a project that uses ElasticSearch and tire.I have a google map

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.