Skip to content

Commit

Permalink
restore func
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Jun 6, 2024
1 parent 9e14980 commit f3da719
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions inst/include/gdallibrary/gdallibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,22 +658,22 @@ inline List gdal_read_geometry(CharacterVector dsn,
inline CharacterVector gdal_proj_to_wkt(CharacterVector proj_str) {
OGRSpatialReference oSRS;
char *pszWKT = nullptr;
// oSRS.SetFromUserInput(proj_str[0]);
// #if GDAL_VERSION_MAJOR >= 3
// const char *options[3] = { "MULTILINE=YES", "FORMAT=WKT2", NULL };
// OGRErr err = oSRS.exportToWkt(&pszWKT, options);
// #else
// OGRErr err = oSRS.exportToWkt(&pszWKT);
// #endif
//
oSRS.SetFromUserInput(proj_str[0]);
#if GDAL_VERSION_MAJOR >= 3
const char *options[3] = { "MULTILINE=YES", "FORMAT=WKT2", NULL };
OGRErr err = oSRS.exportToWkt(&pszWKT, options);
#else
OGRErr err = oSRS.exportToWkt(&pszWKT);
#endif

CharacterVector out = Rcpp::CharacterVector::create("not a WKT string");
// if (err) {
// out = Rcpp::CharacterVector::create(NA_STRING);
// CPLFree(pszWKT);
// } else {
// out = Rcpp::CharacterVector::create(pszWKT);
// }
//
if (err) {
out = Rcpp::CharacterVector::create(NA_STRING);
CPLFree(pszWKT);
} else {
out = Rcpp::CharacterVector::create(pszWKT);
}

return out;
}

Expand Down

0 comments on commit f3da719

Please sign in to comment.