Changeset 20122
- Timestamp:
- 02/11/16 19:25:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/geometry/locationtonode.m
r20076 r20122 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 TracChangeset
for help on using the changeset viewer.