使用simplekml模块合并多边形

时间:2019-03-20 13:28:47

标签: python google-earth simplekml

simplekml模块生成多个多边形,而不是单个多边形。有什么方法可以将多边形合并为单个多边形,而不是多个??

import simplekml, pandas as pd
tuples=tuple([(72.852333, 29.807333), (73.131333, 29.6055), (72.84733299999999, 29.587667), (73.568833, 30.1625), (72.8633, 29.2014), (73.1385, 29.614), (72.863667, 29.206667), (73.7015, 30.246667), (72.87169, 29.803279999999997), (72.8665, 29.794666999999997), (72.85826999999999, 29.79843), (72.847, 29.596166999999998), (73.0363238, 29.9029902), (73.035667, 29.466167), (72.8405, 29.587833000000003), (73.258333, 30.007167), (72.85779000000001, 29.79529), (73.022667, 29.478167), (72.84916700000001, 29.4135), (72.9155, 29.269000000000002), (72.840333, 29.620833), (73.2535, 29.992666999999997), (73.2535, 29.992666999999997), (72.86291999999999, 29.79293), (73.253, 29.997667), (73.25366700000001, 29.982667), (72.86233299999999, 29.798167), (73.253, 29.998666999999998), (72.939167, 29.331333), (73.04566700000001, 29.475), (72.84899999999999, 29.791999999999998), (73.131333, 29.6055), (73.565833, 30.164167), (73.14183299999999, 29.606167), (72.946833, 29.500333), (73.13766700000001, 29.615333000000003), (72.922, 29.418667), (72.830667, 29.683000000000003), (73.559774, 30.163674), (73.572, 30.165667), (73.258333, 30.006999999999998), (72.401833, 29.222833), (73.5695, 30.159000000000002), (72.859, 29.197333), (72.839833, 29.596333), (72.9516, 29.5113), (73.25365699999999, 29.992668), (72.866333, 29.803167), (72.9469, 29.6002), (73.2535, 29.992666999999997), (73.252167, 30.003833), (73.0400358, 29.4768821), (73.241233, 29.753483000000003), (73.24731700000001, 29.753967), (72.93329920000001, 29.276225), (72.8875, 29.413333), (72.8565, 29.195166999999998), (73.142333, 29.6125), (73.258333, 29.994166999999997), (72.97783299999999, 29.5), (72.901167, 29.414833), (72.9615, 29.3285), (72.852333, 29.807333), (73.135333, 29.606333000000003), (73.26016700000001, 30.002833000000003), (72.85883299999999, 29.197333), (72.859833, 29.193666999999998), (72.840333, 29.600666999999998), (73.131333, 29.6055), (73.738667, 30.157667), (72.41816700000001, 29.225167), (72.85448000000001, 29.79598), (72.85249, 29.803440000000002), (72.70944399999999, 29.735556), (72.857833, 29.199833), (73.0722, 29.5486), (73.14844000000001, 29.602040000000002), (73.260333, 29.996833000000002), (73.266667, 30.006666999999997), (73.039333, 29.4745), (73.252167, 30.003667), (72.836, 29.784333), (72.88833299999999, 29.203833000000003), (72.4266, 29.2262), (73.697333, 30.245833), (73.0158, 29.8002), (73.036833, 29.9015), (73.241167, 29.974), (73.266667, 30.006666999999997), (73.24255, 29.753517), (73.0365, 29.469666999999998), (73.259833, 30.002667), (73.25783299999999, 29.995833), (73.241167, 29.974), (73.13600000000001, 29.610333), (73.25483299999999, 29.999333), (73.135333, 29.606333000000003), (73.18933299999999, 29.531333), (72.958833, 29.330667), (72.8615, 29.1965), (72.8545, 29.596333), (73.7336, 30.1558), (73.25366700000001, 29.982667), (72.668667, 29.254), (73.25374000000001, 29.98262), (72.7566, 29.6736), (73.03, 29.457333000000002), (72.8581, 29.7985), (72.8602, 29.797690000000003), (72.83716700000001, 29.669666999999997), (72.8615, 29.1965), (73.257667, 29.995833), (73.26083299999999, 30.000833), (73.2535, 29.992666999999997), (73.125833, 29.6025), (72.66883299999999, 29.2475), (73.258333, 29.994166999999997), (73.14015, 29.619529999999997), (73.1386584, 29.613507399999996), (72.86265, 29.78945), (73.561167, 30.163833), (72.86129, 29.795740000000002), (73.2391, 29.7552), (72.841833, 29.598167)])
kml = simplekml.Kml()
pol = kml.newpolygon(name="Atrium Garden",
outerboundaryis=tuples)         
pol.style.polystyle.color = simplekml.Color.red
pol.style.polystyle.outline = 1
pol.style.polystyle.fill = 1
kml.save(r"C:\Users\user\Desktop\PolyStyle.kml")

0 个答案:

没有答案