0

I have a Polygon (a sequence of 2D-points) loaded (I can parse from GPX, Google polyline and GeoJson) in my C# program. And I have around 1000 of 'segments' that also are GeoJson Linestrings.

Some of these segments are 'far away' off the track, while others could perfectly intersect with the track. My question is what the fastest way (ideally using an existing in memory library) would be to detect which segments are part of the overall track. (The points obviously don't have to match 100%, but can be a few meters off the track)

Consider the situation where I have a recorded GPS-track (of a car for example) and I want to check against a library of streets if that track has been driving through those streets. (ideally in the specified direction, if possible)

So, my main questions:

  • Is there an out of the box open source library available that has implemented this?
  • If not, I'm happy to contribute it, but then I'm looking for a good description of such an algorithm.

Further clarification

I have indeed found several options to work out if a point is inside , or on a polygon. (see here).
But the main challenge is to find out if someone has done this before in .net and to understand if there are out of the box possibilities for this.

Any help is appreciated.

Sam Vanhoutte
  • 3,247
  • 27
  • 48
  • 2
    Before asking for *fastest* you are expected to do some research to at least know and implement *one* method. Libary questions are off-topic btw. – Sinatr Oct 27 '20 at 13:20
  • @Sinatr , that does not answer the question, no. As this is about a specific Point being in the Polygon, rather than a sequence of points (linestring) to be "on the Polygon" – Sam Vanhoutte Oct 27 '20 at 13:21
  • Use `for`/`foreach`? Or you need whole figure to be inside? Can you clarify? – Sinatr Oct 27 '20 at 13:22
  • foreach etc, will probably work, but that does not look optimal/fast enough... – Sam Vanhoutte Oct 27 '20 at 13:22
  • Ok, define "fast enough". – Sinatr Oct 27 '20 at 13:23
  • Fast as in the most optimal way to use as less as compute as possible. I have seen ways to do a search like that, using a grid (splitting the different polygons in smaller areas, etc). But yes, I have done quite a bit of research on this, and was just hoping to get some good pointers, before I start inventing what others probably already have done. And none of the queries I did so far seemed to give me those insights, yet... So, forgive me for asking – Sam Vanhoutte Oct 27 '20 at 13:28
  • https://leafletjs.com/examples/quick-start/ just plot the route – Seabizkit Oct 27 '20 at 14:06
  • thanks, seabizkit, but I am not looking for a javascript frontend solution, but for a dotnet backend solution. – Sam Vanhoutte Oct 27 '20 at 14:10
  • @SamVanhoutte seem odd if you are going to map it to something anyway. would probably help a lot if you gave a sample of what you are currently doing. Aka where are you getting your street data.... and then modeling back on to that. Just give sample code of what your data you have.. then what you are attempting to do... fast can come after, once its understood what it is your trying to do. – Seabizkit Oct 27 '20 at 14:32

0 Answers0