def readShape(shapefile, xgrabDB, koppelType=3):
    driver = ogr.GetDriverByName('ESRI Shapefile')
    dataSource = driver.Open(shapefile, 0)
    layer = dataSource.GetLayer(0)
    con = sqlite3.connect(xgrabDB)
    with con:
        cur = con.cursor()
        cur.execute('CREATE INDEX IF NOT EXISTS adresID_index ON ADRESPOSITIES (ID);')
        con.commit()
        for feature in layer:
            geom = feature.GetGeometryRef()
            adresID = feature.GetFieldAsInteger('ADRESID')
            terreinID = feature.GetFieldAsInteger('TERREINOBJ')
            huisnrID = feature.GetFieldAsInteger('HUISNR_ID')
            (X, Y) = (geom.GetX(), geom.GetY())
            updateAdresPosistie(cur, X, Y, koppelType, adresID)
            updateTerrein(cur, terreinID, huisnrID)
            removeDoubleTerreinKoppeling(cur)
        con.commit()
    if con:
        con.close()
def readShape(shapefile, xgrabDB, koppelType=3):
    driver = ogr.GetDriverByName('ESRI Shapefile')
    dataSource = driver.Open(shapefile, 0)
    layer = dataSource.GetLayer(0)
    con = sqlite3.connect(xgrabDB)
    with con:
        cur = con.cursor()
        cur.execute('CREATE INDEX IF NOT EXISTS adresID_index ON ADRESPOSITIES (ID);')
        con.commit()
        for feature in layer:
            geom = feature.GetGeometryRef()
            adresID = feature.GetFieldAsInteger('ADRESID')
            terreinID = feature.GetFieldAsInteger('TERREINOBJ')
            huisnrID = feature.GetFieldAsInteger('HUISNR_ID')
            (X, Y) = (geom.GetX(), geom.GetY())
            updateAdresPosistie(cur, X, Y, koppelType, adresID)
            updateTerrein(cur, terreinID, huisnrID)
            removeDoubleTerreinKoppeling(cur)
        con.commit()
    if con:
        con.close()