Changeset 20523


Ignore:
Timestamp:
04/21/16 14:11:52 (9 years ago)
Author:
Mathieu Morlighem
Message:

CHG: faster conversion and more complete documentation

File:
1 edited

Legend:

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

    r20520 r20523  
    66%
    77%   Example:
    8 %      [x,y] = gdaltransform(md.mesh.lat,md.mesh.long,'EPSG:3184','EPSG:3411');
     8%      [x,y] = gdaltransform(md.mesh.long,md.mesh.lat,'EPSG:4326','EPSG:3031')
    99%
    1010%   For reference:
    11 %       EPSG: 4326 (lat,long)
    12 %       EPSG: 3411  (greenland, +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.449 +units=m +no_defs)
    13 %       EPSG: 3031 (antarctica, +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs)
     11%      EPSG: 4326 (lat,long)
     12%      EPSG: 3411 (Greenland,  UPS 45W, 70N)
     13%      EPSG: 3031 (Antarctica, UPS 0E,  71S)
     14%
     15%      ll2xy default projection Antarctica:
     16%        +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.448564109 +units=m +no_defs
     17%      ll2xy default projection Greenland:
     18%        +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.448564109 +units=m +no_defs
     19%      Bamber's Greeland projection
     20%        +proj=stere +lat_0=90 +lat_ts=71 +lon_0=-39 +k=1 +x_0=0 +y_0=0 +a=6378273 +b=6356889.448564109 +units=m +no_defs
     21%
     22%      To get proj.4 string from EPSG, use gdalsrsinfo. Example:    gdalsrsinfo "EPSG:4326" | grep "PROJ.4"
    1423
    1524        %give ourselves a unique temporary directory:
     
    1726
    1827        fid=fopen([temproot '/.rand1234.txt'],'w');
    19         for i=1:length(x),
    20                 fprintf(fid,'%g %g\n',x(i),y(i));
    21         end
     28        fprintf(fid,'%8g %8g\n',[x(:) y(:)]');
    2229        fclose(fid);
    2330
     
    2633                error(r);
    2734        end
    28         A=textread([temproot '/.rand1235.txt']);
    29         xout=A(:,1);
    30         yout=A(:,2);
     35        A=load([temproot '/.rand1235.txt']);
     36        xout=A(:,1); xout=reshape(xout,size(x));
     37        yout=A(:,2); yout=reshape(yout,size(y));
Note: See TracChangeset for help on using the changeset viewer.