Hi everyone

First post. I apologise in advance if this question is a little elementary, but I hope you are able to help.

I am working on some travel sites and would like to try to work out whether a given point is in a given area.

Let's suppose I had longitude/latitude information for Manhattan's boundary. I have a series of co-ordinates which I join together by a straight line in order to define the area.

Now... let's suppose I am given co-ordinates for, let's say, the Empire State Building and Bronx Zoo. I want to be able to mathematically deduce whether these two points fall inside or outside the boundary. Obviously, in this case, the ESB does, and the BZ doesn't. But is that easy to work out automatically?

Please note, I am not a mathematician so really need an explanation of how to work this out that a non-mathematician would understand!

Thanks a lot,

Aaron

2. Originally Posted by altyfc
Hi everyone

First post. I apologise in advance if this question is a little elementary, but I hope you are able to help.

I am working on some travel sites and would like to try to work out whether a given point is in a given area.

Let's suppose I had longitude/latitude information for Manhattan's boundary. I have a series of co-ordinates which I join together by a straight line in order to define the area.

Now... let's suppose I am given co-ordinates for, let's say, the Empire State Building and Bronx Zoo. I want to be able to mathematically deduce whether these two points fall inside or outside the boundary. Obviously, in this case, the ESB does, and the BZ doesn't. But is that easy to work out automatically?

Please note, I am not a mathematician so really need an explanation of how to work this out that a non-mathematician would understand!

Thanks a lot,

Aaron
If I understand you correctly...

If you have the boundaries' coordinates, then the latitiude of the point must be a value between the latitudes if the boundaries AND its longitude must be a value between the longitude of that of the boundaries.

3. Thank you for the reply but - alas - I don't think it's as simple as that.

Take this map for example:

If you take the "L" of Lugano... this point is within the lat/long extremes but, because of the irregular shape, it doesn't fall within the boundaries of the specific region.

4. Originally Posted by altyfc
Thank you for the reply but - alas - I don't think it's as simple as that.

Take this map for example:

If you take the "L" of Lugano... this point is with the lat/long extremes but, because of the irregular shape, it doesn't fall within the boundaries of the specific region.

Excuse me for not understanding, but why would you want to check if the text is in the area? Are you not concerned about the point only?

EDIT: Oh maybe you only used the "L" as an example. I can honestly not think of a way to check if it would be in the area if the area has such an irregular shape.

5. Yes, the L was just an example... I was simply illustrating that it didn't 'work' for the method I think you were suggesting.

I just want to find whether point x (for which I would have lat/long co-ordinates) fits in area y (for which I would have a series of co-ordinates which, when connected together, would mark the boundary).

I'm sure there must be a way...

Aaron

6. Originally Posted by janvdl
If I understand you correctly...

If you have the boundaries' coordinates, then the latitiude of the point must be a value between the latitudes if the boundaries AND its longitude must be a value between the longitude of that of the boundaries.
What about the red dot? It's outside the figure but inside the longitude and latitude boundaries that you specified.

-Dan

7. Yes, that's right.

This is the same point as I was trying to make. But your diagram illustrates it much more clearly, thank you.

8. Originally Posted by topsquark
What about the red dot? It's outside the figure but inside the longitude and latitude boundaries that you specified.

-Dan

I didn't consider abnormal shapes...

How exactly will it be determined? By computer?

9. Yes, we would be looking to decipher this by computer, as we'd be wanting to do this for multiple points (thousands, in fact!).

We just need to somehow grasp an understanding of the maths that any scripting would need to be based on.

10. Originally Posted by altyfc
Yes, we would be looking to decipher this by computer, as we'd be wanting to do this for multiple points (thousands, in fact!).

We just need to somehow grasp an understanding of the maths that any scripting would need to be based on.
Why not divide the map into small squares?

11. I imagine that might be a possibility but I just assumed there must be a way of calculating this more immediately... ??

12. Originally Posted by altyfc
I imagine that might be a possibility but I just assumed there must be a way of calculating this more immediately... ??
My knowledge is too limited for this, I'm sorry. Maybe one of our senior mathematicians will take a look at this and let you know if it's possible.

EDIT: Since it's going to be on a computer, why not define the positions of the pixels as boundaries, and check if a point is between the specific row of pixels?

13. Originally Posted by janvdl
EDIT: Since it's going to be on a computer, why not define the positions of the pixels as boundaries, and check if a point is between the specific row of pixels?
Unless I'm misunderstanding you, I think that's the same as your original suggestion, and won't allow for irregular shapes.

Should I be posting this in the advanced geometry forum? It's too advanced for me, but I was hesitant about posting it there straight off, as I wasn't sure if it would be considered 'advanced' here...

14. Originally Posted by altyfc
Unless I'm misunderstanding you, I think that's the same as your original suggestion, and won't allow for irregular shapes.
No let's say on a specific line, we have a part of the boundary. Or a few pixels, as the left boundary. And on the same horisontal line, we have the right boundary of a few pixels. Now we check that the point itself, is between the pixels.

So we are dividing the whole map into pixels. And then we check for all the black pixels which we say makes up the outer border of a country, for example.

Originally Posted by altyfc
Should I be posting this in the advanced geometry forum? It's too advanced for me, but I was hesitant about posting it there straight off, as I wasn't sure if it would be considered 'advanced' here...
No keep it in this forum. You will get in trouble for "double posting".

15. But, even if your point falls between the left-hand-most boundary and the right-hand-most, you will can't necessarily make the assumption that a point between those two points is within your area.... I don't think, at least.

Page 1 of 2 12 Last