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

2 vues (au cours des 30 derniers jours)
Jonathan Taylor
Jonathan Taylor le 16 Mai 2013
Modifié(e) : Chad Greene le 26 Avr 2016
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.

Réponses (1)

Chad Greene
Chad Greene le 26 Avr 2016
Modifié(e) : Chad Greene le 26 Avr 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.

Catégories

En savoir plus sur Oceanography and Hydrology dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by