静态地图路径与map.google.com路径不同
我已经使用Google API来获取静态地图,并且Direction API没有给出正确的经纬度。
此“使用正确的2条车道在214C出口合并到AZ-101 Loop E上”之后,API方向应显示为右侧,但未显示。
该路径在214C之后没有纬度(例如:“ 33.666624,-112.010035”)。
enter code here
var drivingDirectionRequest = new DirectionsRequest
{
Origin = "Paulden, Arizona",
Destination = "Chandler, AZ 85224",
ApiKey = own_key
TravelMode = TravelMode.Driving,
Waypoints = new List<string>().ToArray(),
};
DirectionsResponse drivingDirections =
GoogleMaps.Directions.Query(drivingDirectionRequest);
IEnumerable<Step> steps =
drivingDirections.Routes.First().Legs.First().Steps;
IList<ILocationString> path = steps.Select(step =>
step.StartLocation).ToList<ILocationString>();
path.Add(steps.Last().EndLocation);
string url = staticMapGenerator.GenerateStaticMapURL(new StaticMapRequest(new Location(34.143778, -112.148000), 8, new ImageSize(1000, 1000))
{
MapType = GoogleMapsApi.StaticMaps.Enums.MapType.Roadmap,
Pathes = new List<Path> { new Path
{
Style = new PathStyle
{
Color = "red"
},
Locations = path
}},
ApiKey = own_key
});