11_数据库记录遍历-iObjects Python with JupyterHub for K8s

醉酒当歌 提交于 2019-12-02 21:15:49

数据库记录遍历-iObjects Python with JupyterHub for K8s

使用Python对iObjects的空间数据库进行遍历,可以进一步加入处理操作。

from iobjectspy import (density_based_clustering, 
                        Unit)
import os
import sys
# 设置示例数据路径
#example_data_dir = ''
example_data_dir = '/home/jovyan/data/smdata/'

# 设置结果输出路径
out_dir = os.path.join(example_data_dir, 'out')
if not os.path.exists(out_dir):
    os.makedirs(out_dir)


def progress_func(step_event):
    sys.stdout.write('%s,%s \n' % (step_event.title, step_event.message))


def dbscan_test():
    """ 使用成都市某日17时到20时的出租车上车点数据taxi_up_webMercator,进行DBSCAN密度聚类,其中每类包含最少点数为50个, 搜索半径为100米"""

    result = density_based_clustering(os.path.join(example_data_dir, 'example_dbscan.udb/taxi_up_webMercator'), 50, 100,
                                      Unit.METER, out_data=os.path.join(out_dir, 'out_dbscan.udb'),
                                      progress=progress_func)
    if result is not None:
        if isinstance(result, str):
            print('DBSCAN密度聚类成功,结果数据集为 ' + result)
        else:
            print('DBSCAN密度聚类成功,结果数据集为 ' + result.name)
    else:
        print('DBSCAN密度聚类失败')
if __name__ == '__main__':
    dbscan_test()
java -cp /opt/conda/lib/python3.6/site-packages/iobjectspy/_jsuperpy/jars/com.supermap.jsuperpy-9.1.1.jar com.supermap.jsuperpy.ApplicationExample 127.0.0.1 50505
[iObjectsPy]: Connection gateway-service successful, Python callback port bind 35767

