【python】使用wkt格式的数据

wkt数据格式

wkt是以文本形式描述的地理数据存储格式,常用的WKT数据格式如下:

  • point ( 10.05 10.28 )
  • multipoint (10 10, 20 20)
  • linestring (10.05 10.28 , 20.95 20.89 )
  • multilinestring ((10.05 10.28 , 20.95 20.89 ),( 20.95 20.89, 31.92 21.45))
  • polygon ((10 10, 10 20, 20 20, 20 15, 10 10))
  • multipolygon (((10 10, 10 20, 20 20, 20 15 , 10 10), (50 40, 50 50, 60 50, 60 40, 50 40)))

更多参考:
https://www.cnblogs.com/GIS-Pirlo/archive/2011/08/26/2154549.html

python 使用wkt

  • 加载wkt数据
import shapely.wkt as wkt

wkt_point = wkt.loads("point ( 10.05 10.28 )")
wkt_line = wkt.loads("linestring (10.05 10.28 , 20.95 20.89 )")
wkt_polygon = wkt.loads("polygon ((10 10, 10 20, 20 20, 20 15, 10 10))")

运行结果

  • 加载之后的处理参考shapely用户手册
    shapely用户手册目录:https://shapely.readthedocs.io/en/latest/
    shapely用户手册详情:https://shapely.readthedocs.io/en/latest/manual.html#geometric-objects

你可能感兴趣的:(【python】使用wkt格式的数据)