wkt convert osmosis .poly ( PolygonFilter input )

2023-09-25 12 0

MULTIPOLYGON WKT 数据地址 21523.txt

Osmosis/Polygon Filter File Format

wkt 转 poly

import sys
import numpy as npfor ipath in sys.argv[1:]:if not ipath.endswith('.txt'):print(f'skip {ipath}')opath = f'{ipath}.poly'print(opath)with open(ipath) as f:text = f.read()with open(opath, 'w') as f:f.write('geofence\n')cols = text.split('(')for idx, col in enumerate(cols):if len(col) < 100:continuef.write(f'area{idx}\n')coords = np.array([[float(x) for x in lla.split()] for lla in col[:-6].split(',')])for c in coords:f.write(f'    {c[0]} {c[1]}\n')f.write('END\n')# print(coords)f.write('END\n')print(f'wrote to {opath}')

输出 21523.txt.poly

开始过滤数据

 osmosis --read-xml file="msd.osm"--bounding-polygon file="21523.txt.poly" completeWays="yes" clipIncompleteEntities="true" --write-xml file="21523.osm"

从 msd.osm 中以 21523.txt.poly 为 boundary 过滤出了高亮部分的 osm 数据
在这里插入图片描述

代码编程
赞赏

相关文章

不伤原图电脑在线去水印网站
在线视频转换器工具
图片如何在线无痕去除水印
图片带满屏水印怎么去除?
超详细Hyperledger Fabric2.3.3开发教程
入门卷积神经网络必备,基础、理论、实战一网打尽!