필터 지우기
필터 지우기

Determine if a point is over land or water

조회 수: 23 (최근 30일)
Mike D.
Mike D. 2021년 8월 21일
답변: John 2024년 9월 9일 22:15
Given a point (latitude, longitude), is there a function or easy way to determine if the point is over land or over water?
I could download coastline data from NOAA and determine if a point falls inside a polygon, but I'd rather not develop an algorithm myself if it already exists.
  댓글 수: 2
Mike D.
Mike D. 2021년 8월 24일
I see that File Exchange has a function gebconetcdf that someone created, and then I discovered the code that I need:
gebconc = netcdf.open('gebco_2021_n60.0_s10.0_w-90.0_e-40.0.nc', 'NOWRITE');
XGRID = netcdf.getVar(gebconc,0);
YGRID = netcdf.getVar(gebconc,1);
BATHY = netcdf.getVar(gebconc,2);
netcdf.close(gebconc);
KSSV
KSSV 2021년 8월 24일
ncread is simple to use.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2021년 8월 21일
For a given lon, lat; use interp2 and get the elevation/ bathymetry value, if the value is negative it is depth and lies in the ocean or water and if the value is positive it lies in the land.
  댓글 수: 5
KSSV
KSSV 2021년 8월 24일
Read about ncdisp. This function will give you variables from there you give the variable name.
Mike D.
Mike D. 2021년 8월 24일
Yes, I can see that both ncdisp and ncinfo tell me all about the structure, what I wanted was the few lines of code that allow me to read the binary file into Matlab variables.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

John
John 2024년 9월 9일 22:15
There is now an API service called IsItWater.com which will let you check with a webservice call:
Request
curl 'https://isitwater-com.p.rapidapi.com/?latitude=41.9029192&longitude=-70.2652276&rapidapi-key=YOUR-X-RAPIDAPI-KEY'
Response
{
"water": true,
"latitude": 41.9029192,
"longitude": -70.2652276
}

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by