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

2 views (last 30 days)
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.

Answers (1)

Chad Greene
Chad Greene on 26 Apr 2016
Edited: Chad Greene on 26 Apr 2016
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.

Categories

Find more on Oceanography and Hydrology in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!