I use google maps api in my project. When i call google.maps.geometry.poly.containsLocation() function i’ll got a lot of warning in console and as a result freezing system.
Any help would be highly appreciated.
in my code:
isPolygonIntersect(poly1: google.maps.LatLng[] | google.maps.LatLngLiteral[], poly2: google.maps.LatLng[] | google.maps.LatLngLiteral[]): boolean {
let isIntersect: boolean = false;
let mainPolygon = new google.maps.Polygon({paths:poly1});
poly2.forEach((literal: google.maps.LatLng | google.maps.LatLngLiteral) => {
console.log('isPolygonIntersect', literal, mainPolygon);
if(google.maps.geometry.poly.containsLocation(literal, mainPolygon)) {
isIntersect = true;
}
});
let secondPolygon = new google.maps.Polygon({paths:poly2});
poly1.forEach((literal: google.maps.LatLng | google.maps.LatLngLiteral) => {
if(google.maps.geometry.poly.containsLocation(literal, secondPolygon)) {
isIntersect = true;
}
});
return isIntersect;
}
Dependencies:
"@angular/cli": "~16.1.3",
"@angular/compiler-cli": "^16.1.0",
"@angular/cdk": "^16.1.4",
"@angular/common": "^16.1.0",
"@angular/google-maps": "^16.1.4",
"@types/google.maps": "^3.53.4",
"jasmine-core": "~4.6.0",
"@types/node": "^12.11.1",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~5.1.3"
P.S. Its happen after Angular update, and librarys update.
I experemented with version but it didn’t work.
Im tryed to upgrade/downgrade version of @angular/google-maps, but no results yet.
2
Answers
https://maps.googleapis.com/maps/api/js?v=3&libraries=geometry,drawing,places&key=
You need to add version(v=3) to it. it will definitely resolve your problem
También me sale la misma alerta y frena todo el sistema
enter image description here