2

I am looking for a GIS tool/script (preference on QGIS but I can also use ArcGIS/Matlab) that allows creating a polyline layer from a polygon layer where a polyline is drawn for each polygon. The polyline is drawn being the main direction of the polygon and being within the polygon.

Below examples in image:

Main direction polyline within polygon

Another example following comments

I do not have preference for the drawing method (vertex to vertex or edge to edge, skeletons), only the result is important:

This question can be closed as I found a suitable arcgis tool: Polyline to centerline

I would have preferred a Qgis tool but it is OK for now.

Results of the tool below on real polygon layer:

Results of the tool

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Bol
  • 29
  • 3
  • 3
    Welcome to GIS.se! Interesting problem. Could you click 'edit' and expand on your thinking about it? For example, how would you deal with a polygon that didn't have a single long centre axis, but was curved around like a fat 'C'? Defining the exact steps will get you closer to getting a solution. – Simbamangu Mar 06 '19 at 08:09
  • 3
    Would you like skeletons https://postgis.net/docs/ST_StraightSkeleton.html? – user30184 Mar 06 '19 at 08:13
  • 1
  • Not really a software recommendation, but you know that the longest line has to be either a line from one vertex to another, that does not intersect the boundary of the polygon more than twice, or the extension of one vertex to another, that does not intersect the polygon more than twice (this case is sort of shown in your example) – Rob Mar 06 '19 at 09:47
  • Thank you for your answers. Skeletons approach is closed to what would like but not exactly. I cannot test the solution proposed in the following post ([Finding longest line segment within polygon? [closed]]) as I have an arcgis version of 10.5.1 and GME is limited to 10.3. – Bol Mar 06 '19 at 10:46
  • Please decide which of QGIS and ArcGIS Desktop you wish to ask about in this particular question. – PolyGeo Mar 06 '19 at 12:24
  • Although neither an ArcGIS or QGIS solution but there is a java script available on github which attempts to help solve such problems. – Joseph Mar 06 '19 at 12:45
  • PolyGeo, If you don't mind I would prefer to keep the two softwares in order to not restrict solution to one of them. Joseph, thank you for your answer, but according to the example shown of the webpage it is not exactly what I am looking for – Bol Mar 06 '19 at 13:21
  • @Bol, your updated diagrams are very worthwhile; I'd add more text to explain the process you are imagining (plain language steps!) to get the results you show. For example, the first diagram shows a line from a vertex to a vertext; the second shows a line along the skeleton then intersecting partway along an edge; the 'satisfactory' solution - well, I can't actually understand what the logic is there (it's not the widest line edge-to-edge, what is it?). If you edit the post and refine what you're asking it'll probably be re-opened! – Simbamangu Mar 06 '19 at 14:37
  • 2
    Thanks for the update - you say you have 'no preference for the drawing method' but the way you want to solve the problem (the process) seems to be variable and we need more guidance! (It's this "defining the problem" requirement on SE which is really valuable - don't get discouraged, you have an interesting problem but we can't tackle it until you explain it completely). You need to clearly explain why the skeleton solution does not work, for example! – Simbamangu Mar 07 '19 at 08:53
  • Thank you @Simbamangu to help me to improve my post. However, I manage to find a solution that suits me with the following ArcGis tool: Polygon to center line – Bol Mar 07 '19 at 16:04
  • If both products are important to you just ask two questions that differ only in which product you are using when asking that particular question. – PolyGeo Mar 07 '19 at 22:13
  • 1
    @Bol - that's great! May I suggest that you delete the solution you posted in the question and instead create an answer? (By the way - looks like 'skeletons' were exactly what you were after in the end?) – Simbamangu Mar 08 '19 at 04:56
  • @Simbamangu, sorry but I don't see how to add an answer, maybe because the question is set as "on hold"? – Bol Mar 11 '19 at 08:23
  • Aha - best if you go ahead and re-edit your question and remove that answer; the question is already nominated for re-opening. – Simbamangu Mar 11 '19 at 09:56

0 Answers0