Skip to content

Commit 413f771

Browse files
committed
common types and proj parsing updates
1 parent 8186133 commit 413f771

7 files changed

Lines changed: 992 additions & 7 deletions

File tree

src/main/java/mil/nga/crs/common/Units.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public Unit createUnit() {
266266
* unit name
267267
* @return units type
268268
*/
269-
public static Units getType(String name) {
269+
public static Units fromName(String name) {
270270
return nameTypes.get(name.toLowerCase());
271271
}
272272

@@ -277,8 +277,8 @@ public static Units getType(String name) {
277277
* unit
278278
* @return units type
279279
*/
280-
public static Units getType(Unit unit) {
281-
return getType(unit.getName());
280+
public static Units fromUnit(Unit unit) {
281+
return fromName(unit.getName());
282282
}
283283

284284
/**

src/main/java/mil/nga/crs/geo/Ellipsoid.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,23 @@ public void addIdentifiers(List<Identifier> identifiers) {
229229
this.identifiers.addAll(identifiers);
230230
}
231231

232+
/**
233+
* Get the pole radius
234+
*
235+
* @return pole radius
236+
*/
237+
public double getPoleRadius() {
238+
double poleRadius;
239+
if (inverseFlattening != 0) {
240+
double flattening = 1.0 / inverseFlattening;
241+
double eccentricity2 = 2 * flattening - flattening * flattening;
242+
poleRadius = semiMajorAxis * Math.sqrt(1.0 - eccentricity2);
243+
} else {
244+
poleRadius = semiMajorAxis;
245+
}
246+
return poleRadius;
247+
}
248+
232249
/**
233250
* {@inheritDoc}
234251
*/

0 commit comments

Comments
 (0)