source:
issm/oecreview/Archive/19101-20495/ISSM-20121-20122.diff@
20498
Last change on this file since 20498 was 20498, checked in by , 9 years ago | |
---|---|
File size: 1.2 KB |
-
../trunk-jpl/src/m/geometry/locationtonode.m
1 function node =locationtonode(md,location)1 function nodes=locationtonode(md,location,varargin) 2 2 %LOCATIONTONODE - find, given a string location (ex: 'LA', 'new york', the nearest node on a mesh3dsurface. 3 3 % 4 4 % Usage: 5 5 % node=locationnode(md,'LA'); 6 % nodes=locationnode(md,'LA',100); %option, specify a distance (km) around the location that will return nodes 6 7 % 7 8 % See also: geoCode (in externalpackages), find_point 8 9 9 coords=geoCode(location,'osm'); 10 latny=coords(1); longny=coords(2); 11 node=find_point(md.mesh.lat,md.mesh.long,latny,longny); 10 if nargin==3, 11 radius=varargin{1}; 12 else 13 radius=0; 14 end 15 16 coords=geoCode(location,'osm'); 17 latny=coords(1); longny=coords(2); 18 node=find_point(md.mesh.lat,md.mesh.long,latny,longny); 19 20 if radius>0, 21 distance=sqrt( (md.mesh.x-md.mesh.x(node)).^2 + (md.mesh.y-md.mesh.y(node)).^2 + (md.mesh.z-md.mesh.z(node)).^2); 22 nodes=find(distance<radius*1000); 23 else 24 nodes=node; 25 end 26 end
Note:
See TracBrowser
for help on using the repository browser.