[postgis-users] length and area in the schema

Emilia Venturato venturato at faunalia.it
Fri Jun 16 05:53:20 PDT 2006


Hi all,
I use postgresql/postgis (PostgreSQL 8.1.4/ POSTGIS 1.1.2) on Debian etch. I 
have database with schemas.
I found a problem with length and area functions when geometric tables are in 
the schema.
It seems use different function for lenght where search_path is limited to the 
schema.
I think this is misleading, as the user have problems knowing which length and 
area (s)he's getting.

Someone could help me?
thanks

Lia


More information:

LENGTH:

--I have a geometric table (linestring) in the schema 'pi_cens':

 \d pi_cens.hydroschema_1
      Tabella "pi_cens.hydroschema_1"
 Colonna  |      Tipo       | Modificatori
----------+-----------------+--------------
 gid      | integer         |
 cat      | bigint          |
 the_geom | public.geometry |

-- if I do:

set search_path to public;

select gid, length (the_geom) as length, public.length(the_geom) as 
public_length from pi_cens.hydroschema_1 order by gid; 

--results are:

gid  |      length      |  public_length
------+------------------+------------------
    1 | 284.579119841808 | 284.579119841808
    2 | 278.483583486187 | 278.483583486187
    3 | 564.156704174909 | 564.156704174909
    4 | 190.820394680818 | 190.820394680818
    5 | 1224.30798443593 | 1224.30798443593
...


-- if I do instead (the same query but with different search_path):

set search_path to pi_cens;

select gid, length (the_geom) as length, public.length(the_geom) as 
public_length from pi_cens.hydroschema_1 order by gid; 

gid  | length |  public_length
------+--------+------------------
    1 |    114 | 284.579119841808
    2 |    130 | 278.483583486187
    3 |    178 | 564.156704174909
    4 |     98 | 190.820394680818
    5 |    402 | 1224.30798443593
...

AREA:

--I have a geometric table (polygon) in the schema 'pi_cens':

\d pi_cens.fieldschema
          Tabella "pi_cens.fieldschema"
 Colonna  |         Tipo          | Modificatori
----------+-----------------------+--------------
 gid      | integer               |
 cat      | integer               |
 label    | character varying(24) |
 the_geom | geometry    

-- If I do:

set search_path to public;

select gid, area (the_geom) as area, public.area(the_geom) as public_area from 
pi_cens.fieldschema order by gid;

--results are:

 gid |       area       |   public_area
-----+------------------+------------------
   0 | 3051647.04492188 | 3051647.04492188
   1 | 338179.840087891 | 338179.840087891
   2 |  89976863.703125 |  89976863.703125
   3 |  89976863.703125 |  89976863.703125
   4 |  705469.06640625 |  705469.06640625
   5 | 661486.389648438 | 661486.389648438
...

-- if I do instead (the same query but with different search_path):

set search_path to pi_cens;

select gid, area (the_geom) as area, public.area(the_geom) as public_area from 
pi_cens.fieldschema order by gid;


--results are:

gid |      area      |   public_area
-----+----------------+------------------
   0 |        3524218 | 3051647.04492188
   1 |     386083.875 | 338179.840087891
   2 | 187038117.5625 |  89976863.703125
   3 | 187038117.5625 |  89976863.703125
   4 |     742453.125 |  705469.06640625
   5 |       688366.5 | 661486.389648438
...



-- 
Emilia Venturato
email+jabber: venturato at faunalia.it
www.faunalia.it
Tel: (+39) 347-2770007 Tel+Fax: (+39) 0587-213742
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy



More information about the postgis-users mailing list