Search code examples
mariadbarea

ST_AREA is not enough precise


I am trying to save polygon area when a new polygon has been created by the user. I found that there is a function for this purpose - ST_AREA, but when I check if it is calculating correct I find some discrepancies. Here is one example: This is one polygon which area according to geojson.io is 31.85:

geojson.io picture

But when I run ST_AREA for the same polygon:

SELECT ST_Area(CONCAT(a.polygon, 'SRID=4326'))*10000 AS area FROM kt_polygons a where polygon_id = 180;

The result is 34.93261884737489. Something more, I am not quite sure why I multiply the result area by 10000.. I just do that because the result seems to be more realistic in that way. I check some other polygons and the difference is not more than 5, but why this can happen? Any ideas what I do wrong?


Solution

  • I found a solution which helps for my case. When I get the result from ST_Area I multiply it by 9090,91. This coefficient maybe is propriate only for my problem, but you can find if there is dependency between the real areas and the one from ST_Area. If so, you can find your coefficient.