├── .gitignore ├── README.md ├── images ├── new_segmentation.jpg ├── road_network.jpg └── segmentation_result.jpg ├── make_taz ├── __init__.py ├── segmentation.py └── simplify.py ├── setup.py └── test ├── data ├── input │ ├── road_level_2.tfw │ ├── road_level_2.tif │ ├── road_level_2.tif.aux.xml │ ├── road_level_2.tif.ovr │ ├── road_level_2.tif.vat.dbf │ ├── road_level_3.tfw │ ├── road_level_3.tif │ ├── road_level_3.tif.aux.xml │ ├── road_level_3.tif.ovr │ └── road_level_3.tif.vat.dbf ├── result │ ├── out.tif │ ├── out.tif.vat.dbf │ ├── shenzhen_taz.dbf │ ├── shenzhen_taz.prj │ ├── shenzhen_taz.sbn │ ├── shenzhen_taz.sbx │ ├── shenzhen_taz.shp │ └── shenzhen_taz.shx └── shp │ ├── road_level_2.dbf │ ├── road_level_2.prj │ ├── road_level_2.sbn │ ├── road_level_2.sbx │ ├── road_level_2.shp │ ├── road_level_2.shp.xml │ ├── road_level_2.shx │ ├── road_level_3.dbf │ ├── road_level_3.prj │ ├── road_level_3.sbn │ ├── road_level_3.sbx │ ├── road_level_3.shp │ ├── road_level_3.shp.xml │ └── road_level_3.shx └── test.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | /dist/ 3 | /*.egg-info 4 | .vscode 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 4 | 5 | We provide two tools. `make_taz` segment urban areas into regions by road networks. 6 | `simplify_polygon` simplify the result polygon. 7 | 8 | 9 | 10 | `make_taz` uses the algorithm proposed in paper [Segmentation of Urban Areas Using Road Networks](https://www.microsoft.com/en-us/research/publication/segmentation-of-urban-areas-using-road-networks/). 11 | 12 | `simplify_polygon` uses shapely's simplify method. 13 | 14 | ## install 15 | 16 | ``` 17 | pip install make-taz 18 | 19 | ``` 20 | 21 | ## how to use 22 | 23 | ```python 24 | 25 | from make_taz import make_taz, simplify_polygon 26 | make_taz('../test/data/input/road_level_2.tif', '../test/data/result/out.tif') 27 | 28 | 29 | ``` 30 | 31 | ## example 32 | 33 | ![result](https://github.com/zhuang-hao-ming/make-taz/blob/master/images/segmentation_result.jpg) 34 | 35 | 36 | ## 版本 37 | 38 | ### 0.1版本 39 | 40 | 请查看提交记录 41 | 42 | ### 0.2版本 43 | 1. 因为不希望在python中直接使用`gdal`,在0.2版本中改用`rasterio`进行栅格文件读写 44 | 2. 由于取消了对gdal的依赖,无法利用gdal的*栅格转矢量*功能,建议使用arcgis或者其他工具进行转换。 45 | 3. 改进了边界的处理,原先的输出结果中边界被标记为0,这导致在做栅格转矢量操作时,不同的交通小区之间存在较大的缝隙, 46 | 为了改进这个问题,在区域标记结束后,将所有的0值替换为邻近区域的值 47 | 4. 增加了小区域过滤参数,可以直接过滤栅格数目小于一定阈值的区域,程序自动将它合并到邻近的大区域。 48 | 49 | ![result](https://github.com/zhuang-hao-ming/make-taz/blob/master/images/new_segmentation.jpg) 50 | 51 | 52 | 53 | 54 | ## refer 55 | 56 | 1. [Segmentation of Urban Areas Using Road Networks](https://www.microsoft.com/en-us/research/publication/segmentation-of-urban-areas-using-road-networks/) 57 | 58 | -------------------------------------------------------------------------------- /images/new_segmentation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/images/new_segmentation.jpg -------------------------------------------------------------------------------- /images/road_network.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/images/road_network.jpg -------------------------------------------------------------------------------- /images/segmentation_result.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/images/segmentation_result.jpg -------------------------------------------------------------------------------- /make_taz/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from .segmentation import make_taz 4 | from .simplify import simplify_polygon -------------------------------------------------------------------------------- /make_taz/segmentation.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | 4 | import numpy as np 5 | import rasterio 6 | from skimage import measure, morphology 7 | 8 | 9 | def make_taz(input_raster_name, output_raster_name, kernel_size=3, low_frequency_threshold=9): 10 | ''' 11 | make taz from road image 12 | 13 | Parameters: 14 | ----------------- 15 | input_raster_name: str 16 | filename of input raster. it must be a tif file with one band. 17 | it must have just two value 1 and 0, within, 1 stands for road, and 0 stands for any other thing. 18 | 19 | output_raster_name: str 20 | filename of output raster. 21 | 22 | kernel_size: int 23 | morphology kernel 24 | 25 | low_frequency_threshold: int 26 | region with amount of cell less than threshold will be excluede. 27 | 28 | Returns: 29 | ------------- 30 | save raster to the destination path. 31 | 32 | ''' 33 | 34 | # Use gdal to read and write images to ensure that geographic information is not lost. 35 | # skimage does not support using gdal to save image 36 | print('read image') 37 | src = rasterio.open(input_raster_name) 38 | road_img = src.read(1) 39 | 40 | 41 | # segmentation 42 | print('segmentation') 43 | selem = np.full((kernel_size,kernel_size), 1) 44 | dilation_road_img = morphology.dilation(road_img, selem) 45 | thin_road_img = morphology.thin(dilation_road_img) 46 | thin_road_img = thin_road_img.astype(np.int32) 47 | label_road_img = measure.label(thin_road_img, connectivity=1, background=1) 48 | 49 | 50 | # exclude low frequency region 51 | exclude_items = [] 52 | unique, counts = np.unique(label_road_img, return_counts=True) 53 | item_count_dict = dict(zip(unique, counts)) 54 | for item,count in item_count_dict.items(): 55 | if count < low_frequency_threshold: 56 | exclude_items.append(item) 57 | 58 | 59 | for item in exclude_items: 60 | label_road_img[label_road_img==item] = 0 61 | 62 | # exclude zero value 63 | # to produce better polygon 64 | while np.count_nonzero(label_road_img==0) > 0: 65 | # row+1 66 | label_road_img = np.where(label_road_img == 0, np.roll(label_road_img, 1, axis=0), label_road_img) 67 | # row-1 68 | label_road_img = np.where(label_road_img == 0, np.roll(label_road_img, -1, axis=0), label_road_img) 69 | # col+1 70 | label_road_img = np.where(label_road_img == 0, np.roll(label_road_img, 1, axis=1), label_road_img) 71 | # col-1 72 | label_road_img = np.where(label_road_img == 0, np.roll(label_road_img, -1, axis=1), label_road_img) 73 | 74 | 75 | # output 76 | profile = src.profile 77 | profile.update(dtype=rasterio.int32, count=1, nodata=-9999) 78 | 79 | 80 | with rasterio.open(output_raster_name, 'w', **profile) as dst: 81 | dst.write(label_road_img.astype(rasterio.int32), 1) 82 | 83 | src.close() 84 | 85 | 86 | if __name__ == '__main__': 87 | make_taz('../test/data/input/road_level_2.tif', '../test/data/result/out.tif') 88 | -------------------------------------------------------------------------------- /make_taz/simplify.py: -------------------------------------------------------------------------------- 1 | import fiona 2 | from shapely.geometry import shape, mapping 3 | 4 | 5 | 6 | def simplify_polygon(input_file_name, output_file_name, tolerance): 7 | ''' 8 | simplify polygons 9 | 10 | Parameters: 11 | ----------- 12 | input_file_name : str 13 | input file name, must be a shapefile 14 | output_file_name : str 15 | output file name 16 | tolerance : float 17 | simplify tolerance 18 | 19 | ''' 20 | c = fiona.open(input_file_name) 21 | out_c = fiona.open(output_file_name, 'w', **c.meta) 22 | for feature in c: 23 | shapely_geometry = shape(feature['geometry']) 24 | shapely_geometry = shapely_geometry.simplify(tolerance) 25 | feature['geometry'] = mapping(shapely_geometry) 26 | out_c.write(feature) 27 | c.close() 28 | out_c.close() 29 | print('ok') 30 | 31 | 32 | if __name__ == '__main__': 33 | simplify_polygon('./data/shp/taz_level3.shp', './data/shp/taz_level3_simplify1.shp', 30) 34 | 35 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup(name='make_taz', 4 | version='0.2', 5 | description='implementation segmentation of urban areas using road network', 6 | url='http://github.com/', 7 | author='Haoming Zhuang', 8 | author_email='csuhaoming@163.com', 9 | license='MIT', 10 | packages=['make_taz'], 11 | zip_safe=False) -------------------------------------------------------------------------------- /test/data/input/road_level_2.tfw: -------------------------------------------------------------------------------- 1 | 30.0000000000 2 | 0.0000000000 3 | 0.0000000000 4 | -30.0000000000 5 | 782836.8277404299 6 | 2526636.3440660862 7 | -------------------------------------------------------------------------------- /test/data/input/road_level_2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/input/road_level_2.tif -------------------------------------------------------------------------------- /test/data/input/road_level_2.tif.aux.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEAREST 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | 256 12 | 1 13 | 0 14 | 3506106|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|121040 15 | 16 | 17 | 18 | 19 | OBJECTID 20 | 0 21 | 0 22 | 23 | 24 | Value 25 | 0 26 | 0 27 | 28 | 29 | Count 30 | 1 31 | 0 32 | 33 | 34 | 1 35 | 0 36 | 3506106 37 | 38 | 39 | 2 40 | 1 41 | 121040 42 | 43 | 44 | 45 | 0 46 | 1 47 | 0.033370589438639 48 | 0.17960234433986 49 | 1 50 | 1 51 | 52 | 3.22570020923749E-02 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /test/data/input/road_level_2.tif.ovr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/input/road_level_2.tif.ovr -------------------------------------------------------------------------------- /test/data/input/road_level_2.tif.vat.dbf: -------------------------------------------------------------------------------- 1 | v aMValueN CountF 0 3.50610600000e+006 1 1.21040000000e+005 -------------------------------------------------------------------------------- /test/data/input/road_level_3.tfw: -------------------------------------------------------------------------------- 1 | 30.0000000000 2 | 0.0000000000 3 | 0.0000000000 4 | -30.0000000000 5 | 782836.8277404299 6 | 2526786.3440660862 7 | -------------------------------------------------------------------------------- /test/data/input/road_level_3.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/input/road_level_3.tif -------------------------------------------------------------------------------- /test/data/input/road_level_3.tif.aux.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NEAREST 5 | 6 | 7 | 8 | 9 | 0 10 | 1 11 | 256 12 | 1 13 | 0 14 | 3751697|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|183624 15 | 16 | 17 | 18 | 19 | OBJECTID 20 | 0 21 | 0 22 | 23 | 24 | Value 25 | 0 26 | 0 27 | 28 | 29 | Count 30 | 1 31 | 0 32 | 33 | 34 | 1 35 | 0 36 | 3751697 37 | 38 | 39 | 2 40 | 1 41 | 183624 42 | 43 | 44 | 45 | 0 46 | 1 47 | 0.046660488432837 48 | 0.21091064116267 49 | 1 50 | 1 51 | 52 | .044483298555647 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /test/data/input/road_level_3.tif.ovr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/input/road_level_3.tif.ovr -------------------------------------------------------------------------------- /test/data/input/road_level_3.tif.vat.dbf: -------------------------------------------------------------------------------- 1 | v aMValueN CountF 0 3.75169700000e+006 1 1.83624000000e+005 -------------------------------------------------------------------------------- /test/data/result/out.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/result/out.tif -------------------------------------------------------------------------------- /test/data/result/out.tif.vat.dbf: -------------------------------------------------------------------------------- 1 | v \aMValueN CountF 1 2.15950200000e+006 2 2.13440000000e+004 3 4.04000000000e+002 4 3.60900000000e+003 5 1.13400000000e+003 6 1.32700000000e+003 7 1.77000000000e+002 8 2.10000000000e+002 9 1.68100000000e+003 10 4.38400000000e+003 11 7.40000000000e+001 14 2.02000000000e+002 15 1.41300000000e+003 16 1.23410000000e+004 18 1.63000000000e+003 19 3.57000000000e+002 24 2.80000000000e+001 25 2.08200000000e+003 26 9.12500000000e+003 28 2.70000000000e+001 29 2.03200000000e+003 31 3.32000000000e+002 33 2.60000000000e+001 35 1.94100000000e+003 36 1.88000000000e+002 37 2.67600000000e+003 38 5.10900000000e+003 39 2.11600000000e+003 40 2.43900000000e+003 41 8.25700000000e+003 42 3.69000000000e+002 43 1.05700000000e+003 44 1.48600000000e+003 45 5.59000000000e+002 46 7.36000000000e+002 47 2.96000000000e+002 48 3.28900000000e+003 49 8.57000000000e+003 50 1.65500000000e+003 51 4.24000000000e+002 52 7.65000000000e+002 53 2.04000000000e+002 54 7.99000000000e+002 55 1.33000000000e+002 56 8.39000000000e+002 57 2.11600000000e+003 58 1.15100000000e+003 59 2.93100000000e+003 60 2.58200000000e+003 61 1.59600000000e+003 62 2.22200000000e+003 65 1.05040000000e+004 67 2.80000000000e+002 68 1.47200000000e+003 69 4.00000000000e+001 70 2.78000000000e+002 72 4.10000000000e+002 73 1.06380000000e+004 74 5.87000000000e+002 75 2.19500000000e+003 76 2.01100000000e+003 77 1.52400000000e+003 78 1.40600000000e+003 79 1.38000000000e+003 80 7.30000000000e+001 81 1.33200000000e+003 82 4.72100000000e+003 83 5.10000000000e+002 84 1.81400000000e+003 85 3.07400000000e+003 86 5.44000000000e+002 87 7.25000000000e+002 88 3.19300000000e+003 89 2.63000000000e+003 90 2.02800000000e+003 91 9.79000000000e+002 92 3.97000000000e+002 93 2.17000000000e+002 94 1.90360000000e+004 96 9.05300000000e+003 97 2.73600000000e+003 98 7.66600000000e+003 99 3.12400000000e+003 100 3.11000000000e+002 101 2.01000000000e+003 102 7.56000000000e+002 103 2.79930000000e+004 104 4.03900000000e+003 106 3.76000000000e+002 107 3.56000000000e+002 109 6.28400000000e+003 111 8.97000000000e+002 112 5.26000000000e+003 113 2.87730000000e+004 114 1.15000000000e+002 115 3.94800000000e+003 116 1.77400000000e+003 118 1.19000000000e+003 119 1.29900000000e+003 120 1.43400000000e+003 121 9.86000000000e+002 122 1.66570000000e+004 123 4.25000000000e+003 126 6.70000000000e+001 127 6.48100000000e+003 128 1.68390000000e+004 129 6.37000000000e+002 130 1.04690000000e+004 131 1.50600000000e+003 132 3.97300000000e+003 134 3.45000000000e+003 135 1.18800000000e+003 137 4.66000000000e+002 138 7.41000000000e+003 139 8.51000000000e+002 140 2.37100000000e+003 141 3.97200000000e+003 142 4.31400000000e+003 143 6.16400000000e+003 144 4.62000000000e+002 145 3.04700000000e+003 146 2.80000000000e+001 147 3.66100000000e+003 149 9.42000000000e+002 150 1.59800000000e+003 151 2.88000000000e+003 153 4.25700000000e+003 154 6.68000000000e+002 155 1.16530000000e+004 159 6.30000000000e+001 160 9.58000000000e+002 161 3.97300000000e+003 162 5.30100000000e+003 163 2.93000000000e+002 164 7.17900000000e+003 165 3.09200000000e+003 166 2.45970000000e+004 168 2.86600000000e+003 169 2.38600000000e+003 170 1.23000000000e+003 171 6.11700000000e+003 172 7.85000000000e+002 173 5.49000000000e+002 174 2.81700000000e+003 175 1.92900000000e+003 176 1.11005000000e+005 177 1.06000000000e+003 178 1.76100000000e+003 179 2.60800000000e+003 180 1.89800000000e+003 181 1.75200000000e+003 182 2.77900000000e+003 183 1.43100000000e+003 184 2.84800000000e+003 185 4.94600000000e+003 186 9.90000000000e+001 187 5.21300000000e+003 188 5.68600000000e+003 189 5.53900000000e+003 190 2.78300000000e+003 191 7.83000000000e+002 192 1.16000000000e+002 193 8.20000000000e+001 194 6.00000000000e+001 197 8.58400000000e+003 198 7.55380000000e+004 199 1.10000000000e+002 200 1.66000000000e+003 203 3.55300000000e+003 204 4.97000000000e+002 205 4.28000000000e+002 206 1.35400000000e+003 207 3.69300000000e+003 208 2.80700000000e+003 209 2.10100000000e+003 210 8.98000000000e+002 211 1.46000000000e+002 212 1.83300000000e+003 213 1.59880000000e+004 214 7.35000000000e+002 215 8.40000000000e+001 217 2.55000000000e+002 218 3.12300000000e+004 219 1.97800000000e+003 220 5.39800000000e+003 221 1.76400000000e+003 222 4.30000000000e+002 224 3.28500000000e+003 225 5.98700000000e+003 226 1.45000000000e+002 228 3.27200000000e+003 229 7.82000000000e+003 230 2.65000000000e+002 231 4.31880000000e+004 232 8.24100000000e+003 233 4.97000000000e+002 234 2.48100000000e+003 235 6.77800000000e+003 236 3.34000000000e+002 237 2.66400000000e+003 238 2.55700000000e+003 239 2.12000000000e+002 240 3.88000000000e+002 242 7.50100000000e+003 243 1.23000000000e+002 244 8.28000000000e+002 245 1.78300000000e+003 246 3.99700000000e+003 247 2.42000000000e+002 248 6.10000000000e+001 249 4.05400000000e+003 251 1.33000000000e+002 252 2.75570000000e+004 254 1.10000000000e+002 256 3.49400000000e+003 257 1.02000000000e+003 258 4.39800000000e+003 259 3.52000000000e+004 260 5.81900000000e+003 261 5.10000000000e+001 263 1.36500000000e+003 264 5.45000000000e+002 265 4.91000000000e+002 266 1.12400000000e+003 267 4.88400000000e+003 268 1.46000000000e+002 269 1.52500000000e+003 270 1.03000000000e+002 271 1.90100000000e+003 272 4.26000000000e+003 273 3.88000000000e+003 275 1.57200000000e+003 276 1.50400000000e+003 277 1.59300000000e+003 278 7.72900000000e+003 279 5.30000000000e+001 280 2.99400000000e+003 281 5.61000000000e+002 282 4.26500000000e+003 283 1.55100000000e+003 284 9.80000000000e+001 285 4.39000000000e+002 286 3.30900000000e+003 287 9.88000000000e+002 288 6.01650000000e+004 289 1.06000000000e+002 290 7.30000000000e+001 291 4.15500000000e+003 292 5.89000000000e+002 293 1.19000000000e+002 294 1.49000000000e+002 295 1.14300000000e+003 296 1.31000000000e+002 297 9.31000000000e+002 298 8.18000000000e+002 299 9.99000000000e+002 300 2.34450000000e+004 301 2.70000000000e+001 302 7.10000000000e+001 303 1.03600000000e+003 305 2.10000000000e+001 306 2.70000000000e+001 307 1.78000000000e+002 310 8.17000000000e+002 311 3.52600000000e+003 313 2.26400000000e+003 314 3.96000000000e+002 315 4.20000000000e+001 316 1.38000000000e+002 317 4.09000000000e+002 318 1.27900000000e+003 319 1.00800000000e+003 320 5.65000000000e+002 321 1.96000000000e+002 322 2.09500000000e+003 323 3.50000000000e+001 324 7.05300000000e+003 325 1.58800000000e+003 328 1.85000000000e+002 329 2.37400000000e+003 330 6.10000000000e+001 331 4.04000000000e+002 332 1.38300000000e+003 333 3.74000000000e+002 334 3.60000000000e+001 335 4.45000000000e+002 336 3.66900000000e+003 337 2.35000000000e+002 339 3.02000000000e+002 340 3.28000000000e+002 341 5.80500000000e+003 342 3.19400000000e+003 343 1.43000000000e+002 344 1.31400000000e+003 345 3.32800000000e+003 346 2.90000000000e+001 347 1.35510000000e+004 348 5.93000000000e+002 349 4.80000000000e+001 350 2.29000000000e+003 351 6.96000000000e+002 352 1.09700000000e+003 354 1.99500000000e+003 355 3.17100000000e+003 356 1.95600000000e+003 357 2.32000000000e+003 358 2.04100000000e+003 360 6.18200000000e+003 361 9.30000000000e+002 362 5.65000000000e+002 363 6.02600000000e+003 365 1.12000000000e+002 366 6.40000000000e+001 367 4.58900000000e+003 368 3.40000000000e+001 369 5.46300000000e+003 370 1.08400000000e+003 371 2.14000000000e+003 372 3.88000000000e+002 376 9.50000000000e+001 377 3.40000000000e+001 378 2.39700000000e+003 380 1.20900000000e+003 382 1.37000000000e+002 383 1.53820000000e+004 384 2.62200000000e+003 385 3.71000000000e+003 386 1.89000000000e+002 387 6.85000000000e+002 388 1.03350000000e+004 389 6.40000000000e+002 391 2.37000000000e+002 392 6.60000000000e+001 394 3.05400000000e+003 395 2.50400000000e+003 396 5.26200000000e+003 397 5.16000000000e+002 398 2.37100000000e+003 399 2.19000000000e+002 400 1.03900000000e+003 401 2.60100000000e+003 402 9.09000000000e+002 403 3.68300000000e+003 404 3.17000000000e+002 405 3.87000000000e+003 406 6.87100000000e+003 407 5.21700000000e+003 408 4.55000000000e+002 409 1.20700000000e+003 410 1.21200000000e+003 411 4.15000000000e+002 412 8.58000000000e+002 413 4.98000000000e+002 414 1.46400000000e+003 415 4.34000000000e+002 416 2.79400000000e+003 417 5.27000000000e+002 418 4.10000000000e+001 419 8.24000000000e+002 420 1.66000000000e+002 421 9.70000000000e+001 422 1.37000000000e+002 423 5.70000000000e+001 424 3.37000000000e+002 425 1.31100000000e+003 426 1.03500000000e+003 427 1.20700000000e+003 428 7.55000000000e+002 429 1.68800000000e+003 430 6.30000000000e+001 431 1.32000000000e+002 432 7.43000000000e+002 433 3.18000000000e+002 434 3.02000000000e+002 435 2.66000000000e+002 436 2.61000000000e+002 437 1.16100000000e+003 438 4.93000000000e+002 439 2.99000000000e+002 440 2.76000000000e+002 441 3.41000000000e+002 442 5.85000000000e+002 443 2.31000000000e+002 444 4.82000000000e+002 446 1.07500000000e+003 447 7.44000000000e+002 448 1.98000000000e+002 450 2.60000000000e+002 451 2.95400000000e+003 453 2.08000000000e+002 454 6.02000000000e+002 455 5.88000000000e+002 456 4.33000000000e+002 457 1.44000000000e+003 458 2.48000000000e+002 459 8.47000000000e+002 460 1.00000000000e+002 461 2.30100000000e+003 462 1.77000000000e+002 463 7.47000000000e+002 464 1.31800000000e+003 465 3.41000000000e+002 466 1.60000000000e+002 467 5.06000000000e+002 468 7.05000000000e+002 469 1.32900000000e+003 470 3.07000000000e+002 471 9.10000000000e+001 472 4.51000000000e+002 473 2.06000000000e+002 474 1.93700000000e+003 475 3.41500000000e+003 476 3.04000000000e+002 477 5.20000000000e+001 478 8.32000000000e+002 479 6.99000000000e+002 480 9.29000000000e+002 481 8.93000000000e+002 482 8.02000000000e+002 483 2.24000000000e+002 484 1.22100000000e+003 485 1.16000000000e+002 486 4.03000000000e+002 487 2.43000000000e+002 488 2.31000000000e+002 489 8.71000000000e+002 490 3.64000000000e+002 491 2.16000000000e+002 492 1.78200000000e+003 493 5.42800000000e+003 495 4.99000000000e+002 496 3.93000000000e+002 497 2.13700000000e+003 498 1.11100000000e+003 499 7.96000000000e+002 500 2.31000000000e+002 501 1.21790000000e+004 502 1.19300000000e+003 503 1.48800000000e+003 504 2.01200000000e+003 505 9.15000000000e+002 506 4.90000000000e+001 507 1.72000000000e+002 508 1.22000000000e+002 509 9.10000000000e+001 510 6.51000000000e+002 511 1.02000000000e+002 512 3.58000000000e+002 513 3.63000000000e+002 514 2.33000000000e+002 515 2.46000000000e+002 516 3.37000000000e+002 517 2.00000000000e+001 519 6.77000000000e+002 520 1.48000000000e+002 522 1.57000000000e+002 523 2.12000000000e+002 525 8.78000000000e+002 526 7.10000000000e+001 527 1.40000000000e+002 528 1.11000000000e+002 529 5.90000000000e+001 530 2.35000000000e+002 531 4.02000000000e+002 532 5.81000000000e+002 533 2.11000000000e+002 535 8.58000000000e+002 536 4.84000000000e+002 537 7.90000000000e+001 538 9.62000000000e+002 539 1.12000000000e+002 540 3.23000000000e+002 541 6.40000000000e+001 542 1.00000000000e+002 543 7.60000000000e+001 544 8.70000000000e+001 545 1.66000000000e+002 546 1.66000000000e+002 547 8.70000000000e+001 548 1.30000000000e+002 549 4.61000000000e+002 550 1.47000000000e+002 551 1.14000000000e+002 552 8.70000000000e+001 553 1.64000000000e+002 554 9.50000000000e+001 555 2.36000000000e+002 556 4.80000000000e+001 557 1.25000000000e+002 558 1.89200000000e+003 559 1.06000000000e+002 560 3.29000000000e+002 561 1.18000000000e+002 562 3.54000000000e+002 563 4.70000000000e+001 564 8.60000000000e+001 565 1.50000000000e+002 566 3.92000000000e+002 567 5.50000000000e+001 568 7.70000000000e+001 569 8.00000000000e+001 570 3.40000000000e+002 571 2.80000000000e+001 572 3.19000000000e+002 573 2.08000000000e+002 574 1.33000000000e+002 575 5.48000000000e+002 576 3.05000000000e+002 577 2.00000000000e+001 578 4.54000000000e+002 579 4.33000000000e+002 580 4.91000000000e+002 581 2.12000000000e+002 582 7.00000000000e+001 583 4.16000000000e+002 584 2.70900000000e+003 585 2.60000000000e+001 587 1.08700000000e+003 588 7.22000000000e+002 589 3.28700000000e+003 590 1.07000000000e+002 591 9.40000000000e+001 592 1.07000000000e+002 593 5.90000000000e+001 594 3.49000000000e+002 595 1.07000000000e+002 596 4.62000000000e+002 597 2.20000000000e+003 598 7.10000000000e+002 599 4.46000000000e+002 600 1.62000000000e+002 601 2.30000000000e+001 602 5.00000000000e+001 603 1.01000000000e+003 604 4.36000000000e+002 605 3.20000000000e+002 606 1.32000000000e+002 607 1.83000000000e+002 608 1.75000000000e+002 609 1.87000000000e+002 610 7.57000000000e+002 611 2.17000000000e+002 612 3.22000000000e+002 613 2.16000000000e+002 614 3.45000000000e+002 615 3.60000000000e+002 616 1.41800000000e+003 617 1.24200000000e+003 618 8.41000000000e+002 619 5.62000000000e+002 620 6.26000000000e+002 621 4.43000000000e+002 622 6.48000000000e+002 623 3.11900000000e+003 624 3.10000000000e+002 625 5.50000000000e+002 626 5.58000000000e+002 627 1.40900000000e+003 628 1.05900000000e+003 629 4.58000000000e+002 630 8.89000000000e+002 631 2.19000000000e+002 632 8.00000000000e+002 633 1.33000000000e+002 634 9.64000000000e+002 635 7.03000000000e+002 636 3.84000000000e+002 637 3.48000000000e+002 638 7.27000000000e+002 639 1.11000000000e+002 640 4.70000000000e+001 641 4.59000000000e+002 642 4.39000000000e+002 643 2.00000000000e+002 644 2.35000000000e+002 645 4.84000000000e+002 646 5.55000000000e+002 647 8.54000000000e+002 648 4.76000000000e+002 649 2.95300000000e+003 650 2.19000000000e+002 651 8.00000000000e+001 652 1.35400000000e+003 653 4.09000000000e+002 654 1.82000000000e+002 655 6.40000000000e+002 656 1.66000000000e+003 657 2.53000000000e+002 659 8.74000000000e+002 660 6.47000000000e+002 661 4.05000000000e+002 662 1.90000000000e+002 663 2.45000000000e+002 664 3.25000000000e+002 665 5.63000000000e+002 666 1.96000000000e+002 667 1.43200000000e+003 668 6.43000000000e+002 669 1.04500000000e+003 670 7.25000000000e+002 671 4.37000000000e+002 672 8.40000000000e+001 673 1.36000000000e+002 674 3.21000000000e+002 -------------------------------------------------------------------------------- /test/data/result/shenzhen_taz.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/result/shenzhen_taz.dbf -------------------------------------------------------------------------------- /test/data/result/shenzhen_taz.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS_1984_UTM_Zone_49N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["false_easting",500000.0],PARAMETER["false_northing",0.0],PARAMETER["central_meridian",111.0],PARAMETER["scale_factor",0.9996],PARAMETER["latitude_of_origin",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/data/result/shenzhen_taz.sbn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/result/shenzhen_taz.sbn -------------------------------------------------------------------------------- /test/data/result/shenzhen_taz.sbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/result/shenzhen_taz.sbx -------------------------------------------------------------------------------- /test/data/result/shenzhen_taz.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/result/shenzhen_taz.shp -------------------------------------------------------------------------------- /test/data/result/shenzhen_taz.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/result/shenzhen_taz.shx -------------------------------------------------------------------------------- /test/data/shp/road_level_2.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_2.dbf -------------------------------------------------------------------------------- /test/data/shp/road_level_2.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["degree",0.0174532925199433]] -------------------------------------------------------------------------------- /test/data/shp/road_level_2.sbn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_2.sbn -------------------------------------------------------------------------------- /test/data/shp/road_level_2.sbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_2.sbx -------------------------------------------------------------------------------- /test/data/shp/road_level_2.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_2.shp -------------------------------------------------------------------------------- /test/data/shp/road_level_2.shp.xml: -------------------------------------------------------------------------------- 1 | 2 | 20180409163051001.0TRUECalculateField road_level_2 class 1 VB #CalculateField road_level_2 class 2 VB # 3 | -------------------------------------------------------------------------------- /test/data/shp/road_level_2.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_2.shx -------------------------------------------------------------------------------- /test/data/shp/road_level_3.dbf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_3.dbf -------------------------------------------------------------------------------- /test/data/shp/road_level_3.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["degree",0.0174532925199433]] -------------------------------------------------------------------------------- /test/data/shp/road_level_3.sbn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_3.sbn -------------------------------------------------------------------------------- /test/data/shp/road_level_3.sbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_3.sbx -------------------------------------------------------------------------------- /test/data/shp/road_level_3.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_3.shp -------------------------------------------------------------------------------- /test/data/shp/road_level_3.shp.xml: -------------------------------------------------------------------------------- 1 | 2 | 20180409163339001.0TRUECalculateField road_level_3 class 1 VB #CalculateField road_level_3 class 2 VB #CalculateField road_level_3 class 3 VB # 3 | -------------------------------------------------------------------------------- /test/data/shp/road_level_3.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhuang-hao-ming/make-taz/3685477c60eb342b957735d3f0c90f1145fbcd85/test/data/shp/road_level_3.shx -------------------------------------------------------------------------------- /test/test.py: -------------------------------------------------------------------------------- 1 | from make_taz import make_taz, simplify_polygon 2 | 3 | 4 | if __name__ == '__main__': 5 | make_taz('../test/data/input/road_level_2.tif', '../test/data/result/out.tif') 6 | # simplify_polygon('./data/shp/taz_level2_3.shp', './data/shp/taz_level2_sim.shp', 30) --------------------------------------------------------------------------------