请原谅我的无知,但经过几个小时的搜索,我运气不佳。
无论如何,我正在尝试编写一个小型桌面应用程序,允许用户输入地址,然后以 GPS 坐标返回其大致位置。据我所知,Google 提供了一个地理编码 API[1],允许以下形式的请求:
http://maps.googleapis.com/maps/api/geocode/output?parameters http://maps.googleapis.com/maps/api/geocode/output?parameters
虽然我熟悉编写基本的 C Sharp 应用程序,但在与此 API 交互时,我真的不知道从哪里开始。如果你们能提供任何帮助,我们将不胜感激。
我编写了一个完整记录的 .NET 库 -
适用于 .NET 的 Google 地图 Web 服务 API 包装器https://github.com/maximn/google-maps/ https://github.com/maximn/google-maps/
//Directions
DirectionsRequest directionsRequest = new DirectionsRequest()
{
Origin = "NYC, 5th and 39",
Destination = "Philladephia, Chesnut and Wallnut",
};
DirectionsResponse directions = MapsAPI.GetDirections(directionsRequest);
//Geocode
GeocodingRequest geocodeRequest = new GeocodingRequest()
{
Address = "new york city",
};
GeocodingResponse geocode = MapsAPI.GetGeocode(geocodeRequest);
Console.WriteLine(geocode);
//Elevation
ElevationRequest elevationRequest = new ElevationRequest()
{
Locations = new Location[] { new Location(54, 78) },
};
ElevationResponse elevation = MapsAPI.GetElevation(elevationRequest);
Console.WriteLine(elevation);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)