Javascript 如何在谷歌地图上添加自己的流量层
我有如下的jsonJavascript 如何在谷歌地图上添加自己的流量层,javascript,google-maps,google-maps-api-3,Javascript,Google Maps,Google Maps Api 3,我有如下的json [{ "startnode_lat": "x1", "startnode_lng": "y1", "endnode_lat": "x11", "endnode_lng": "y11", "color": "green" }, { "startnode_lat": "x2", "startnode_lng": "y2", "endnode_lat": "x22", "endnode_lng": "y22",
[{
"startnode_lat": "x1",
"startnode_lng": "y1",
"endnode_lat": "x11",
"endnode_lng": "y11",
"color": "green"
}, {
"startnode_lat": "x2",
"startnode_lng": "y2",
"endnode_lat": "x22",
"endnode_lng": "y22",
"color": "red"
}, {
"startnode_lat": "x3",
"startnode_lng": "y3",
"endnode_lat": "x33",
"endnode_lng": "y33",
"color": "yellow"
}]
如何在google地图上添加类似json的流量层我认为最简单的方法应该是按照GeoJSON格式创建json文件: 之后,您将能够在Maps JavaScript API数据层中加载它,如以下示例所示: 希望有帮助