[postgis-users] Calculating bbox/extent for set of polygons: ERROR I don't understand

Josh Livni josh at umbrellaconsulting.com
Sun Aug 19 22:13:57 PDT 2007

I don't know the intricacies of that error, but you have a couple easy 
options.  For just the one county, like in your query - ditch the 
distinct, eg:
SELECT extent(the_geom) FROM shp_precincts WHERE county_id=72;

For all counties, try pulling the geom data out in different style, eg:
SELECT distinct(county_id), astext(extent(the_geom)) as the_extent FROM 
shp_precincts GROUP BY county_id


Matthew Pettis wrote:
> Hi,
> I'm trying to calculate a minimum bbox/extent for a group of polygons 
> with a similar attribute.  For this specific case, I am trying to find 
> a bbox/extent for all of the voting precincts within the same county.
> here is the sql I'm executing:
> =====================
> select
> distinct
>     extent(the_geom) as the_extent
> from
>     shp_precincts
> where
>     county_id = 72
> ;
> =====================
> 'the_geom' is a polygon representing a voting precinct, and the where 
> clause subsets to all voting precincts belonging to a specific 
> county.  I get the following error which I don't understand or know 
> how to correct:
> =====================
> ERROR:  could not identify an ordering operator for type box2d
> HINT:  Use an explicit ordering operator or modify the query.
> =====================
> Any help is appreciated in resolving this.  What I ultimately want to 
> do is have a result set that has a bounding box for each county based 
> on the polygons of precincts that belong to that county.
> tia,
> Matt
> -- 
> It is from the wellspring of our despair and the places that we are 
> broken that we come to repair the world.
> -- Murray Waas
> ------------------------------------------------------------------------
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

More information about the postgis-users mailing list