Skip to content
Permalink
Browse files

Make geometry typmod available for topology face layer queries

Greatly improves performances on topology loading.
See http://hub.qgis.org/issues/14356
  • Loading branch information
Sandro Santilli
Sandro Santilli committed Feb 22, 2016
1 parent bf583c7 commit d8a768f0a0b1926ead3b42c0fa9e12d35f8905f0
Showing with 9 additions and 4 deletions.
  1. +9 −4 python/plugins/db_manager/db_plugins/postgis/plugins/qgis_topoview/__init__.py
@@ -122,8 +122,10 @@ def run(item, action, mainwindow):
face_extent = layer.extent()

# face geometry
sql = u'SELECT face_id, topology.ST_GetFaceGeometry(%s, face_id) as geom ' \
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame))
sql = u'SELECT face_id, topology.ST_GetFaceGeometry(%s,' \
'face_id)::geometry(polygon, %s) as geom ' \
'FROM %s.face WHERE face_id > 0' % \
(quoteStr(toponame), quoteId(toponame), toposrid)
uri.setDataSource('', u'(%s\n)' % sql, 'geom', '', 'face_id')
uri.setSrid(toposrid)
uri.setWkbType(QGis.WKBPolygon)
@@ -136,8 +138,11 @@ def run(item, action, mainwindow):
legend.setLayerExpanded(layer, False)

# face_seed
sql = u'SELECT face_id, ST_PointOnSurface(topology.ST_GetFaceGeometry(%s, face_id)) as geom ' \
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame))
sql = u'SELECT face_id, ST_PointOnSurface(' \
'topology.ST_GetFaceGeometry(%s,' \
'face_id))::geometry(point, %s) as geom ' \
'FROM %s.face WHERE face_id > 0' % \
(quoteStr(toponame), quoteId(toponame), toposrid)
uri.setDataSource('', u'(%s)' % sql, 'geom', '', 'face_id')
uri.setSrid(toposrid)
uri.setWkbType(QGis.WKBPoint)

0 comments on commit d8a768f

Please sign in to comment.
You can’t perform that action at this time.