Why am I detecting UK relation is inside England relation?

Hi, I am writing a ray casting algorithm which works well but I am getting an unexpected result that the UK is not all outside of England when it really is. I am visually impaired and hope that someone can give me some sighted help by looking at the geometry of the situation which will explain the odd result. Below are the details.

I am testing if all UK nodes that make up the UK relation 62149 are inside the England relation 58447. I should get an even number from the ray cast algorithm for every single node as they are either all outside or I cater for shared nodes. However, I get 4 nodes out of about 28,000 that give an odd number and hence get classed as inside England.

When I test the UK node 312182514 against England it intersects in 3 places.

Intersection 1: At node 312182520 which is actually the first of a series of nodes all on the same latitude and exactly level with the UK node at 51.593 degrees. My algorithm discards all the other horizontally level nodes. But it looks like the general direction of travel of the way is bottom left to top right.

Intersection 2: A clean intersection between nodes 312182509 and 312182524.

Intersection 3: A clean intersection between nodes 11132397718 and 11132397717

All 3 of these intersections are far off to the east of my UK node.

I believe that all 3 of these intersections are legitimate and the only thing I can think of is that there is a fourth intersection I am not accounting for though why this should be I don’t know.

So, please is anyone able to take a look at this scenario and help explain what might be going on?

The fact I only get 4 incorrect results suggests I can’t be far wrong. I also have success checking out other relations. Hopefully there is something simple going on.

Many thanks for any help,

5 posts - 2 participants

Read full topic

Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/why-am-i-detecting-uk-relation-is-inside-england-relation/110207