Skip to main content
Simplified OP's code
Source Link
Joseph
  • 76.3k
  • 7
  • 172
  • 286

Try adding joinObject.memoryCache = True before you initiate the join:

from PyQt4.QtCore import *
import qgis
from qgis.core import QgsMapLayerRegistry, QgsVectorJoinInfo

shp = QgsMapLayerRegistry.instance().mapLayersByName( "MyShapefile" )[0]
csv = QgsMapLayerRegistry.instance().mapLayersByName( "MyDatabase" )[0]

# Set up join parameters
shpField='PIN'
csvField='UPIN'
joinObject = QgsVectorJoinInfo()
joinObject.joinLayerId = csv.id()
joinObject.joinFieldName = csvField
joinObject.targetFieldName = shpField
joinObject.memoryCache = True
shp.addJoin(joinObject)
# shp.createJoinCaches()

Try adding joinObject.memoryCache = True before you initiate the join:

# Set up join parameters
shpField='PIN'
csvField='UPIN'
joinObject = QgsVectorJoinInfo()
joinObject.joinLayerId = csv.id()
joinObject.joinFieldName = csvField
joinObject.targetFieldName = shpField
joinObject.memoryCache = True
shp.addJoin(joinObject)

Try adding joinObject.memoryCache = True before you initiate the join:

from PyQt4.QtCore import *
import qgis
from qgis.core import QgsMapLayerRegistry, QgsVectorJoinInfo

shp = QgsMapLayerRegistry.instance().mapLayersByName( "MyShapefile" )[0]
csv = QgsMapLayerRegistry.instance().mapLayersByName( "MyDatabase" )[0]

# Set up join parameters
shpField='PIN'
csvField='UPIN'
joinObject = QgsVectorJoinInfo()
joinObject.joinLayerId = csv.id()
joinObject.joinFieldName = csvField
joinObject.targetFieldName = shpField
joinObject.memoryCache = True
shp.addJoin(joinObject)
# shp.createJoinCaches()
Source Link
Joseph
  • 76.3k
  • 7
  • 172
  • 286

Try adding joinObject.memoryCache = True before you initiate the join:

# Set up join parameters
shpField='PIN'
csvField='UPIN'
joinObject = QgsVectorJoinInfo()
joinObject.joinLayerId = csv.id()
joinObject.joinFieldName = csvField
joinObject.targetFieldName = shpField
joinObject.memoryCache = True
shp.addJoin(joinObject)