国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

arcpy開發(fā)實例之POI格網(wǎng)剖分聚類

2022-11-11 10:08 作者:夕林泉石  | 我要投稿

# _*_ encoding: utf-8 _*_

import arcpy

arcpy.env.workspace = "d:/temp/poi_yuelu";


# 1. 生成格網(wǎng)(魚網(wǎng))

arcpy.management.CreateFishnet("d:/temp/poi_yuelu/grid.shp",'12560907 3264305','12560907 3286103',500,500,45,30,labels=False,geometry_type='POLYGON');

# 刪除行政邊界外的格網(wǎng),以減少計算量


# 2. 空間關(guān)聯(lián)計算每個單元格里的poi數(shù)量

arcpy.analysis.SpatialJoin("grid","poi_yuelu","d:/temp/poi_yuelu/grid_pcount.shp","JOIN_ONE_TO_ONE",match_option="COMPLETELY_CONTAINS");

#刪除所有poi點數(shù)量為0的單元格,以減少計算量

with arcpy.da.UpdateCursor("grid_pcount","*","join_count=0") as cursor:

? ? for row in cursor:

? ? ? ? cursor.deleteRow();


# 3. 使用自然分類法,將單元格的poi數(shù)量劃分為10個組

ys = [];

with arcpy.da.SearchCursor("grid_pcount","join_count") as cursor:

? ? for row in cursor:

? ? ? ? ys.append(row[0]);? ? ??


import jenkspy

breaks = jenkspy.jenks_breaks(ys, nb_class=10)

print breaks

#[1.0, 10.0, 25.0, 45.0, 69.0, 99.0, 138.0, 182.0, 240.0, 305.0, 401.0]


# 4. 根據(jù)breaks,為每個單元格設(shè)置分組號

with arcpy.da.UpdateCursor("grid_pcount",["join_count","pcount"]) as cursor:

? ? for row in cursor:

? ? ? ? if row[0]<breaks[1]:

? ? ? ? ? ? row[1]=1;

? ? ? ? elif row[0]>=breaks[1] and row[0]<breaks[2]:

? ? ? ? ? ? row[1] = 2;

? ? ? ? elif row[0]>=breaks[2] and row[0]<breaks[3]:

? ? ? ? ? ? row[1] = 3;

? ? ? ? elif row[0]>=breaks[3] and row[0]<breaks[4]:

? ? ? ? ? ? row[1] = 4;

? ? ? ? elif row[0]>=breaks[4] and row[0]<breaks[5]:

? ? ? ? ? ? row[1] = 5;

? ? ? ? elif row[0]>=breaks[5] and row[0]<breaks[6]:

? ? ? ? ? ? row[1] = 6;

? ? ? ? elif row[0]>=breaks[6] and row[0]<breaks[7]:

? ? ? ? ? ? row[1] = 7;

? ? ? ? elif row[0]>=breaks[7] and row[0]<breaks[8]:

? ? ? ? ? ? row[1] = 8;

? ? ? ? elif row[0]>=breaks[8] and row[0]<breaks[9]:

? ? ? ? ? ? row[1] = 9;

? ? ? ? elif row[0]>=breaks[9]:

? ? ? ? ? ? row[1] = 10;? ??

? ? ? ? cursor.updateRow(row);


# 6. 使用arcgis自帶的hotarean分析工具

arcpy.stats.OptimizedHotSpotAnalysis("poi_yuelu","d:/temp/poi_hotarea.shp",

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Incident_Data_Aggregation_Method="COUNT_INCIDENTS_WITHIN_FISHNET_POLYGONS",

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Cell_Size="20 Meters");

# 六邊形魚網(wǎng)

arcpy.stats.OptimizedHotSpotAnalysis("poi_yuelu","d:/temp/poi_hotarea.shp",

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Incident_Data_Aggregation_Method="COUNT_INCIDENTS_WITHIN_HEXAGON_POLYGONS",

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Cell_Size="20 Meters");


arcpy開發(fā)實例之POI格網(wǎng)剖分聚類的評論 (共 條)

分享到微博請遵守國家法律
江都市| 宁晋县| 灌阳县| 广南县| 凉城县| 灌南县| 元谋县| 衡水市| 梁平县| 紫阳县| 伽师县| 晋中市| 谢通门县| 平江县| 新和县| 鄂伦春自治旗| 姜堰市| 五原县| 封开县| 武汉市| 汉沽区| 台北县| 福泉市| 文昌市| 昭觉县| 棋牌| 抚州市| 鹿邑县| 正镶白旗| 澳门| 吴江市| 阳朔县| 个旧市| 东台市| 聂拉木县| 克东县| 晋州市| 赞皇县| 忻州市| 江川县| 紫云|