@turf/projection
Advanced tools
Comparing version 7.1.0 to 7.2.0
@@ -7,3 +7,3 @@ import { Position } from 'geojson'; | ||
* | ||
* @name toMercator | ||
* @function | ||
* @param {GeoJSON|Position} geojson WGS84 GeoJSON object | ||
@@ -26,3 +26,3 @@ * @param {Object} [options] Optional parameters | ||
* | ||
* @name toWgs84 | ||
* @function | ||
* @param {GeoJSON|Position} geojson Mercator GeoJSON object | ||
@@ -29,0 +29,0 @@ * @param {Object} [options] Optional parameters |
@@ -14,9 +14,7 @@ // index.ts | ||
var mutate = options.mutate; | ||
if (!geojson) | ||
throw new Error("geojson is required"); | ||
if (!geojson) throw new Error("geojson is required"); | ||
if (Array.isArray(geojson) && isNumber(geojson[0])) | ||
geojson = projection === "mercator" ? convertToMercator(geojson) : convertToWgs84(geojson); | ||
else { | ||
if (mutate !== true) | ||
geojson = clone(geojson); | ||
if (mutate !== true) geojson = clone(geojson); | ||
coordEach(geojson, function(coord) { | ||
@@ -37,10 +35,6 @@ var newCoord = projection === "mercator" ? convertToMercator(coord) : convertToWgs84(coord); | ||
]; | ||
if (xy[0] > MAXEXTENT) | ||
xy[0] = MAXEXTENT; | ||
if (xy[0] < -MAXEXTENT) | ||
xy[0] = -MAXEXTENT; | ||
if (xy[1] > MAXEXTENT) | ||
xy[1] = MAXEXTENT; | ||
if (xy[1] < -MAXEXTENT) | ||
xy[1] = -MAXEXTENT; | ||
if (xy[0] > MAXEXTENT) xy[0] = MAXEXTENT; | ||
if (xy[0] < -MAXEXTENT) xy[0] = -MAXEXTENT; | ||
if (xy[1] > MAXEXTENT) xy[1] = MAXEXTENT; | ||
if (xy[1] < -MAXEXTENT) xy[1] = -MAXEXTENT; | ||
return xy; | ||
@@ -47,0 +41,0 @@ } |
{ | ||
"name": "@turf/projection", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"description": "turf projection module", | ||
@@ -67,5 +67,5 @@ "author": "Turf Authors", | ||
"devDependencies": { | ||
"@turf/truncate": "^7.1.0", | ||
"@turf/truncate": "^7.2.0", | ||
"@types/benchmark": "^2.1.5", | ||
"@types/tape": "^4.2.32", | ||
"@types/tape": "^4.13.4", | ||
"benchmark": "^2.1.4", | ||
@@ -75,16 +75,16 @@ "load-json-file": "^7.0.1", | ||
"proj4": "^2.9.2", | ||
"tape": "^5.7.2", | ||
"tsup": "^8.0.1", | ||
"tsx": "^4.6.2", | ||
"typescript": "^5.2.2", | ||
"tape": "^5.9.0", | ||
"tsup": "^8.3.5", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.5.4", | ||
"write-json-file": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@turf/clone": "^7.1.0", | ||
"@turf/helpers": "^7.1.0", | ||
"@turf/meta": "^7.1.0", | ||
"@turf/clone": "^7.2.0", | ||
"@turf/helpers": "^7.2.0", | ||
"@turf/meta": "^7.2.0", | ||
"@types/geojson": "^7946.0.10", | ||
"tslib": "^2.6.2" | ||
"tslib": "^2.8.1" | ||
}, | ||
"gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef" | ||
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867" | ||
} |
@@ -12,3 +12,3 @@ # @turf/projection | ||
* `geojson` **([GeoJSON][1] | [Position][2])** WGS84 GeoJSON object | ||
* `options` **[Object][3]?** Optional parameters | ||
* `options` **[Object][3]?** Optional parameters (optional, default `{}`) | ||
@@ -36,3 +36,3 @@ * `options.mutate` **[boolean][4]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`) | ||
* `geojson` **([GeoJSON][1] | [Position][2])** Mercator GeoJSON object | ||
* `options` **[Object][3]?** Optional parameters | ||
* `options` **[Object][3]?** Optional parameters (optional, default `{}`) | ||
@@ -39,0 +39,0 @@ * `options.mutate` **[boolean][4]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25388
144
0
Updated@turf/clone@^7.2.0
Updated@turf/helpers@^7.2.0
Updated@turf/meta@^7.2.0
Updatedtslib@^2.8.1