diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-22 22:58:18 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-03-22 22:58:18 -0700 |
commit | ba9cc86f667486a09edb323402c2d63ada5ea639 (patch) | |
tree | 8df80eca54f9dd39664f63365ffcc2ec248fb3df /web/app/GeofenceConverter.js | |
parent | 990d485a21c945e7d57b85378650a65f3e79eed3 (diff) | |
parent | f5165c8e897e8d9cf4219d943e2d34b61adb48b5 (diff) | |
download | etbsa-traccar-web-ba9cc86f667486a09edb323402c2d63ada5ea639.tar.gz etbsa-traccar-web-ba9cc86f667486a09edb323402c2d63ada5ea639.tar.bz2 etbsa-traccar-web-ba9cc86f667486a09edb323402c2d63ada5ea639.zip |
Merge branch 'master' into modern
Diffstat (limited to 'web/app/GeofenceConverter.js')
-rw-r--r-- | web/app/GeofenceConverter.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/web/app/GeofenceConverter.js b/web/app/GeofenceConverter.js index 4891e7b..688f223 100644 --- a/web/app/GeofenceConverter.js +++ b/web/app/GeofenceConverter.js @@ -45,7 +45,7 @@ Ext.define('Traccar.GeofenceConverter', { resolutionAtEquator = mapView.getResolution(); pointResolution = ol.proj.getPointResolution(projection, resolutionAtEquator, center); resolutionFactor = resolutionAtEquator / pointResolution; - radius = Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m * resolutionFactor; + radius = Number(coordinates[2]) / ol.proj.Units.METERS_PER_UNIT.m * resolutionFactor; geometry = new ol.geom.Circle(center, radius); } } @@ -68,15 +68,14 @@ Ext.define('Traccar.GeofenceConverter', { }, geometryToWkt: function (projection, geometry) { - var result, i, center, radius, edgeCoordinate, earthSphere, groundRadius, points; + var result, i, center, radius, edgeCoordinate, groundRadius, points; if (geometry instanceof ol.geom.Circle) { center = geometry.getCenter(); radius = geometry.getRadius(); edgeCoordinate = [center[0] + radius, center[1]]; center = ol.proj.transform(center, projection, 'EPSG:4326'); - earthSphere = new ol.Sphere(6378137); - groundRadius = earthSphere.haversineDistance(center, - ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326')); + groundRadius = ol.sphere.getDistance( + center, ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326'), 6378137); result = 'CIRCLE ('; result += center[1] + ' ' + center[0] + ', '; result += groundRadius.toFixed(1) + ')'; |