Determining whether a point on earth (given latitude and longitude) is on land or ocean
21 ビュー (過去 30 日間)
古いコメントを表示
I am looking for a quick way to determine whether a point on earth's surface (given latitude and longitude) falls on one of the continents or on an ocean.
Any help is greatly appreciated.
Thanks, Deep
1 件のコメント
Walter Roberson
2011 年 2 月 9 日
Where do you place the dividing line for estuaries ? Or for reclaimed land?
回答 (5 件)
Amy Haskins
2015 年 4 月 1 日
編集済み: Amy Haskins
2015 年 4 月 1 日
You could also try the inpolygon function.
% Load the coastline
coast = load('coast.mat');
ax = worldmap('world');
geoshow(coast)
% Grab a point from the map
[lat,lon] = inputm(1,ax);
% Determine if it's within the coast polygon
isInland = inpolygon(lat,lon,coast.lat,coast.long);
0 件のコメント
Brett Shoelson
2011 年 2 月 9 日
I think this will do it. It is a binary classifier: Ocean/Land.
coast = load('coast.mat');
[Z, R] = vec2mtx(coast.lat, coast.long, ...
1, [-90 90], [-90 270], 'filled');
figure; worldmap(Z, R)
geoshow(Z, R, 'DisplayType', 'texturemap')
colormap([0 1 0;0 0 0;0 1 0;0 0 1])
lat = 38.53;%N
lon = -57.07;%W
plotm(lat,lon,'ro')
val = ltln2val(Z, R, lat, lon);
isOcean = val == 2
%isLand = ~isOcean
Cheers,
Brett
1 件のコメント
Dan Chavas
2014 年 2 月 11 日
I've put this code into a MATLAB file: http://www.mathworks.com/matlabcentral/fileexchange/45268-landorocean-m
Joshua Carmichael
2023 年 10 月 4 日
The Matlatb function isinterior.m (new since 2022a) does this.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Mapping Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!