Skip to content

Commit

Permalink
feature(Crs): add isGeocentric method.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoqueux committed Nov 17, 2021
1 parent 1a4f44d commit 1ab76c8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Core/Geographic/Crs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ function is4326(crs) {
return crs === 'EPSG:4326';
}

function isGeocentric(crs) {
const projection = proj4.defs(crs);
return !projection ? false : projection.projName == 'geocent';
}

function _unitFromProj4Unit(projunit) {
if (projunit === 'degrees') {
return UNIT.DEGREE;
Expand Down Expand Up @@ -120,6 +125,14 @@ export default {
* @return {boolean}
*/
is4326,
/**
* Is the CRS geocentric ?
* if crs isn't defined the method returns false.
*
* @param {string} crs - The CRS to test.
* @return {boolean}
*/
isGeocentric,

/**
* Give a reasonnable epsilon to use with this CRS.
Expand Down

0 comments on commit 1ab76c8

Please sign in to comment.