How can I filter out latitude & longitude data that lies outside of a designated region?

7 views (last 30 days)
I suppose I am stuck on how to initially approach this problem. I am undertaking a project in which I would like to plot all lightning strikes that have occurred in a particular year within the territory of Poland. However, some of the data detected lies outside of this country. I would like to filter said data out so that I can produce a map of this data as well as do some analysis of it.
I have tried using a variety of methods, such as using the filterm command, using the geoshow command and trying to create a buffer of the country shape and only include data within the buffer, or simply trying to create a rough polygon around the country and trying to include data within the specified region.
I would just like to know whether any of these proposed methods will give me solution that I want? If so, which one would be the best to attempt or if there are any better suggestions?
I hope this is enough information to help answer my question as I am not expecting someone to just code up my data.
Thank-you.

Answers (1)

Veda Upadhye
Veda Upadhye on 15 Nov 2017
Hi Alex,
You may find it useful to look at this example using the 'filterm' function:
https://www.mathworks.com/help/map/ref/filterm.html
The example goes through how you could choose specific latitude and longitude points using a reference matrix.
In case you are not working with latitude and longitude coordinates, you can use the 'inpolygon' function to get indices of points(x,y) that lie inside the boundary points/ closed region (xb,yb). With these indices, you can select your points which lie inside the given closed region.
Hope this helps!
-Veda

Products

Community Treasure Hunt

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

Start Hunting!