Postgres Trunc return of ST_Area() postGIS

314 Views Asked by At

PostgreSQL 8.4.19 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3, 64-bit

POSTGIS="1.4.0" GEOS="3.1.0-CAPI-1.5.0" PROJ="Rel. 4.7.1, 23 September 2009" USE_STATS

I have a procedure that do a simple select:

overlappingArea      float8;
    select ST_Area(st_intersection(table1.geometry, fable2.geometry)) into overlappingArea;

The return for the function ST_Area should be a float8

It happens in order to give me the intersection between two polygons.

The value that I got into the variable overlappingArea is 2.37783222019061e-05

I use it to get the value of table1 over table 2:

 select
      (overlappingArea / st_area(table1.geometry)) * 100
    into pctOverlappingAreaAB;

And it works! the problem is when I do a simple if like that

if (overlappingArea > 0.10 ) then ....

It always return false, also if I try truncate the value like this:

trunc(overlappingArea)

I got 0 why?

0

There are 0 best solutions below