0

Below I have an image representation of a map with different regions labeled on it.

enter image description here

My problem is that I need to find out what region a randomly generated point on the map will be in.

I know the x_min, y_min, x_max, y_max of all the different regions meaning I have the coordinates for all the vertices of each rectangular region. I also know the coordinate of the point.

What you can do, and what I have done, is just go through a big condition statement checking through one by one if the x & y coordinate of the point is between the x_min and x_max and y_min and y_max of every region. However, I feel like there has to be a more scalable, generalizable, and efficient way to do this. I however cannot find a way to do so, at least not something that isn't in a library for a different programming language. I thought of maybe doing something where I split the map in half, find out which half the point lies in, count up all the regions in that half, check if there is one region left and if not, split the map in half again and go through the process again. I just don't have a good idea of how that can be implemented and whether that is feasible or better that the current method I have.

MrMineHeads
  • 111
  • 1
  • 5
  • If you create a SHP file and then use GINSIDE. – Reeza Aug 04 '21 at 19:05
  • @Reeza is that available for JSL? – MrMineHeads Aug 05 '21 at 00:48
  • No, GINSIDE would be a SAS solution. JSL is only for JMP which is not SAS. If that's the case, you need to change your tags. – Reeza Aug 05 '21 at 15:29
  • Sorry then, I was confused because I thought JMP was based off of SAS. I'll edit out the tag. – MrMineHeads Aug 05 '21 at 16:46
  • SAS as a company makes JMP but it has no relation in terms of the tag or usage. I don't think you'll find support here for JMP in my experience either, usually the JMP user forum is the best approach. The developers can help out there as well or you can ask tech support for JMP. If you have the licensed product you pay for tech support and they're quite helpful. – Reeza Aug 05 '21 at 16:47
  • https://community.jmp.com/ – Reeza Aug 05 '21 at 16:48
  • I'll ask there then too, but I hoped I could at least get an abstract solution here so I could implement that myself on jsl. – MrMineHeads Aug 05 '21 at 16:52

0 Answers0