Last active
January 20, 2019 09:33
-
-
Save refactor/d41a844c8f5826eca0bceca479a5f0b5 to your computer and use it in GitHub Desktop.
Revisions
-
refactor revised this gist
Jan 20, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,6 +35,7 @@ int main(void) { printf("x: %f, y: %f, z: %f\n", x, y, z); OCTDestroyCoordinateTransformation(hTransform); OSRDestroySpatialReference(sr); OGRSpatialReferenceH hUTM = OSRNewSpatialReference(NULL); OSRSetProjCS(hUTM, "UTM 20 / WGS84"); @@ -46,5 +47,7 @@ int main(void) { printf("x: %f, y: %f, z: %f\n", x, y, z); OCTDestroyCoordinateTransformation(hTransform); OSRDestroySpatialReference(hUTM); return 0; } -
refactor revised this gist
Jan 12, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ int main(void) { OGRSpatialReferenceH sr = OSRNewSpatialReference(NULL); OSRImportFromEPSG(sr, 3857); // OSRSetWellKnownGeogCS(sr, "WGS84"); char* ppsz; OSRExportToPrettyWkt(sr, &ppsz, FALSE); printf("3857.wkt: \n%s\n", ppsz); -
refactor revised this gist
Jan 12, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ int main(void) { OSRSetWellKnownGeogCS(sr, "WGS84"); char* ppsz; OSRExportToPrettyWkt(sr, &ppsz, FALSE); printf("3857.wkt: \n%s\n", ppsz); CPLFree(ppsz); printf("3857.au: %s\n", OSRGetAuthorityCode(sr,NULL)); printf("3857.geogcs.au: %s\n", OSRGetAuthorityCode(sr, "GEOGCS")); @@ -41,7 +41,7 @@ int main(void) { OSRSetWellKnownGeogCS(hUTM, "WGS84"); OSRSetUTM(hUTM, 20, TRUE); hTransform = OCTNewCoordinateTransformation(hLatLong, hUTM); OCTTransform(hTransform, 1, &x, &y, &z); printf("x: %f, y: %f, z: %f\n", x, y, z); -
refactor created this gist
Jan 11, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ #include <ogr_srs_api.h> #include <cpl_conv.h> int main(void) { OGRSpatialReferenceH sr = OSRNewSpatialReference(NULL); OSRImportFromEPSG(sr, 3857); OSRSetWellKnownGeogCS(sr, "WGS84"); char* ppsz; OSRExportToPrettyWkt(sr, &ppsz, FALSE); printf("3857.wkt: %s\n", ppsz); CPLFree(ppsz); printf("3857.au: %s\n", OSRGetAuthorityCode(sr,NULL)); printf("3857.geogcs.au: %s\n", OSRGetAuthorityCode(sr, "GEOGCS")); printf("3857.geogcs|unit.au: %s\n", OSRGetAuthorityCode(sr, "GEOGCS|UNIT")); printf("3857.geogcs|datum.au: %s\n", OSRGetAuthorityCode(sr, "GEOGCS|DATUM")); printf("3857.geogcs|datum|spheroid.au: %s\n", OSRGetAuthorityCode(sr, "GEOGCS|DATUM|SPHEROID")); printf("3857.projcs.au: %s\n", OSRGetAuthorityCode(sr, "PROJCS")); //OGRSpatialReferenceH hLatLong = OSRCloneGeogCS(sr); OGRSpatialReferenceH hLatLong = OSRNewSpatialReference(NULL); OSRSetWellKnownGeogCS(hLatLong, "WGS84"); printf("wgs84.au: %s\n", OSRGetAuthorityCode(hLatLong, NULL)); printf("wgs84.geogcs.au: %s\n", OSRGetAuthorityCode(hLatLong, "GEOGCS")); printf("wgs84.geogcs|unit.au: %s\n", OSRGetAuthorityCode(hLatLong, "GEOGCS|UNIT")); printf("wgs84.geogcs|datum.au: %s\n", OSRGetAuthorityCode(hLatLong, "GEOGCS|DATUM")); printf("wgs84.geogcs|datum|spheroid.au: %s\n", OSRGetAuthorityCode(hLatLong, "GEOGCS|DATUM|SPHEROID")); printf("wgs84.projcs.au: %s\n", OSRGetAuthorityCode(hLatLong, "PROJCS")); OGRCoordinateTransformationH hTransform = OCTNewCoordinateTransformation(sr,hLatLong); double x = 12955467.346012; double y = 4854848.34787838; double z = 0; OCTTransform(hTransform, 1, &x, &y, &z); printf("x: %f, y: %f, z: %f\n", x, y, z); OCTDestroyCoordinateTransformation(hTransform); OGRSpatialReferenceH hUTM = OSRNewSpatialReference(NULL); OSRSetProjCS(hUTM, "UTM 20 / WGS84"); OSRSetWellKnownGeogCS(hUTM, "WGS84"); OSRSetUTM(hUTM, 20, TRUE); hTransform = OCTNewCoordinateTransformation(sr, hUTM); OCTTransform(hTransform, 1, &x, &y, &z); printf("x: %f, y: %f, z: %f\n", x, y, z); OCTDestroyCoordinateTransformation(hTransform); return 0; }