diff --git a/packages/turf-projection/README.md b/packages/turf-projection/README.md index c6cd94327..d93d5008f 100644 --- a/packages/turf-projection/README.md +++ b/packages/turf-projection/README.md @@ -4,7 +4,7 @@ ## toMercator -Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection +Converts a WGS84 GeoJSON object into Mercator (EPSG:3857) projection ### Parameters @@ -27,7 +27,7 @@ Returns **[GeoJSON][1]** Projected GeoJSON ## toWgs84 -Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection +Converts a Mercator (EPSG:3857) GeoJSON object into WGS84 projection ### Parameters diff --git a/packages/turf-projection/index.ts b/packages/turf-projection/index.ts index 232ff0c99..d07e24ca2 100644 --- a/packages/turf-projection/index.ts +++ b/packages/turf-projection/index.ts @@ -4,7 +4,7 @@ import { AllGeoJSON, isNumber } from "@turf/helpers"; import { clone } from "@turf/clone"; /** - * Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection + * Converts a WGS84 GeoJSON object into Mercator (EPSG:3857) projection * * @function * @param {GeoJSON|Position} geojson WGS84 GeoJSON object @@ -26,7 +26,7 @@ function toMercator( } /** - * Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection + * Converts a Mercator (EPSG:3857) GeoJSON object into WGS84 projection * * @function * @param {GeoJSON|Position} geojson Mercator GeoJSON object @@ -93,7 +93,7 @@ function convert( } /** - * Convert lon/lat values to 900913 x/y. + * Convert lon/lat values to 3857 x/y. * (from https://github.com/mapbox/sphericalmercator) * * @private @@ -102,7 +102,7 @@ function convert( */ function convertToMercator(lonLat: number[]) { var D2R = Math.PI / 180, - // 900913 properties + // 3857 properties A = 6378137.0, MAXEXTENT = 20037508.342789244; @@ -125,7 +125,7 @@ function convertToMercator(lonLat: number[]) { } /** - * Convert 900913 x/y values to lon/lat. + * Convert 3857 x/y values to lon/lat. * (from https://github.com/mapbox/sphericalmercator) * * @private @@ -133,7 +133,7 @@ function convertToMercator(lonLat: number[]) { * @returns {Array} WGS84 [lon, lat] point */ function convertToWgs84(xy: number[]) { - // 900913 properties. + // 3857 properties. var R2D = 180 / Math.PI; var A = 6378137.0; diff --git a/packages/turf-projection/test.ts b/packages/turf-projection/test.ts index ee4ebf34c..2a6151c8d 100644 --- a/packages/turf-projection/test.ts +++ b/packages/turf-projection/test.ts @@ -31,7 +31,7 @@ test("to-mercator", (t) => { for (const { filename, name, geojson } of fromWgs84) { var expected = clone(geojson); coordEach(expected, function (coord) { - var newCoord = proj4("WGS84", "EPSG:900913", coord); + var newCoord = proj4("WGS84", "EPSG:3857", coord); coord[0] = newCoord[0]; coord[1] = newCoord[1]; }); @@ -60,7 +60,7 @@ test("to-wgs84", (t) => { for (const { filename, name, geojson } of fromMercator) { var expected = clone(geojson); coordEach(expected, function (coord) { - var newCoord = proj4("EPSG:900913", "WGS84", coord); + var newCoord = proj4("EPSG:3857", "WGS84", coord); coord[0] = newCoord[0]; coord[1] = newCoord[1]; });