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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:43:29+00:00 2026-06-02T05:43:29+00:00

I have this code for polyline which is working perfect. How do i add

  • 0

I have this code for polyline which is working perfect. How do i add marker for each of location point?

var userCoor = [
<?php
for($i=0; $i<sizeOf($lat); $i++)
echo "new google.maps.LatLng({$lat[$i]}, {$long[$i]}),";
?>
];

var userCoordinate = new google.maps.Polyline({
path: userCoor,
strokeColor: "#FF0000",
strokeOpacity: 1,
strokeWeight: 2
});

userCoordinate.setMap(map);

I tried

var infowindow = new google.maps.InfoWindow();

var marker, i;

for (i = 0; i < userCoor.length; i++) {  
  marker = new google.maps.Marker({
    position: new google.maps.LatLng(userCoor[i][1], userCoor[i][2]),
    map: map
  });

  google.maps.event.addListener(marker, 'click', (function(marker, i) {
    return function() {
      infowindow.setContent(userCoor[i][0]);
      infowindow.open(map, marker);
    }
  })(marker, i));
}
}

Marker seems missing? Any idea how? Thanks.

  • 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-02T05:43:31+00:00Added an answer on June 2, 2026 at 5:43 am

    I tested with some bogus data here and there doesn’t seem to be a problem. The difference is I’m using userCoorPath for the polyline and userCoor to set the markers. I’m repeating the information, but they are being used differently. One is an array of LatLngs, the other an array of string and two floats.

    http://jsfiddle.net/nSf9N/

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

Sidebar

Related Questions

I have this code, but this line has some problem. var dataString = 'name='+name&'id='+id;
I have this code which export data from GridView to csv. It works with
Have this code: var gradient = ctx.createLinearGradient(0,0, 20, 0); gradient.addColorStop(0.8, rgb(250,250,0)); gradient.addColorStop(1, rgb(150,150,0)); ctx.fillStyle
I have this code (below) working just fine, however whenever I try to 'wrap'
I have this code that I call on each touch event that render an
have this code in a htaccess file to hide the final php extension of
i have this code which doesnt work: void CAnalyzerIF::SetData(int i_iIters, const CParameterSet* i_CParameterSet) {
I have this code var contacts = dr.mktDoctorContacts .GroupBy(x => x.ContactType) .Select(zb => new
I have this code: myVariable which I want to change into trace(myVariable: + myVariable);
I have this code in which a user draws some polygon using mouse pointer

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.