islatlon(lat,lon)

版本 1.0.0.0 (1.4 KB) 作者: Chad Greene
Boolean check to see if input arrays likely represent geo coordinates.
458.0 次下载
更新时间 2015/3/30

查看许可证

Determine whether inputs may represent geographical (lat,lon) coordinates. This function does not return element-by-element determination, but rather returns true if all input lat values are between -90 and 90 inclusive and all input lon values are between -180 and 360 inclusive. If any element in either lat or lon lies outside its expected range, islatlon is false.
I use this function frequently as a subfunction where users may want to enter geo lat,lon values or map x,y values. Typically, when using map coordinates, at least one value will exceed lat,lon ranges, so if values are in the thousands, it's probably map x,y coordinates. islatlon is also a nice compact way to include two function input checks with a single assertion like

assert(islatlon(lat,lon)==1,'Values must be geographic coordinates.')

引用格式

Chad Greene (2024). islatlon(lat,lon) (https://www.mathworks.com/matlabcentral/fileexchange/50341-islatlon-lat-lon), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2012b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0