In which region does my (arbitrary) point lie?

  • Thread starter billiards
  • Start date
  • Tags
    Point
In summary, the problem is to determine the region of a point in a polygonal map. A possible solution is to ray cast the point and look for the closest polygon.
  • #1
billiards
767
16
My problem is that I have a bunch of regions, in this case they are tectonic plates. Each region has a complex boundary, described by polygons, in a text file with co-ordinates.

images?q=tbn:ANd9GcTtVDIzDfO1gqBZYix7Tzw_gnDnaLJTOEIEOJfR3OBG42k8mZJNJw.jpg


I have a long list of points (>100,000) distributed globally and I need to know in which region each point lies.

Basically I need an algorithm, that can be easily coded up in fortran.

Any helpers?
 
Last edited:
Technology news on Phys.org
  • #2
I don't know how quick that is, but for 100 000 points I think you can spend some time on preprocessing: Divide the map into parts which are easy to handle (like "rectangles" in latitude/longitude), and check which plates and which edges are within a specific rectangle first. This can be done with a loop over the edges, I think. It determines all rectangles with edges, the other rectangles are easy once this is done.
Afterwards, for each point, get the corresponding rectangle (trivial). If it has more than one plate, check the borders in this rectangle.
 
  • #3
Thanks for your reply mfb. I was considering that kind of approach but really I am looking for something that is more transportable, so the code can be used for example with other plate boundary models, or with any arbitrary data set.

I think I may have stumbled upon the solution.

http://en.wikipedia.org/wiki/Point_in_polygon

In fact the code looks like it is available here:

http://rosettacode.org/wiki/Ray-casting_algorithm

I'll have a go and report back.

Cheers
 
  • #4
Well, that needs a lot of calculations, as you have to check every edge for every point.

so the code can be used for example with other plate boundary models, or with any arbitrary data set.
It can, you just have to run the preprocessing again.
 
  • #5
mfb said:
Well, that needs a lot of calculations, as you have to check every edge for every point.

Yes but that's what computers are for :-)
 
  • #6
Well, if computing time is not an issue, sure...
 
  • #7
Just in case anyone wwas wondering. I got my code to work.

If anone ever tries to do this and stumbles upon this thread, the above code is good: I warn you, though: Think carefully about what happens about the Greenwich Meridian (lon=0/360).

ps, I haven't run on my 100 000+ points yet but will do on Monday so I'll let ya''ll know how long it takes. cos I'm sure you're dying to kknow
 

1. What is a region in scientific terms?

A region, in scientific terms, refers to a defined area or space that shares common characteristics or features. This can include physical, biological, or geological features, as well as cultural, political, or economic boundaries.

2. How do scientists determine which region a point belongs to?

Scientists use various methods and tools to determine which region a point belongs to. This can include using geographic coordinates, analyzing data and patterns, or conducting experiments and observations to identify characteristics that define a region.

3. Can a point lie in multiple regions?

Yes, a point can lie in multiple regions if it shares common characteristics or features with those regions. For example, a point on the border between two countries can be considered part of both regions.

4. Are regions static or do they change over time?

Regions can be both static and dynamic, depending on the factors that define them. Some regions, such as physical or geological regions, can remain relatively unchanged over time. However, other regions, such as cultural or political regions, can shift and change as societies and governments evolve.

5. How do regions impact scientific research?

Regions play a crucial role in scientific research as they provide a framework for understanding and analyzing data. By identifying and defining regions, scientists can make comparisons and draw conclusions about the relationships between different areas and their characteristics.

Similar threads

  • Programming and Computer Science
2
Replies
65
Views
2K
  • Programming and Computer Science
Replies
5
Views
806
  • Differential Geometry
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Quantum Interpretations and Foundations
Replies
12
Views
925
  • Introductory Physics Homework Help
Replies
26
Views
553
  • Advanced Physics Homework Help
Replies
14
Views
1K
  • Special and General Relativity
Replies
30
Views
2K
  • Art, Music, History, and Linguistics
Replies
4
Views
975
Back
Top