I have a polygon and a surface that covers only part of this polygon (this is in 2-D x and y axis). Is there any way to delimit the surface by the polygon? I want only the part that is inside the polygon.
Thanks.
Best Answer
Without any sample data or illustrations it's mighty difficult to know exactly what you mean, but it sounds likeinpolygon is the function you're looking for. Just feed it the x,y locations of your surface (generated bymeshgrid) and it will tell you which corresponding surface locations are inside the polygon.
Note that longitude is horizontal and latitude is vertical, so you'd need to swap LAT and LON in your call to inpolygon. (Like you have in your call to isinterior in the solution you found.)
Best Answer