FWIW, in Postgis is a function since 1.5, ST_Longestline that returns the longestline between two geometries. If you feed that function with the same geometry twice instead of two different, you will get the longest line in that geometry.
@Whuber. you write above that the longest line doesn't have to start and end in the polygons vertexes. You use the letter I as example. I don't get it. If I is represented by a Line with two vertexes, then that line has to be the longest line itself, right?
If the I letter is represented by a thin polygon, the longestline will be a diagonal line from say left upper vertex to right lower vertex.
But I cannot understand how there could be a longest line that doesn't end and start in polygon vertexes.
Do I miss understand something?
Ok, Whuber, I misunderstood you, I read your answer once more. I was talking about what you call the diameter and you were talking about something else. Sorry