我正在尝试通过以下代码制作几何图形,并且我也得到了正确的结果,除了我提供的引号是双引号之外,结果它给了我单引号,是什么原因?以及我该怎么做呢?
geos = []
for idx, longs in enumerate(uniqueID):
subV = df_Cleaned[df_Cleaned['subVoyageIDs_subV'] == longs]
data = [[lon,lat] for lon,lat in zip(subV.lon ,subV.lat)]
poly = {
"type": "LineString",
"coordinates" : data,
}
geos.append(poly)
geometries = {
"type": "FeatureCollection",
"features": geos,
}
结果:
[{'coordinates': [[-73.226768, 38.79985500000001],
[-73.341457, 38.71438699999999],
[-73.313495, 38.715463],
[-73.9692, 38.51808299999999],
[-73.964833, 38.51875000000001],
[-73.960483, 38.519450000000006],
[-73.956117, 38.52016699999999],
[-73.950933, 38.520983],
[-73.946, 38.52180000000001],
[-73.940733, 38.52263300000001],
[-73.936367, 38.52333300000001],
[-73.929967, 38.52436700000001],
[-73.92475, 38.525217],
[-73.91895, 38.52616699999999],
[-73.913133, 38.52706699999999],
[-73.908783, 38.52776700000001],
[-73.904417, 38.52844999999999],
[-73.887883, 38.53106700000001],
[-73.7623, 38.550983],
[-73.75295, 38.55256700000001]],
'type': 'LineString'}]
我需要的是
[{"coordinates": [[-73.226768, 38.79985500000001],
[-73.341457, 38.71438699999999],
[-73.313495, 38.715463],
[-73.9692, 38.51808299999999],
[-73.964833, 38.51875000000001],
[-73.960483, 38.519450000000006],
[-73.956117, 38.52016699999999],
[-73.950933, 38.520983],
[-73.946, 38.52180000000001],
[-73.940733, 38.52263300000001],
[-73.936367, 38.52333300000001],
[-73.929967, 38.52436700000001],
[-73.92475, 38.525217],
[-73.91895, 38.52616699999999],
[-73.913133, 38.52706699999999],
[-73.908783, 38.52776700000001],
[-73.904417, 38.52844999999999],
[-73.887883, 38.53106700000001],
[-73.7623, 38.550983],
[-73.75295, 38.55256700000001]],
"type": "LineString"}]
我该怎么做???
答案 0 :(得分:0)
float timer = 0;
Update()
{
if (Hunger <= 0.0f)
{
timer += time.deltaTime;
if (timer > 1f){
userHealth -= HealthDepletionValue;
timer = 0; //reset timer
}
}
}
好吧,我使用这种方法,并使用了从Json库导入的FeatureCollection库,它的工作原理非常简单。