大家早上好,我是这个世界的新手,如果这是一个幼稚的问题,请原谅我。 我使用OSRM api服务来获取一些GPS轨道的地图匹配。我已经通过邮递员完成了此获取请求:
我应该使用Geojson格式的输出响应,但是我无法在qgis中打开它。 因此,这里的问题是:如何在地图中可视化这些类型的结果? 结果代码是这样的:
{
"matchings": [
{
"confidence": 0,
"geometry": {
"coordinates": [
[
9.225701,
45.477585
],
[
9.225701,
45.477592
]
],
"type": "LineString"
},
"legs": [
{
"summary": "",
"weight": 0.1,
"duration": 0.1,
"steps": [],
"distance": 0.8
}
],
"weight_name": "routability",
"weight": 0.1,
"duration": 0.1,
"distance": 0.8
}
],
"tracepoints": [
null,
null,
null,
null,
null,
null,
null,
null,
{
"alternatives_count": 1,
"waypoint_index": 0,
"matchings_index": 0,
"hint": "RZoigAmaIgAiAAAAEAAAAEwAAAATAAAA3yinQZJ9HEEuMTpCgLs6QSIAAAAQAAAATAAAABMAAAB8pgAA5cWMANHutQItxYwA0u61AgMADwC15fcK",
"distance": 14.388305747573964,
"name": "Piazza Leonardo da Vinci",
"location": [
9.225701,
45.477585
]
},
{
"alternatives_count": 1,
"waypoint_index": 1,
"matchings_index": 0,
"hint": "RZoigAmaIgAjAAAADwAAAEwAAAATAAAAI2KtQRELEEEuMTpCgLs6QSMAAAAPAAAATAAAABMAAAB8pgAA5cWMANjutQJBxYwA2e61AgMADwC15fcK",
"distance": 12.824458473911934,
"name": "Piazza Leonardo da Vinci",
"location": [
9.225701,
45.477592
]
}
],
"code": "Ok" }
答案 0 :(得分:0)
尝试一下:
data = {
"matchings": [
{
"confidence": 0,
"geometry": {
"coordinates": [
[
9.225701,
45.477585
],
[
9.225701,
45.477592
]
],
"type": "LineString"
},
"legs": [
{
"summary": "",
"weight": 0.1,
"duration": 0.1,
"steps": [],
"distance": 0.8
}
],
"weight_name": "routability",
"weight": 0.1,
"duration": 0.1,
"distance": 0.8
}
],
"tracepoints": [
"null",
"null",
"null",
"null",
"null",
"null",
"null",
"null",
{
"alternatives_count": 1,
"waypoint_index": 0,
"matchings_index": 0,
"hint": "RZoigAmaIgAiAAAAEAAAAEwAAAATAAAA3yinQZJ9HEEuMTpCgLs6QSIAAAAQAAAATAAAABMAAAB8pgAA5cWMANHutQItxYwA0u61AgMADwC15fcK",
"distance": 14.388305747573964,
"name": "Piazza Leonardo da Vinci",
"location": [
9.225701,
45.477585
]
},
{
"alternatives_count": 1,
"waypoint_index": 1,
"matchings_index": 0,
"hint": "RZoigAmaIgAjAAAADwAAAEwAAAATAAAAI2KtQRELEEEuMTpCgLs6QSMAAAAPAAAATAAAABMAAAB8pgAA5cWMANjutQJBxYwA2e61AgMADwC15fcK",
"distance": 12.824458473911934,
"name": "Piazza Leonardo da Vinci",
"location": [
9.225701,
45.477592
]
}
],
"code": "Ok" }
def myfunc_map(a, b, c):
return a + b +c
x = map(myfunc_map, data["matchings"], data["tracepoints"], data["code"])
结果:
<map object at 0x0000000004276A20>