MCPcopy Create free account
hub / github.com/OSGeo/PROJ / exportToPROJString

Method exportToPROJString

src/iso19111/common.cpp:327–346  ·  view source on GitHub ↗

@cond Doxygen_Suppress

Source from the content-addressed store, hash-verified

325
326//! @cond Doxygen_Suppress
327std::string UnitOfMeasure::exportToPROJString() const {
328 if (type() == Type::LINEAR) {
329 auto proj_units = pj_list_linear_units();
330 for (int i = 0; proj_units[i].id != nullptr; i++) {
331 if (::fabs(proj_units[i].factor - conversionToSI()) <
332 1e-10 * conversionToSI()) {
333 return proj_units[i].id;
334 }
335 }
336 } else if (type() == Type::ANGULAR) {
337 auto proj_angular_units = pj_list_angular_units();
338 for (int i = 0; proj_angular_units[i].id != nullptr; i++) {
339 if (::fabs(proj_angular_units[i].factor - conversionToSI()) <
340 1e-10 * conversionToSI()) {
341 return proj_angular_units[i].id;
342 }
343 }
344 }
345 return std::string();
346}
347//! @endcond
348
349// ---------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

pj_list_linear_unitsFunction · 0.85
pj_list_angular_unitsFunction · 0.85

Tested by

no test coverage detected