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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:47:01+00:00 2026-06-02T21:47:01+00:00

I am trying to draw multiple geodesic polyline with Google Maps JavaScript API from

  • 0

I am trying to draw multiple geodesic polyline with Google Maps JavaScript API from multiple location pairs. I found 98% of what I’m looking for here (http://stackoverflow.com/questions/2994424/google-maps-geocoding-address-to-glatlng) but I just can’t figure out how to add additional points and additional lines (ex also show line between Chicago, US and Los Angeles, US). Thanks for any help anyone can provide.

  • 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-02T21:47:02+00:00Added an answer on June 2, 2026 at 9:47 pm

    New update, this one puts the destination point encoding into a separate function, and makes each geocoding call independently. Should be much more scalable than trying to nest the callback procedures.

    <!DOCTYPE html>
    <html> 
    <head> 
      <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
      <title>Google Maps API Geocoding Demo</title> 
      <script src="http://maps.google.com/maps/api/js?sensor=false" 
              type="text/javascript"></script>
    </head> 
    <body>
      <div id="map" style="width: 1280px; height: 1024px;"></div>
    
      <script type="text/javascript">
    //add locations
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 2,
          center: new google.maps.LatLng(35.00, -25.00),
          mapTypeId: google.maps.MapTypeId.TERRAIN
        });
    
        var address1 = '60033';
    
        var gc = new google.maps.Geocoder();
        gc.geocode({'address': address1}, function (res1, status) {
    
            var hub = res1[0].geometry.location;
            new google.maps.Marker({
                position: res1[0].geometry.location,
                map: map
              });
    
            geocodeLine(hub, '44145');  
            geocodeLine(hub, '03103');
            geocodeLine(hub, '30236');
            geocodeLine(hub, '18106');
            geocodeLine(hub, '64147');
            geocodeLine(hub, '86401');
            geocodeLine(hub, '75110');
            geocodeLine(hub, '56001');
            geocodeLine(hub, '80239');
            geocodeLine(hub, '95776');
        });   
    
        function geocodeLine(hub, address)
        {
            var gc = new google.maps.Geocoder();
    
            gc.geocode({'address': address}, function (res, status) { 
                if (status == google.maps.GeocoderStatus.OK) {
    
                  new google.maps.Marker({
                    position: res[0].geometry.location,
                    map: map
                  }); 
    
                  new google.maps.Polyline({
                    path: [
                      hub,
                      res[0].geometry.location
                    ],
                    strokeColor: '#FF0000',
                    geodesic: true,
                    map: map
                    });
                }
            });
        }
      </script>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to draw a google maps that has multiple Circle overlays, however I
I am having a real pain of trying to draw multiple polygons from a
I'm trying to draw vertical text in win32 GDI api. I call CreateFont() with
I'm trying to draw a line (Red line in the image) over multiple panels,
I'm trying to let a user draw lines on multiple UIView canvases that are
I am trying to read data from multiple Kinect sensors (3 at the moment)
I am trying to composite a background bitmap from multiple smaller bitmaps. I am
I'm trying to draw a simple line graph which would use values from the
I have been trying to draw multiple balls for a game I am making,
I'm trying to draw simple 2d things in my JSP application. I found this

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.