Skip to content

Commit

Permalink
Non projected ETRS89 GeoDatum fix (EPSG:4258)
Browse files Browse the repository at this point in the history
  • Loading branch information
bosborn committed May 2, 2022
1 parent ef65936 commit cd23626
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Adheres to [Semantic Versioning](http://semver.org/).

## 1.0.3 (TBD)

* TBD
* Non projected ETRS89 GeoDatum fix (EPSG:4258)

## [1.0.2](https://github.com/ngageoint/coordinate-reference-systems-ios/releases/tag/1.0.2) (02-09-2022)

Expand Down
3 changes: 2 additions & 1 deletion crs-ios/util/proj/CRSProjParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ +(void) updateDatumWithParams: (CRSProjParams *) params andGeoDatum: (NSObject<C

CRSGeoDatums *commonGeoDatum = [CRSGeoDatums fromName:[geoDatum name]];

if(commonGeoDatum != nil){
// Check for special cases like EPSG 4258 which specify the ellipsoid
if(commonGeoDatum != nil && commonGeoDatum.type != CRS_DATUM_ETRS89){
[params setDatum:[commonGeoDatum code]];
}else{
[self updateEllipsoidWithParams:params andEllipsoid:[geoDatum ellipsoid]];
Expand Down
48 changes: 48 additions & 0 deletions crs-iosTests/util/proj/CRSProjParserTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,54 @@ -(void) test4071{

}

/**
* Test EPSG 4258
*/
-(void) test4258{

// +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs

NSMutableString *definition = [NSMutableString string];
[definition appendString:@"GEOGCRS[\"ETRS89\",ENSEMBLE[\"European Terrestrial Reference System 1989 ensemble\","];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1989\", ID[\"EPSG\",1178]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1990\", ID[\"EPSG\",1179]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1991\", ID[\"EPSG\",1180]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1992\", ID[\"EPSG\",1181]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1993\", ID[\"EPSG\",1182]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1994\", ID[\"EPSG\",1183]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1996\", ID[\"EPSG\",1184]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 1997\", ID[\"EPSG\",1185]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 2000\", ID[\"EPSG\",1186]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 2005\", ID[\"EPSG\",1204]],"];
[definition appendString:@"MEMBER[\"European Terrestrial Reference Frame 2014\", ID[\"EPSG\",1206]],"];
[definition appendString:@"ELLIPSOID[\"GRS 1980\",6378137,298.257222101,LENGTHUNIT[\"metre\",1,ID[\"EPSG\",9001]],ID[\"EPSG\",7019]],"];
[definition appendString:@"ENSEMBLEACCURACY[0.1],ID[\"EPSG\",6258]],"];
[definition appendString:@"CS[ellipsoidal,2,ID[\"EPSG\",6422]],"];
[definition appendString:@"AXIS[\"latitude (Lat)\",north],AXIS[\"longitude (Lon)\",east],"];
[definition appendString:@"ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9102]],"];
[definition appendString:@"ID[\"EPSG\",4258]]"];

NSString *expected = @"+proj=longlat +ellps=GRS80 +no_defs";
[CRSTestUtils assertEqualWithValue:expected andValue2:[CRSProjParser paramsTextFromText:definition]];

definition = [NSMutableString string];
[definition appendString:@"GEOGCS[\"ETRS89\","];
[definition appendString:@"DATUM[\"European_Terrestrial_Reference_System_1989\","];
[definition appendString:@"SPHEROID[\"GRS 1980\",6378137,298.257222101,"];
[definition appendString:@"AUTHORITY[\"EPSG\",\"7019\"]],"];
[definition appendString:@"TOWGS84[0,0,0,0,0,0,0],"];
[definition appendString:@"AUTHORITY[\"EPSG\",\"6258\"]],"];
[definition appendString:@"PRIMEM[\"Greenwich\",0,"];
[definition appendString:@"AUTHORITY[\"EPSG\",\"8901\"]],"];
[definition appendString:@"UNIT[\"degree\",0.0174532925199433,"];
[definition appendString:@"AUTHORITY[\"EPSG\",\"9122\"]],"];
[definition appendString:@"AUTHORITY[\"EPSG\",\"4258\"]]"];

expected = @"+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
[CRSTestUtils assertEqualWithValue:expected andValue2:[CRSProjParser paramsTextFromText:definition]];

}

/**
* Test EPSG 4326
*/
Expand Down

0 comments on commit cd23626

Please # to comment.