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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:51:33+00:00 2026-06-02T23:51:33+00:00

I was looking for a solution but all are how to draw polylines from

  • 0

I was looking for a solution but all are how to draw polylines from the json file etc. Main question is how to get the functionality to create a new polyline and store old in array each time when click on button “New Polyline”? Second how to leave polylines and draw new on map after click “New Polyline” button and clean and restore only when click right button? May better way is to store Polylines outside the class, or make a new separately class for this? May you have to approach this differently?

Bad demo but highlight what I mean I hope: jsfiddle

Array was moved to global scope but can’t setMap on last polyline works only via clearOverlays function. Now complications arise on other buttons. I create additional global object newPoly but don’t know whether is good idea may better get object from myPolyline? In other side restore case can’t set on map stored in array polylines.

  • 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-02T23:51:34+00:00Added an answer on June 2, 2026 at 11:51 pm

    To save the polylines you’ve made, create another global variable to store the polylines and push them in, and at the same time, setMap(null) on the last polyline in the array. You can’t store the polylines you’ve made in the same object, since you’re making a new one each time.
    So move:

    this.polyLines = [];
    

    out of the class, and into the global scope, or into another class, its fine to leave the marker array in there, since that’s local to that polyline instance.

    this should also help – https://developers.google.com/maps/documentation/javascript/overlays#OverlaysOverview

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

Sidebar

Related Questions

Okay, I've been looking all over the web to find a solution but I
I'm looking for solution to extract some node from large xml file (using xmlstarlet
I have been looking for a good solution all day, but Google evolves so
Apologies for the long winded title but looking for a solution to what might
I'm looking for a solution like the one discussed here, but for C# WinForms.
I came across this thread when I was looking for a solution, but it
I've been looking around for a solution to this thing but I haven't found
I have an inelegant solution for what I need, but am looking for an
I've found a similar question here , but I'm looking for more general solutions.
I'm looking for solution to get time to click on element using implicitlyWait in

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.