In which region does my (arbitrary) point lie?

  • Thread starter Thread starter billiards
  • Start date Start date
  • Tags Tags
    Point
Click For Summary

Discussion Overview

The discussion revolves around the problem of determining which tectonic plate region a large number of global points (over 100,000) lies within, based on complex polygonal boundaries defined in a text file. Participants explore algorithmic approaches for efficiently solving this problem, considering both preprocessing techniques and specific algorithms.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant seeks an algorithm suitable for identifying the region of each point relative to tectonic plate boundaries, specifically mentioning a preference for a Fortran implementation.
  • Another participant suggests a preprocessing approach that involves dividing the map into manageable rectangles to reduce the number of checks needed for each point, proposing a loop over edges to identify relevant rectangles first.
  • A different participant expresses interest in a more transportable solution that could apply to various datasets, referencing the "Point in Polygon" problem and a ray-casting algorithm as potential solutions.
  • Concerns are raised about the computational intensity of checking every edge for every point, with some participants acknowledging that this is manageable given sufficient computing resources.
  • One participant shares that they successfully implemented their code and warns about potential complications related to the Greenwich Meridian when processing longitude values.

Areas of Agreement / Disagreement

Participants generally agree on the need for an efficient algorithm to handle the problem, but there are differing views on the best approach to take, particularly regarding preprocessing and the computational load involved. The discussion remains unresolved regarding the optimal method for implementation.

Contextual Notes

Participants mention the need for preprocessing and the implications of using different boundary models, indicating that the solution may depend on specific assumptions about the data structure and computational resources available.

billiards
Messages
765
Reaction score
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
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.
 
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
 
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.
 
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 :-)
 
Well, if computing time is not an issue, sure...
 
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
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
65
Views
5K
Replies
5
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
3K
Replies
7
Views
3K
  • · Replies 26 ·
Replies
26
Views
4K