1

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

closed as too broad by ahmadhanb, Hornbydd, Jochen Schwarze, Vince, PolyGeo Mar 6 at 12:23

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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 6 at 8:09
  • 3
    Would you like skeletons postgis.net/docs/ST_StraightSkeleton.html? – user30184 Mar 6 at 8:13
  • 1
    Possible duplicate of Finding longest line segment within polygon? – Hornbydd Mar 6 at 9:42
  • 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 7 at 8:53
  • 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 8 at 4:56