Ignore:
Timestamp:
02/04/11 14:43:13 (14 years ago)
Author:
jschierm
Message:

kml: Converted all utilities to use lat/long fields in model rather than x/y, converting if necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/kml/kml_mesh_elem.m

    r7132 r7342  
    1111%
    1212%  and the optional input is:
     13%    latsgn        (numeric, +1/-1 for north/south latitude)
    1314%    data          (numeric, element or nodal results data)
    1415%    alt           (numeric, altitude for polygons, default 10000)
     
    4344    if ischar(varargin{iarg})
    4445        if ~isempty(strmatch(varargin{iarg},...
    45                 {'data','alt',...
     46                {'latsgn','data','alt',...
    4647                 'cmin','cmax','cmap'},...
    4748                'exact'))
     
    5859    end
    5960    iarg=iarg+2;
     61end
     62
     63if isempty(md.lat)  || ((numel(md.lat) == 1)  && isnan(md.lat)) || ...
     64   isempty(md.long) || ((numel(md.long) == 1) && isnan(md.long))
     65    if     ~exist('latsgn')
     66        error(['Missing ''latsgn'' parameter to calculate missing lat/long data.']);
     67    elseif (abs(latsgn) ~= 1)
     68        error(['Incorrect latsgn=' num2str(latsgn) ' parameter to calculate missing lat/long data.']);
     69    else
     70        display('Converting x/y data to lat/long data.');
     71        [md.lat,md.long]=xy2ll(md.x,md.y,latsgn);
     72    end
    6073end
    6174
     
    143156
    144157    for j=1:size(md.elements,2)
    145         [lat,long]=xy2ll(md.x(md.elements(i,j)),md.y(md.elements(i,j)),-1);
    146         kring.coords(j,:)=[long lat alt];
     158        kring.coords(j,:)=[md.long(md.elements(i,j)) md.lat(md.elements(i,j)) alt];
    147159    end
    148160    kring.coords(end,:)=kring.coords(1,:);
Note: See TracChangeset for help on using the changeset viewer.