Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/turf-projection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
12 changes: 6 additions & 6 deletions packages/turf-projection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +26,7 @@ function toMercator<G = AllGeoJSON | Position>(
}

/**
* 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
Expand Down Expand Up @@ -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
Expand All @@ -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;

Expand All @@ -125,15 +125,15 @@ 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
* @param {Array<number>} xy Mercator [x, y] point
* @returns {Array<number>} WGS84 [lon, lat] point
*/
function convertToWgs84(xy: number[]) {
// 900913 properties.
// 3857 properties.
var R2D = 180 / Math.PI;
var A = 6378137.0;

Expand Down
4 changes: 2 additions & 2 deletions packages/turf-projection/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
});
Expand Down Expand Up @@ -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];
});
Expand Down
Loading