[postgis-users] Re: [Mapserver-users] Finding Extent

Tyler Mitchell TMitchell at lignum.com
Mon May 10 08:43:35 PDT 2004


> "select xmin(extent(the_geom)),
> ymin(extent(the_geom)),xmax(extent(the_geom)),ymax(extent(the_geom))
> from nc where parcels_id in (<list of parcels>);"

Two ideas,
1) Won't "select extent(the_geom)..." give you something you can use, 
without the need to repeat that step four times?
2) If this is something that is going to be requested repeatedly, ask 
yourself:
        a) how often will the data be changing?
        b) how can I preprocess the information so it's quicker?

If you truly need four separate columns, then I recommend creating them in 
your parcels_id table.  Then calculate the values, i.e.:

>update parcels_id set my_xmin = xmin(extent(the_geom))

Or, create a trigger that calculates this for you automatically when new 
data is added or data is changed. 

I'm not sure about your situation, but the moral of the story on 
performance is usually: pre-process the data as much as possible and, if 
possible, keep it reduced to a non spatial query to reduce overhead.

Hope that helps.
Tyler



More information about the postgis-users mailing list