diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-03-16 17:55:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-16 17:55:36 +0100 |
| commit | 175cbad0a7ca202cefff33f240100b01752f8f73 (patch) | |
| tree | 3969a91e8499312c698d928f262d219d91aaea3b /src/apps/proj.cpp | |
| parent | 78eaa34a4816fd9a36e902adae4663f13bc39fab (diff) | |
| parent | 2247841879faebe007ccade45d04027361d5d26c (diff) | |
| download | PROJ-175cbad0a7ca202cefff33f240100b01752f8f73.tar.gz PROJ-175cbad0a7ca202cefff33f240100b01752f8f73.zip | |
Merge pull request #2065 from rouault/add_proj_get_units_from_database
Add proj_get_units_from_database() (fixes #2004)
Diffstat (limited to 'src/apps/proj.cpp')
| -rw-r--r-- | src/apps/proj.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp index 852cea04..0bf98b3a 100644 --- a/src/apps/proj.cpp +++ b/src/apps/proj.cpp @@ -380,11 +380,18 @@ int main(int argc, char **argv) { (void)printf("%9s %-16s %-16s %s\n", le->id, le->major, le->ell, le->name); } else if (arg[1] == 'u') { /* list units */ - const struct PJ_UNITS *lu; - - for (lu = proj_list_units(); lu->id ; ++lu) - (void)printf("%12s %-20s %s\n", - lu->id, lu->to_meter, lu->name); + auto units = proj_get_units_from_database(nullptr, nullptr, "linear", false, nullptr); + for( int i = 0; units && units[i]; i++ ) + { + if( units[i]->proj_short_name ) + { + (void)printf("%12s %-20.15g %s\n", + units[i]->proj_short_name, + units[i]->conv_factor, + units[i]->name); + } + } + proj_unit_list_destroy(units); } else emess(1,"invalid list option: l%c",arg[1]); exit(0); |
