You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
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.')
Cite As
Chad Greene (2026). islatlon(lat,lon) (https://uk.mathworks.com/matlabcentral/fileexchange/50341-islatlon-lat-lon), MATLAB Central File Exchange. Retrieved .
Acknowledgements
Inspired: Sea level rise trend interpolator, SODB Southern Ocean Database Toolbox
General Information
- Version 1.0.0.0 (1.43 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 |
