Example #1
0
def loadWithColumns(site_id):
    #sites.update(micro)
    #sites.update(stormdrains)
    #sites.update(sewers)
    #sites.update(publictransportation)
    sites.update(basins)
    #sites.update(billboards)
    sites.update(hydro)
    #sites.update(roads)
    ds = DataSource(dbinfo)
    ds.loadLayerDict(sites)
    ds.config.setSiteLayer('proposed_sites')
    #ds.config.setTerrainLayer('tin_pts')
    #ds.config.terrainLayer.zColumn = 'elevation'
    ds.config.siteRadius = 1000
    return ds.getSiteJson( site_id )
Example #2
0
def get_datas(sids, siteCols, siteLayer, nearLayers):
    ds = DataSource(dbinfo)
    ds._connect()
    datas = {}
    for sid in sids:
        sitesql = getInfo(siteLayer, siteCols, sid)
        datas[sid] = {}
        datas[sid][siteLayer] = dict(zip(siteCols, *ds._run(sitesql)))
        for layer in nearLayers:
            cols = nearLayers[layer]["cols"]
            sql = nearest(siteLayer, layer, 1000, sid, cols)
            data = ds._run(sql)
            if len(data) > 0:
                vals = data[0]
            else:
                vals = []
            datas[sid][layer] = dict(zip(cols, vals))
    ds._close()
    return datas
Example #3
0
def seeLayers():
    ds = DataSource( dbinfo )
    ds.viewLayers('layers.py')