Check if different points are contained in boundary of an xyz file.

2 ビュー (過去 30 日間)
Jonathan Taylor
Jonathan Taylor 2013 年 5 月 16 日
編集済み: Chad Greene 2016 年 4 月 26 日
I have an xyz file that defines a coastal bathymetry. The xyz file consists only of negative numbers representing water depths. It was originally sampled (almost) regularly, so that it almost fits on a regular grid. However, I don't have that semi-grid file. There are also holes or rather islands in the shape defined. Now I want to check if a given point lies within this bathymetry, or if it is outside the boundary or on an 'island'. The point does not come from the xyz file, but may lie between those points in the file. Just a yes or no as to wether it is in. I can't do a contour because many boundary points have different depth values. Can anyone help me with a way to essentially 'color' the area where I have data, and then see if a given (x,y) point would be in that colored area? Plotting it to check is easy, but there are millions of points to handle. Thanks for any suggestions.

回答 (1 件)

Chad Greene
Chad Greene 2016 年 4 月 26 日
編集済み: Chad Greene 2016 年 4 月 26 日
You can use xyz2grid to get the xyz data into a gridded format, then use inpolygon with a land area outline to determine which points are inside or outside the land area. The inpolygon function does not require a gridded dataset, but if your interest is in plotting the bathymetry with pcolor, surf, imagesc, or contour, you'll need the data in a complete grid.

カテゴリ

Help Center および File ExchangeOceanography and Hydrology についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by