mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Make geometry typmod available for topology face layer queries
Greatly improves performances on topology loading. See http://hub.qgis.org/issues/14356
This commit is contained in:
parent
bf583c7236
commit
d8a768f0a0
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user