[postgis-users] Postgis estimated_extent completely off the mark?

Andrea Aime aaime at openplans.org
Tue Mar 20 06:32:40 PDT 2007


Hi,
some of you may know that in geotools we want to
add the ability to compute the bounds using estimated
extents to have a nice speedup, should the user decide
that the approximation of estimated extents is ok for him.

Hum, well, I tried this on my local db with the tiger roads network,
and the result are the followings:

tiger2005fe=# vacuum analyze major_roads;
VACUUM
tiger2005fe=# select estimated_extent('major_roads','gen_full');
                               estimated_extent
----------------------------------------------------------------------------
  BOX(-136.358154296875 17.6881694793701,-64.7429351806641 59.4498023986816)
(1 row)

tiger2005fe=# select extent(gen_full) from major_roads
tiger2005fe-# ;
                                    extent
----------------------------------------------------------------------------
  BOX(-170.837387084961 -14.3779020309448,144.914001464844 66.9222869873047)

Hem, this is not 5% error, it's totally off the mark.
What's going on? I'm on windows, postgres 8.1.5.
The difference is the same in other tables that do
use polygonal features.

Some more info about the tables:

tiger2005fe=# select postgis_version();
             postgis_version
---------------------------------------
  1.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
(1 row)


tiger2005fe=# \d major_roads;
                              Table "public.major_roads"
     Column    |   Type   |                         Modifiers

--------------+----------+------------------------------------------------------
-----
  state        | text     |
  gen_full     | geometry |
  gen_1        | geometry |
  gen_2        | geometry |
  gen_3        | geometry |
  interstate   | integer  |
  ushighway    | integer  |
  statehighway | integer  |
  othername    | text     |
  fid          | integer  | not null default 
nextval('major_roads_fid_seq'::regcl
ass)
Indexes:
     "fid_pkey" PRIMARY KEY, btree (fid)
     "major_roads_spatial_ind" gist (gen_full)
     "major_roads_spatial_ind1" gist (gen_1)
     "major_roads_spatial_ind2" gist (gen_2)
     "major_roads_spatial_ind3" gist (gen_3)

tiger2005fe=# select * from geometry_columns;
  f_table_catalog | f_table_schema |   f_table_name   | 
f_geometry_column | coord
_dimension | srid |   type
-----------------+----------------+------------------+-------------------+------
-----------+------+----------
          2 |    1 | GEOMETRY
                  | public         | major_roads      | gen_full          |
          2 |    1 | GEOMETRY
                  | public         | major_roads      | gen_1             |
          2 |    1 | GEOMETRY
                  | public         | major_roads      | gen_2             |
          2 |    1 | GEOMETRY
                  | public         | major_roads      | gen_3

Hum, may it be because the real geometry type is not declared?
Cheers
Andrea



More information about the postgis-users mailing list