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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:59:25+00:00 2026-06-13T20:59:25+00:00

Well, I have a Google Maps instance in which I have a TraceHandler. That

  • 0

Well, I have a Google Maps instance in which I have a TraceHandler. That let the user make lines by city map. With these lines I am using google DirectionsRoute service to generate a route. The service returns various information, entre elas the *overview_path. Containing all points of directions change in my route. With these points i create triangles as follow:

            var triangle;
            for (var indexerTrian = 0; indexerTrian < self.bounds.length; indexerTrian++) {

                if (indexerTrian + 1 == self.bounds.length) break;

                var maxLng = self.bounds[indexerTrian].lng() < self.bounds[indexerTrian + 1].lng() ? self.bounds[indexerTrian].lng() : self.bounds[indexerTrian + 1].lng();
                var minLng = self.bounds[indexerTrian].lng() > self.bounds[indexerTrian + 1].lng() ? self.bounds[indexerTrian].lng() : self.bounds[indexerTrian + 1].lng();

                var latLngSouthWest = new gMap.LatLng(self.bounds[indexerTrian].lat(), maxLng);
                var latLngNorthEast = new gMap.LatLng(self.bounds[indexerTrian + 1].lat(), minLng);

                triangle= new gMap.LatLngBounds(latLngSouthWest, latLngNorthEast);

                self.triangles.push(triangle);
            }

The third part of this routine use those triangles to bring points in the route. Some code:

//for each point
for (var i in result.page) {
                    stopPoint = result.page[i];
                    latLng = new gMap.LatLng(stopPoint.latitude, stopPoint.longitude);

                    //for each triangle
                    for (var iTrian = 0; iTrian < self.triangles.length; iTrian++) {

                        //this guy verify if the stopPoint is inside the triangle.
                        //if so. Drop it on map
                        if (self.triangles[iTrian].contains(latLng)) {

                            //this method just generate a Marker instance.
                            self.SetaMarkers(latLng, iconMarker, stopPoint.descricao, true);
                            counter++;
                            break;
                        }
                        //this is a DEBUG if who prints all points if my loop comes to 
                        //end
                        else if ((iTrian + 1) == self.triangles.length) {

                            self.SetaMarkers(latLng, null, stopPoint.descricao, true);
                            //break;
                        }
                    }
                }

This works good. No erros at execution. But for those triangles who I change de Longitude their .contains don’t work. It may be a bug.

Here is an image to demonstrate. I’m printing the triangles to debug: http://s7.postimage.org/ek3prgryj/Map.png As u guys can see in the image. The normal red marker is those stopPoint that is out of the bounds of all triangles. And those with a edited image is the stopPoints in the bounds of some triangle.

I have tried a lot of things already.. now im going to print the center of each triangle to see if it is where it must be.

  • 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-13T20:59:27+00:00Added an answer on June 13, 2026 at 8:59 pm

    Solved the problem using a circle of 25 meters after 25 meters of the route. Now I can let the user set the radius and it’s getting everyone.

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

Sidebar

Related Questions

I have a google-maps mashup that worked fairly well with small test files -
I have a google map inside of a div which gets changed, its parent
I have a Google Map on our site that has a list of markers
I have a view that contains a google map accessible via this.map within the
I have a google map javascript link like: string GoogleURL = http://maps.google.com/maps?file=api&v=2&key=abcdefg I built
I have a kml file that loads fine in google maps. On the same
Here's my conundrum: I have a page that uses Google Maps V3 and jQuery.
It is well know to people using Google Maps in an Android app that
I have done one project in android which is to display map using GOOGLE
I have developed and google map with v3 in javascript as well as vb.net

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.