Skip to content
Advertisement

How calculate the max area from random point in a MYSQL table

I have a table with this data : x,y column

0 0,1 2,5 2,5 1,2 1 (they are random points)

with this point how can i get the biggest area posible.

Sample:

select area(ST_GEOMFROMTEXT( ‘POLYGON( (0 0,1 3,5 3,5 1,3 1,0 0) )’ )) = 10

select area(ST_GEOMFROMTEXT( ‘POLYGON( (0 0,1 3,5 3,5 1,0 0) )’ )) = 11

note: in the table I do not know the best order of the points

Do you have any suggestion ?

Advertisement

Answer

thanks Akina, I was able to fix the problem with this CONVEXHULL.

select   AREA(ST_CONVEXHULL(ST_GEOMFROMTEXT( 'MultiPoint( 0 0,1 2,5 2,5 1,2 1 )' )))
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement