我怎样才能得到以下几何结果
how can I get the following geometery results
我正在尝试通过以下代码制作几何图形并且我也得到了正确的结果,除了我提供的引号是双引号但结果它给了我单引号,任何原因?我怎样才能正确地做到这一点??
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"}]
我该怎么做???
geos = []
for idx, number in enumerate(iddata):
subV = rawData[rawData['id'] == number]
geoRawData = [[lon,lat] for lon,lat in zip(subV.lon ,subV.lat)]
poly = {
"type": "Feature",
"properties":{"weight": 300 , "sample": len(subV.id), 'id ': float(subV.id.unique())},
"geometry" : {
"type" : "LineString",
"coordinates" : geoRawData,
}
}
geos.append(poly)
geometry = FeatureCollection(geos)
# geometry
json.dump(geometry, open("rawGeometery.geojson","w"))
好吧,我使用这种方式并使用了从 Json 库导入的 FeatureCollection 库,它很有效并且非常简单..
我正在尝试通过以下代码制作几何图形并且我也得到了正确的结果,除了我提供的引号是双引号但结果它给了我单引号,任何原因?我怎样才能正确地做到这一点??
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"}]
我该怎么做???
geos = []
for idx, number in enumerate(iddata):
subV = rawData[rawData['id'] == number]
geoRawData = [[lon,lat] for lon,lat in zip(subV.lon ,subV.lat)]
poly = {
"type": "Feature",
"properties":{"weight": 300 , "sample": len(subV.id), 'id ': float(subV.id.unique())},
"geometry" : {
"type" : "LineString",
"coordinates" : geoRawData,
}
}
geos.append(poly)
geometry = FeatureCollection(geos)
# geometry
json.dump(geometry, open("rawGeometery.geojson","w"))
好吧,我使用这种方式并使用了从 Json 库导入的 FeatureCollection 库,它很有效并且非常简单..