Get markers inside Polygon
Hi, I have a polygon that i show/hide to make a selection of markers on the map, I made it like this:
map.component.html:
<button *ngIf="!showPolygon" md-raised-button color="default" class="lasso" (click)="validatePolygon()">
<md-icon>check</md-icon>
</button>
<button *ngIf="!showPolygon" md-raised-button color="default" class="lasso" (click)="initPolygon()">
<md-icon>add</md-icon>
</button>
<sebm-google-map
[latitude]="lat"
[longitude]="lng"
[zoom]="zoom"
[disableDefaultUI]="true"
[zoomControl]="true"
[keyboardShortcuts]="true"
[usePanning]="true"
>
<sebm-map-polygon
*ngIf="showPolygon"
[paths]="paths"
[editable]="true"
[polyDraggable]="true"
[geodesic]="true">
</sebm-map-polygon>
<marker-cluster-preleveurs [points]="_listePreleveur" (notify)="clickedPreleveur($event)"></marker-cluster-preleveurs>
map.component.ts: `
constructor( private mapsAPILoader: MapsAPILoader,
private ngZone: NgZone)
{ }
paths: Array<LatLngLiteral> = []
public showPolygon = false;
initPolygon(){
this.paths =
[
{ lat: 48, lng: 2 },
{ lat: 48, lng: 3 },
{ lat: 49, lng: 3 },
{ lat: 49, lng: 2 },
{ lat: 48, lng: 2 }
];
this.showPolygon = true;
}
cancelPolygon(){
this.showPolygon = false;
}
validatePolygon(){
//TODO
}`
I wanted to know, how can i verify if my markers (_listePreleveur) are inside the drawn polygon with their GPS coordinates when I click on check ? Or better, with the elements of _listePreleveur that have latitude and longitude parameters !
Thank you :)
hi @Kresys Where you able to figure out how to do this? I have the exact same problem.
Thanks
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.