[postgis-users] Collecting points for the overall bounding box

Marc Jacquin marc.jacquin at magellium.fr
Mon Jun 30 08:53:11 PDT 2008


Robert,

 

Actually the extent function is what I needed ! I was focused on that box2d

 

 

Finally the query “select extent(transform(the_geom,4326)) from mytable”
takes 400 ms to perform on 100 000 records and returns a BBOX(
..). 

 

That helped a LOT!  Tons of thanks! 

 

Marc

  _____  

De : postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] De la part de
Burgholzer,Robert
Envoyé : lundi 30 juin 2008 17:19
À : PostGIS Users Discussion
Objet : RE: [postgis-users] Collecting points for the overall bounding box 

 

Just to clarify, I didn’t test out the query before I sent it.  If you use
the syntax that I gave, you will need to set the SRID on the geometry
returned from extent(), as follows:

 

select box2d(transform(setsrid(extent(geometry),26918),4326)) from mytable

 

Where you would put your geometries original projection is in place of
26918.

 

HTH

 

Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

rwburgholzer at deq.virginia.gov

804-698-4405

Open Source Modeling Tools:

http://sourceforge.net/projects/npsource/

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Burgholzer,Robert
Sent: Monday, June 30, 2008 10:08 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Collecting points for the overall bounding box 

 

Marc,

Would the following work: box2d(transform( extent(wkb_geometry), 4326) )

 

I think that you will achieve an efficiency from the following points:

 

1.      you should not need to collect, if all you want is the bounding box,
since extent() should give you that

2.      Even if you DO have to use collect, you will save lots of
computation time by doing the transform on the final aggregate (1
transform), rather than for every record (100,000 transforms).

 

Robert W. Burgholzer

Surface Water Modeler

Office of Water Supply and Planning

Virginia Department of Environmental Quality

rwburgholzer at deq.virginia.gov

804-698-4405

Open Source Modeling Tools:

http://sourceforge.net/projects/npsource/

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Marc
Jacquin
Sent: Monday, June 30, 2008 9:23 AM
To: 'PostGIS Users Discussion'
Subject: [postgis-users] Collecting points for the overall bounding box 

 

Hi all,

 

The request is quite simple, something like:

 

SELECT box2d(collect(transform(wkb_geometry,4326))) FROM mytable

 

Mytable contains about 100000 records of a point type geometry. A GIST index
is available for the table but it takes several minutes on a respectable
recent dual-core with 4 Gb of RAM. 

 

Any idea would be helpful.

 

Thx.

 

Marc

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080630/503f7821/attachment.html>


More information about the postgis-users mailing list