Changeset 27529


Ignore:
Timestamp:
01/19/23 05:01:08 (2 years ago)
Author:
Mathieu Morlighem
Message:

CHG: simplified epsg2proj

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/coordsystems/epsg2proj.m

    r25455 r27529  
    1010%      return proj4string='+proj=longlat +datum=wgs84 +no_defs'
    1111%
    12         % First, get GDAL version
    13         [s,r]=system(['gdalsrsinfo --version | awk ''{print $2}'' | cut -d ''.'' -f1']);
    1412
    15         if s~=0,
    16                 error(r);
    17         end
     13%Call PROJ library
     14[status, string]=system(['projinfo -o PROJ -q epsg:' num2str(epsg)]);
    1815
    19         version_major=str2num(r);
     16%Check status
     17if status~=0; error(string); end
    2018
    21         [s,r]=system(['gdalsrsinfo epsg:' num2str(epsg) ' | command grep PROJ.4 | tr -d ''\n'' | sed ''s/PROJ.4 : //''']);
    22 
    23         if s~=0,
    24                 error(r);
    25         end
    26 
    27         if version_major==1,
    28                 r=r(2:end-2);
    29         end
    30 
    31         string=(r);
     19%remove trailing  blanks
     20string = deblank(string);
Note: See TracChangeset for help on using the changeset viewer.