Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there a possibility to determine the longest side of a polygon with QGIS? As I need to do that for hundreds of polygons I would prefer an automized method (like a plugin).

So far my idea was:

  • transforming a polygon into a line
  • cut it on the vertices
  • measure the length
  • here I became stuck, how to become the longest line without checking the whole bunch of lines one by one?

looking forward to your answer

share|improve this question
    
related: gis.stackexchange.com/questions/27531/… –  underdark Apr 22 '13 at 16:17
add comment

1 Answer

If you can use PostGIS, try using the ST_LongestLine function like this:

SELECT ST_LongestLine(geom, geom)
FROM mypolytable;

This will find the longest line that can be drawn within each polygon geometry. Note that I'm using this function that references the same geometry column geom twice.

share|improve this answer
    
Thanks for your answer. The function you mentioned returns the 2-dimensional longest line points of two geometries but Im looking for the longest line of a single polygon. Am i wrong? Anybody else an idea?? –  ragavendra Apr 24 '13 at 15:53
    
Two geometries is actually one geometry when you reference the same geometry twice, as I have described. Did you try it? –  Mike T Apr 24 '13 at 23:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.