Skip to content

Commit c7e8fa3

Browse files
cycsmailmfedderly
andauthored
Use official EPSG:3857 code instead of deprecated EPSG:900913 in projection docs (#3101)
Co-authored-by: mfedderly <24275386+mfedderly@users.noreply.github.com>
1 parent 104f994 commit c7e8fa3

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

packages/turf-projection/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## toMercator
66

7-
Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
7+
Converts a WGS84 GeoJSON object into Mercator (EPSG:3857) projection
88

99
### Parameters
1010

@@ -27,7 +27,7 @@ Returns **[GeoJSON][1]** Projected GeoJSON
2727

2828
## toWgs84
2929

30-
Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
30+
Converts a Mercator (EPSG:3857) GeoJSON object into WGS84 projection
3131

3232
### Parameters
3333

packages/turf-projection/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AllGeoJSON, isNumber } from "@turf/helpers";
44
import { clone } from "@turf/clone";
55

66
/**
7-
* Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
7+
* Converts a WGS84 GeoJSON object into Mercator (EPSG:3857) projection
88
*
99
* @function
1010
* @param {GeoJSON|Position} geojson WGS84 GeoJSON object
@@ -26,7 +26,7 @@ function toMercator<G = AllGeoJSON | Position>(
2626
}
2727

2828
/**
29-
* Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
29+
* Converts a Mercator (EPSG:3857) GeoJSON object into WGS84 projection
3030
*
3131
* @function
3232
* @param {GeoJSON|Position} geojson Mercator GeoJSON object
@@ -93,7 +93,7 @@ function convert(
9393
}
9494

9595
/**
96-
* Convert lon/lat values to 900913 x/y.
96+
* Convert lon/lat values to 3857 x/y.
9797
* (from https://github.com/mapbox/sphericalmercator)
9898
*
9999
* @private
@@ -102,7 +102,7 @@ function convert(
102102
*/
103103
function convertToMercator(lonLat: number[]) {
104104
var D2R = Math.PI / 180,
105-
// 900913 properties
105+
// 3857 properties
106106
A = 6378137.0,
107107
MAXEXTENT = 20037508.342789244;
108108

@@ -125,15 +125,15 @@ function convertToMercator(lonLat: number[]) {
125125
}
126126

127127
/**
128-
* Convert 900913 x/y values to lon/lat.
128+
* Convert 3857 x/y values to lon/lat.
129129
* (from https://github.com/mapbox/sphericalmercator)
130130
*
131131
* @private
132132
* @param {Array<number>} xy Mercator [x, y] point
133133
* @returns {Array<number>} WGS84 [lon, lat] point
134134
*/
135135
function convertToWgs84(xy: number[]) {
136-
// 900913 properties.
136+
// 3857 properties.
137137
var R2D = 180 / Math.PI;
138138
var A = 6378137.0;
139139

packages/turf-projection/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test("to-mercator", (t) => {
3131
for (const { filename, name, geojson } of fromWgs84) {
3232
var expected = clone(geojson);
3333
coordEach(expected, function (coord) {
34-
var newCoord = proj4("WGS84", "EPSG:900913", coord);
34+
var newCoord = proj4("WGS84", "EPSG:3857", coord);
3535
coord[0] = newCoord[0];
3636
coord[1] = newCoord[1];
3737
});
@@ -60,7 +60,7 @@ test("to-wgs84", (t) => {
6060
for (const { filename, name, geojson } of fromMercator) {
6161
var expected = clone(geojson);
6262
coordEach(expected, function (coord) {
63-
var newCoord = proj4("EPSG:900913", "WGS84", coord);
63+
var newCoord = proj4("EPSG:3857", "WGS84", coord);
6464
coord[0] = newCoord[0];
6565
coord[1] = newCoord[1];
6666
});

0 commit comments

Comments
 (0)