-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(polygon, polyline): add getPath and getPaths #991
Conversation
Adds the MVCArray type and wrappers for the `getPath()` and `getPaths()` Google Maps API methods.
@willshowell lol Thanks |
@SebastianM @lazarljubenovic any chance of getting this reviewed? As far as I can tell, editable polygons are useless without a way to later retrieve the path. |
Hi @willshowell Any chance of an example on Plunker? Not been successful so far! |
import { Component, ViewChild } from '@angular/core';
import { AgmPolygon } from '@agm/core';
@Component({
selector: 'app-root',
styleUrls: ['./app.component.css'],
template: `
<agm-map
[latitude]="lat"
[longitude]="lon"
[zoom]="zoom">
<agm-polygon
[paths]="path"
[polyDraggable]="true"
[editable]="true">
</agm-polygon>
</agm-map>
<button (click)="getPath()">GET PATH</button>
`
})
export class AppComponent {
@ViewChild(AgmPolygon) polygon: any;
// google maps zoom level
zoom: number = 8;
// initial center position for the map
lat: number = 51.673858;
lng: number = 7.815982;
path = [
{ lat: 51.791629704426924, lng: -0.8624267578125 },
{ lat: 51.974729774949644, lng: 0.6317138671875 },
{ lat: 51.303145259199056, lng: 0.6646728515625 },
{ lat: 51.416338106400396, lng: -0.4779052734375 }
];
getPath() {
this.polygon.getPaths().then((x: any[]) => {
x.forEach(y => {
console.log('-');
y.forEach(z => console.log(z.lat(), z.lng()));
});
});
}
} Note that you'll probably also need the changes from #990 Hope that helps! |
@willshowell how can I use your changes in this pull from my angular project? thanks |
It would be super neat to have this merged in, or a similar feature made at least. Its currently impossible to get the new paths of the polygon after it has been edited which is a shame. |
@willshowell any chance you can update this for conflicts, and then we can all yell at @SebastianM to merge this? I am stuck without this. |
What's up with this? Would be happy if this could be merged. |
I would also be happy to see this getting merged. I've spend too much time already trying to find another way around. |
I would be happy if this could be merged. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
What the point with this issues? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@willshowell can you please fix conflicts? Also, while this is nice, what we really need is a path event. |
How can I get the coordinates of another map on same component? |
Adds the
MVCArray
type and wrappers for thegetPath()
andgetPaths()
Google Maps API methods.This should partially address requirements in #823