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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:53:58+00:00 2026-06-06T12:53:58+00:00

I am trying to create a polyline from google maps v3 api. I know

  • 0

I am trying to create a polyline from google maps v3 api. I know how add polyline on click but i want to create polyline from latitude & longitude value which will be in loop. How can i do that ?

    var network_url = decodeURIComponent(document.URL);
    //var network_url = " http://testNetwork.com?param[]=(12.983147333223707, 77.49687217431642)&param[]=(12.95035965289418, 77.54871391015627)";

    var location_array = split_url(network_url);
    for(var i = 0; i<location_array.length; i++)
    {

         //(12.960062579720846,%2077.48313926416017)
        var loc = location_array[i] ; //==>(12.77,  24.87)

        var split_arr1 = loc.split("(");
        var result_split_arr1 = split_arr1[1].split( ")" );

        var split_latLon = result_split_arr1[0];
        var result_split = split_latLon.split(",");

        var split_lat = result_split[0];
        var split_lon = result_split[1];

        marker = new google.maps.Marker({
        position: new google.maps.LatLng(split_lat, split_lon),
        map: map
        });



        ///////////POLYLINE DRAWing /////////////////////////////

        /////////////END OF POLYLINE ////////////////////


     }


}

thank you.

  • 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-06T12:53:59+00:00Added an answer on June 6, 2026 at 12:53 pm

    Check out the documentation for the polyline. It takes an array of LatLng’s.

    Loop through your and points, throw them in an array, and pass them to the PolyLine through the constructor or .setPath().

    https://developers.google.com/maps/documentation/javascript/reference#Polyline

    Edit: Example. (I didn’t run it).

        var location_array = split_url(network_url);
        var path = [];
        for(var i = 0; i<location_array.length; i++)
        {
    
             //(12.960062579720846,%2077.48313926416017)
            var loc = location_array[i] ; //==>(12.77,  24.87)
    
            var split_arr1 = loc.split("(");
            var result_split_arr1 = split_arr1[1].split( ")" );
    
            var split_latLon = result_split_arr1[0];
            var result_split = split_latLon.split(",");
    
            var split_lat = result_split[0];
            var split_lon = result_split[1];
            var latLng = new google.maps.LatLng(split_lat, split_lon);
            path.push(latLng)
            marker = new google.maps.Marker({
            position: latLng,
            map: map
            });
    
         }
    
        var flightPath = new google.maps.Polyline({
           path: path,
           strokeColor: "#FF0000",
           strokeOpacity: 1.0,
           strokeWeight: 2,
           map: map
        });
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying create a new file with a Java Applet, but I don't know
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
I am trying to create a polyline (MKPolyline) overlay that updates periodically, to simulate
I am trying to create a Google Map where the user can plot the
I'm trying create a RCP Application with Eclipse, but I can't get past the
I trying create a class derivated from System.Web.UI.Page and in override Render i set
All, I am trying create a 'to & fro' animation using jquery animate &
Trying to create a very piece of validation to prevent spammers. I want a
I'm trying create an immutable object and initialise it from xml config file in
I am trying create a table and add this table into tablecell (table inside

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.