wkt convert osmosis .poly ( PolygonFilter input )
Posted Hepburn Yang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wkt convert osmosis .poly ( PolygonFilter input )相关的知识,希望对你有一定的参考价值。
MULTIPOLYGON WKT 数据地址 21523.txt
Osmosis/Polygon Filter File Format
wkt 转 poly
import sys
import numpy as np
for 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:
continue
f.write(f'areaidx\\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')
开始过滤数据
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 数据
以上是关于wkt convert osmosis .poly ( PolygonFilter input )的主要内容,如果未能解决你的问题,请参考以下文章
wkt convert osmosis .poly ( PolygonFilter input )
如何在PC上下载“ blob:https://www.osmosis.org”视频?
GeoPHP Exception to convert mydql WKB 目前仅支持 NDR (little endian) SKB 格式
python 在Python中将GeoJSON转换为WKT或从WKT转换。 #python #geojson #geometry