1

I hope that this is not the wrong place for my question, however, when I don't have anywhere else to go, SO never lets me down.

I am looking for a way to convert any given polygon on a map, to a serpentine line string. I would like to pass the polygon as a geography data type (it could be a poly string) which then takes the polygon, and generates a line string covering the entire area of the polygon.

The below images illustrates perfectly what I want to achieve in the sense that I want to provide the blue polygon and I want the green path to be returned either as a collection of points or a geography data type:

enter image description here

Taken from https://robotics.stackexchange.com/questions/14539/generate-a-coverage-path-given-a-polygon-region

I have scoured the internet and cannot seem to find any code examples around how to get this done. I would like to do this in C# preferable but I am not too fussy about the language. Second to C# I can look at using SQL too or even Python as a last resort.

I have read countless articles on Path planning but they all seem to be overkill in terms of what I want to achieve.

Could anybody point me in any direction as to how I can achieve this? Any information or samples will be highly appreciated.

I have thought about breaking the polygon down to its boundary lines and draw a serpentine line string across it by manually checking if a given point is within the bounds of the polygon. Surely there has to be a more efficient way to achieve this? Maybe a ready made API of some sort?

Joachim Prinsloo
  • 618
  • 3
  • 12
  • 31
  • 1
    The normal method is to use KML which is XML format for maps. KML consists of layers where one layer may be a terrain another layer street names and a third layer directions from starting point to ending point. So you want to create a new polygon layer and add to existing map. – jdweng Jan 30 '20 at 16:06
  • Thanks @jdweng. I will investigate this. Perhaps something like google earth has API's which can create a KML file which I can then consume. – Joachim Prinsloo Jan 30 '20 at 16:12
  • The polygon could be generate with any tool as long as it was scaled and position concurred with the map layer. – jdweng Jan 30 '20 at 17:30
  • It is not generating the polygon that is the challenge. I have the polygon as I drew it on the map. I now need to dynamically generate the line string coverage path (the green in the image) dynamically and I need to ensure that the green never goes outside of the blue as per the reference image. it needs to successfully calculate the green everytime no matter what the shape of the polygon. – Joachim Prinsloo Jan 30 '20 at 17:36

0 Answers0