@trackunit/geo-json-utils 1.15.18 → 1.15.20-alpha-aedae0c85f6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -900,20 +900,12 @@ const getPolygonFromPointAndRadius = (point, radius) => {
900
900
  const deltaLat = (radius / EARTH_RADIUS) * (180 / Math.PI);
901
901
  const deltaLon = deltaLat / Math.cos((lat * Math.PI) / 180);
902
902
  const coordinates = [];
903
- for (let i = 0; i < pointsCount; i++) {
903
+ for (let i = 0; i <= pointsCount; i++) {
904
904
  const angle = i * angleStep;
905
905
  const newLat = Math.max(-90, Math.min(90, lat + deltaLat * Math.sin(angle)));
906
906
  const newLon = lonCenter + deltaLon * Math.cos(angle);
907
907
  coordinates.push([newLon, newLat]);
908
908
  }
909
- // Close the ring by copying vertex 0 rather than recomputing it at angle 2π: Math.sin(2π) is
910
- // -2.449e-16, and near the equator that offset exceeds half an ulp of the latitude, leaving the
911
- // ring open and failing RFC 7946 validation.
912
- const firstVertex = coordinates[0];
913
- if (firstVertex === undefined) {
914
- return null;
915
- }
916
- coordinates.push([...firstVertex]);
917
909
  const rawLngs = coordinates.map(c => c[0]);
918
910
  const minRawLon = Math.min(...rawLngs);
919
911
  const maxRawLon = Math.max(...rawLngs);
package/index.esm.js CHANGED
@@ -898,20 +898,12 @@ const getPolygonFromPointAndRadius = (point, radius) => {
898
898
  const deltaLat = (radius / EARTH_RADIUS) * (180 / Math.PI);
899
899
  const deltaLon = deltaLat / Math.cos((lat * Math.PI) / 180);
900
900
  const coordinates = [];
901
- for (let i = 0; i < pointsCount; i++) {
901
+ for (let i = 0; i <= pointsCount; i++) {
902
902
  const angle = i * angleStep;
903
903
  const newLat = Math.max(-90, Math.min(90, lat + deltaLat * Math.sin(angle)));
904
904
  const newLon = lonCenter + deltaLon * Math.cos(angle);
905
905
  coordinates.push([newLon, newLat]);
906
906
  }
907
- // Close the ring by copying vertex 0 rather than recomputing it at angle 2π: Math.sin(2π) is
908
- // -2.449e-16, and near the equator that offset exceeds half an ulp of the latitude, leaving the
909
- // ring open and failing RFC 7946 validation.
910
- const firstVertex = coordinates[0];
911
- if (firstVertex === undefined) {
912
- return null;
913
- }
914
- coordinates.push([...firstVertex]);
915
907
  const rawLngs = coordinates.map(c => c[0]);
916
908
  const minRawLon = Math.min(...rawLngs);
917
909
  const maxRawLon = Math.max(...rawLngs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/geo-json-utils",
3
- "version": "1.15.18",
3
+ "version": "1.15.20-alpha-aedae0c85f6.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/geo-json/utils/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}