What is the process for retrieving Google Map JS polyline coordinates following modifications?

When using the drawing manager in Google Maps JS, I am able to draw a polyline and retrieve its coordinates once complete. However, when attempting to edit the drawn line, the coordinates do not update accordingly.

If you'd like to take a look at the working Stack Blitz URL, you can visit it here.

I would greatly appreciate any assistance with this issue.

Thank you in advance for your help.

Answer №1

To resolve this issue, consider adding a mouseup listener.

https://example.com/unique-link

  overlayClickListener(overlay) {
    var self =this;
    google.maps.event.addListener(overlay, "mouseup", function(event){
        self.centers = overlay
        .getPath()
        .getArray()
        .map((coord) => {
          return {
            lat: coord.lat(),
            lng: coord.lng(),
          };
        });
    });
  }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to call an Angular component function from a global function, ensuring compatibility with IE11?

Currently, I am facing a challenge while integrating the Mastercard payment gateway api into an Angular-based application. The api requires a callback for success and error handling, which is passed through the data-error and data-success attributes of the ...

When building websites, pages, or applications with React, how do you determine the best choice between JavaScript, TypeScript, or JavaScriptXML?

After completing my portfolio and an eCommerce website design using Figma, I started learning React and Tailwind with Vite. I'm comfortable with basic JavaScript but now I want to understand the differences between .js, .jsx, and .ts files when workin ...

How can I test for equality with an array item using v-if in Vue.js?

Currently, I am facing a challenge in my Vue.js project where I need to determine if a number is equal to an element within an array. Here is the code snippet that I am working with: <div v-if="someValue != arrayElement"> // </div> I am st ...

Tips for adjusting the height of a Mat-Card element within an Angular Material design component

I am currently working on an Angular 5 app and have implemented the following code which generates a sequence of mat-cards as shown in the image below using *ngFor. However, I am facing an issue where all the mat-cards have the same height as the first mat ...

Visual Studio Code is unable to identify the TypeScript module located within the `node_modules` directory

After cloning the tslint repository, running npm install and grunt as instructed in the README, I opened the folder in Visual Studio Code (0.9.1). Upon inspecting a .ts file such as src/rules/typedefRule.ts, TypeScript errors appeared regarding the require ...

Building a personalized mapping system with the Google Maps API

I recently came across a cool feature in Google maps that allows users to add custom options to their website. How can I create something similar, where an info box pops up when you click on a location on the map? Check out this link for an example: If y ...

save the outcomes of the function in a structured dataset

It's been a while since I last did this and my memory is a bit foggy. So please be patient with me and just gently remind me of what I might be missing or doing wrong. Just to clarify, I am working with VueJS 3 / Tailwind 3 within a Laravel 9 Jetstre ...

Implementing Google Authentication with Angular 6

I recently completed a project in angular 6 that showcases google authentication using the angular-6-social-login plugin. To install it, you can use the following command: npm install --save angular-6-social-login After installing the plugin, I made some ...

Issue arises when trying to implement sidebar navigation in Angular with Materialize CSS

Just starting my Angular journey and running into some trouble trying to set up a practical and responsive menu using SidebarNav and Dropdown. I used CLI to install and configure angular2-materialize and materialize-css. To create the menu, I made a comp ...

Revamping and Refreshing JSON-driven Pointers

My website features a jQuery code that displays live .JSON files from an ADS-B receiver with plane lat/long information. I have successfully turned them into markers, but they only update when the page is refreshed. Despite trying setInterval and conduct ...

The onChange event will not be triggered in an input component that is not intended to be uncontrolled

Could someone please assist me in understanding why the onChange event is not being triggered? I am customizing ChakraUI's Input component to retrieve a value from localStorage if it exists. The component successfully retrieves the value from localS ...

Unable to access component properties through react-redux

Context: A React Native application utilizing Redux for managing complexity. Versions: typescript v3.0.3 react-native v0.56.0 redux v4.0.0 @types/react-redux v6.0.9 @types/redux v3.6.0 Issue: The main JSX component in my app is unable to access proper ...

What is the best way to retrieve a specific value from an array of objects based on a condition?

I need some assistance with writing a function. Can you help me out? Let's say I have an array of objects: const movieGen = [ { id: 28, name: "Action" }, { id: 12, name: "Adventure" }, { id: 16, name: "Animation" }, ...

Tips for troubleshooting the error "Cannot locate module mp3 file or its associated type declarations"

https://i.sstatic.net/q4x3m.png Seeking guidance on resolving the issue with finding module './audio/audio1.mp3' or its type declarations. I have already attempted using require('./audio/audio1.mp3'), but continue to encounter an error ...

What is the process of assigning attribute values conditionally in Angular 2?

I'm currently exploring Angular 2 and facing a challenge with a basic material input tag. I want to dynamically set its value based on a condition. <md-input value="dataSelected ? {{selectedDataName}} : ''"></md-input> I attemp ...

Exploring the process of manually establishing a route change stream in Angular versus utilizing the features of the @angular/router module

Why would a developer choose to manually create a stream of route changes instead of utilizing Angular's ActivatedRoute as recommended in the Angular guide? export class HeroListComponent implements OnInit { heroes$: Observable<Hero[]>; pr ...

We are in need of a provider for the Ionic Network native plugin

I have encountered an issue while trying to use Ionics native plugin "Network" as it fails due to a missing provider. To prevent any errors, I performed a fresh installation of Ionic along with the necessary dependencies: ionic cordova plugin add cordova- ...

The Rx min.js file was nowhere to be found in the "node_modules xjsundles" directory even after running npm install rxjs

As I was integrating the component RxJS into my project, I ran the command npm install rxjs. However, upon checking the node_modules/bundles file, I noticed that there is no Rx.min.js present. Instead, I found rxjs.umd.js and rxjs.umd.min.js files. I am c ...

Signing up for a Collection of Observers in Angular

I am facing an issue with my formControls list. I am trying to listen to the valueChanges event of all controls in the list, but I am only able to subscribe to the first control's valueChanges EventEmitter. I attempted to iterate through the controls ...

Publishing Typescript to NPM without including any JavaScript files

I want to publish my *.ts file on NPM, but it only contains type and interface definitions. There are no exported JavaScript functions or objects. Should I delete the "main": "index.js" entry in package.json and replace it with "main": "dist/types.ts" inst ...