QGIS uses estimated extent of PostGIS layers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

QGIS uses estimated extent of PostGIS layers

McDonaldR

Hello folks

I've come across a problem using the geo-processing tools in QGIS and the extents of layers from PostGIS.

It seems like QGIS is using an estimated extent for a PostGIS layer which then leads to issues when using geo-processing tools (creating a TIN or Voronoi polygon set, for example).  Loading the same dataset as a shapefile returns an exact extent.

For a point dataset, for example, I get the following extents in QGIS and PostGIS:

QGIS extents as PostGIS layer

xMin,yMin 318359.56,731243.81 : xMax,yMax 373588.41,779145.12

 

QGIS extents as Shapefile layer

xMin,yMin 316723.00,731481.00 : xMax,yMax 373315.00,782722.00

 

PostGIS extents

 

SELECT ST_EstimatedExtent('schema','tablename','geometry') AS estextent,

 ST_Extent(geometry) AS bextent

 FROM schema.tablename;

 

Estimated - BOX(318359.5625 731243.8125,373588.40625 779145.125) ; 

Exact - BOX(316722.999997809 731480.999996626,373314.999999305 782721.999996855)

The PostGIS estimated extent matches the QGIS estimated extent and is smaller than the exact extent.  The shapefile exact extent matches the PostGIS exact extent. In this case the estimated extent is 91% of the exact extent which is somewhat sub-optimal...

 

I’m running QGIS 2.6, 2.8.3 and 2.10.1 with PostgreSQL 9.2.13 and PostGIS 2.1.8 on Windows 7 32bit.

 

I have tried with my PostGIS connection set with and without the “use estimated metadata” and have updated the table statistics in the database with VACUUM ANALYSE but still get the same results.  I imagine the estimated extents make things a bit faster.

 

There are also a number of reports on this

 

https://hub.qgis.org/issues/13232

https://hub.qgis.org/issues/10335 (in this case the PostGIS extent was bigger than the shapefile extent)

 

Anyone got any suggestions as to how to fix this?

 

Thanks

 

Ross

 

Ross McDonald | GIS Data Coordinator | Resources Department, IT Division | Angus Council, Angus House, Orchardbank Business Park, Forfar, DD8 1AT

T: 01307 476419 | F: 01307 476401 | E: [hidden email]

 

 

 

This message is strictly confidential. If you have received this in error, please inform the sender and remove it from your system. If received in error you may not copy, print, forward or use it or any attachment in any way. This message is not capable of creating a legal contract or a binding representation and does not represent the views of Angus Council. Emails may be monitored for security and network management reasons. Messages containing inappropriate content may be intercepted. Angus Council does not accept any liability for any harm that may be caused to the recipient system or data on it by this message or any attachment.


_______________________________________________
qgis-uk-user mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/qgis-uk-user