Adding record to dataset...,Dealing with [500/37528]... 
Adding record to dataset...,Dealing with [500/37528]... 
Adding record to dataset...,Dealing with [1000/37528]... 
Adding record to dataset...,Dealing with [1500/37528]... 
Adding record to dataset...,Dealing with [2000/37528]... 
Adding record to dataset...,Dealing with [2500/37528]... 
Adding record to dataset...,Dealing with [3000/37528]... 
Adding record to dataset...,Dealing with [3500/37528]... 
Adding record to dataset...,Dealing with [4000/37528]... 
Adding record to dataset...,Dealing with [4500/37528]... 
Adding record to dataset...,Dealing with [5000/37528]... 
Adding record to dataset...,Dealing with [5500/37528]... 
Adding record to dataset...,Dealing with [6000/37528]... 
Adding record to dataset...,Dealing with [6500/37528]... 
Adding record to dataset...,Dealing with [7000/37528]... 
Adding record to dataset...,Dealing with [7500/37528]... 
Adding record to dataset...,Dealing with [8000/37528]... 
Adding record to dataset...,Dealing with [8500/37528]... 
Adding record to dataset...,Dealing with [9000/37528]... 
Adding record to dataset...,Dealing with [9500/37528]... 
Adding record to dataset...,Dealing with [10000/37528]... 
Adding record to dataset...,Dealing with [10500/37528]... 
Adding record to dataset...,Dealing with [11000/37528]... 
Adding record to dataset...,Dealing with [11500/37528]... 
Adding record to dataset...,Dealing with [12000/37528]... 
Adding record to dataset...,Dealing with [12500/37528]... 
Adding record to dataset...,Dealing with [13000/37528]... 
Adding record to dataset...,Dealing with [13500/37528]... 
Adding record to dataset...,Dealing with [14000/37528]... 
Adding record to dataset...,Dealing with [14500/37528]... 
Adding record to dataset...,Dealing with [15000/37528]... 
Adding record to dataset...,Dealing with [15500/37528]... 
Adding record to dataset...,Dealing with [16000/37528]... 
Adding record to dataset...,Dealing with [16500/37528]... 
Adding record to dataset...,Dealing with [17000/37528]... 
Adding record to dataset...,Dealing with [17500/37528]... 
Adding record to dataset...,Dealing with [18000/37528]... 
Adding record to dataset...,Dealing with [18500/37528]... 
Adding record to dataset...,Dealing with [19000/37528]... 
Adding record to dataset...,Dealing with [19500/37528]... 
Adding record to dataset...,Dealing with [20000/37528]... 
Adding record to dataset...,Dealing with [20500/37528]... 
Adding record to dataset...,Dealing with [21000/37528]... 
Adding record to dataset...,Dealing with [21500/37528]... 
Adding record to dataset...,Dealing with [22000/37528]... 
Adding record to dataset...,Dealing with [22500/37528]... 
Adding record to dataset...,Dealing with [23000/37528]... 
Adding record to dataset...,Dealing with [23500/37528]... 
Adding record to dataset...,Dealing with [24000/37528]... 
Adding record to dataset...,Dealing with [24500/37528]... 
Adding record to dataset...,Dealing with [25000/37528]... 
Adding record to dataset...,Dealing with [25500/37528]... 
Adding record to dataset...,Dealing with [26000/37528]... 
Adding record to dataset...,Dealing with [26500/37528]... 
Adding record to dataset...,Dealing with [27000/37528]... 
Adding record to dataset...,Dealing with [27500/37528]... 
Adding record to dataset...,Dealing with [28000/37528]... 
Adding record to dataset...,Dealing with [28500/37528]... 
Adding record to dataset...,Dealing with [29000/37528]... 
Adding record to dataset...,Dealing with [29500/37528]... 
Adding record to dataset...,Dealing with [30000/37528]... 
Adding record to dataset...,Dealing with [30500/37528]... 
Adding record to dataset...,Dealing with [31000/37528]... 
Adding record to dataset...,Dealing with [31500/37528]... 
Adding record to dataset...,Dealing with [32000/37528]... 
Adding record to dataset...,Dealing with [32500/37528]... 
Adding record to dataset...,Dealing with [33000/37528]... 
Adding record to dataset...,Dealing with [33500/37528]... 
Adding record to dataset...,Dealing with [34000/37528]... 
Adding record to dataset...,Dealing with [34500/37528]... 
Adding record to dataset...,Dealing with [35000/37528]... 
Adding record to dataset...,Dealing with [35500/37528]... 
Adding record to dataset...,Dealing with [36000/37528]... 
Adding record to dataset...,Dealing with [36500/37528]... 
Adding record to dataset...,Dealing with [37000/37528]... 
Adding record to dataset...,Dealing with [37500/37528]... 
Adding record to dataset...,Dealing with [37528/37528]... 
Proceeding point cluster analysis,Proceeding point cluster operation(376/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(1126/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(1877/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(2627/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(3378/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(4129/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(4879/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(5630/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(6380/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(7131/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(7881/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(8632/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(9383/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(10133/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(10884/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(11634/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(12385/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(13135/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(13886/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(14636/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(15387/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(16138/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(16888/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(17639/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(18389/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(19140/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(19890/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(20641/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(21391/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(22142/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(22893/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(23643/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(24394/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(25144/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(25895/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(26645/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(27396/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(28147/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(28897/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(29648/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(30398/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(31149/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(31899/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(32650/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(33400/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(34151/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(34902/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(35652/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(36403/37528) 
Proceeding point cluster analysis,Proceeding point cluster operation(37153/37528) 
Proceeding point cluster analysis,Saving cluster type information(376/37528) 
Proceeding point cluster analysis,Saving cluster type information(1126/37528) 
Proceeding point cluster analysis,Saving cluster type information(1877/37528) 
Proceeding point cluster analysis,Saving cluster type information(2627/37528) 
Proceeding point cluster analysis,Saving cluster type information(3378/37528) 
Proceeding point cluster analysis,Saving cluster type information(4129/37528) 
Proceeding point cluster analysis,Saving cluster type information(4879/37528) 
Proceeding point cluster analysis,Saving cluster type information(5630/37528) 
Proceeding point cluster analysis,Saving cluster type information(6380/37528) 
Proceeding point cluster analysis,Saving cluster type information(7131/37528) 
Proceeding point cluster analysis,Saving cluster type information(7881/37528) 
Proceeding point cluster analysis,Saving cluster type information(8632/37528) 
Proceeding point cluster analysis,Saving cluster type information(9383/37528) 
Proceeding point cluster analysis,Saving cluster type information(10133/37528) 
Proceeding point cluster analysis,Saving cluster type information(10884/37528) 
Proceeding point cluster analysis,Saving cluster type information(11634/37528) 
Proceeding point cluster analysis,Saving cluster type information(12385/37528) 
Proceeding point cluster analysis,Saving cluster type information(13135/37528) 
Proceeding point cluster analysis,Saving cluster type information(13886/37528) 
Proceeding point cluster analysis,Saving cluster type information(14636/37528) 
Proceeding point cluster analysis,Saving cluster type information(15387/37528) 
Proceeding point cluster analysis,Saving cluster type information(16138/37528) 
Proceeding point cluster analysis,Saving cluster type information(16888/37528) 
Proceeding point cluster analysis,Saving cluster type information(17639/37528) 
Proceeding point cluster analysis,Saving cluster type information(18389/37528) 
Proceeding point cluster analysis,Saving cluster type information(19140/37528) 
Proceeding point cluster analysis,Saving cluster type information(19890/37528) 
Proceeding point cluster analysis,Saving cluster type information(20641/37528) 
Proceeding point cluster analysis,Saving cluster type information(21391/37528) 
Proceeding point cluster analysis,Saving cluster type information(22142/37528) 
Proceeding point cluster analysis,Saving cluster type information(22893/37528) 
Proceeding point cluster analysis,Saving cluster type information(23643/37528) 
Proceeding point cluster analysis,Saving cluster type information(24394/37528) 
Proceeding point cluster analysis,Saving cluster type information(25144/37528) 
Proceeding point cluster analysis,Saving cluster type information(25895/37528) 
Proceeding point cluster analysis,Saving cluster type information(26645/37528) 
Proceeding point cluster analysis,Saving cluster type information(27396/37528) 
Proceeding point cluster analysis,Saving cluster type information(28147/37528) 
Proceeding point cluster analysis,Saving cluster type information(28897/37528) 
Proceeding point cluster analysis,Saving cluster type information(29648/37528) 
Proceeding point cluster analysis,Saving cluster type information(30398/37528) 
Proceeding point cluster analysis,Saving cluster type information(31149/37528) 
Proceeding point cluster analysis,Saving cluster type information(31899/37528) 
Proceeding point cluster analysis,Saving cluster type information(32650/37528) 
Proceeding point cluster analysis,Saving cluster type information(33400/37528) 
Proceeding point cluster analysis,Saving cluster type information(34151/37528) 
Proceeding point cluster analysis,Saving cluster type information(34902/37528) 
Proceeding point cluster analysis,Saving cluster type information(35652/37528) 
Proceeding point cluster analysis,Saving cluster type information(36403/37528) 
Proceeding point cluster analysis,Saving cluster type information(37153/37528) 
DBSCAN密度聚类成功,结果数据集为 taxi_up_webMercator_dbscan
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!