在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):sethwebster/GoogleMaps.LocationServices开源软件地址(OpenSource Url):https://github.com/sethwebster/GoogleMaps.LocationServices开源编程语言(OpenSource Language):C# 100.0%开源软件介绍(OpenSource Introduction):GoogleMaps.LocationServicesA simple library for Google Maps geolocation and reverse geolocation. The easiest way to get hold of it is to install the Nuget package. From the package manager console:
Example Lookupusing GoogleMaps.LocationServices;
.....
AddressData[] addresses = new AddressData[]
{
new AddressData // Belgium
{
Address = "Rue du Cornet 6",
City = "VERVIERS",
State = null,
Country = "Belgium",
Zip = "B-4800"
},
new AddressData
{
Address = "1600 Pennsylvania ave",
City = "Washington",
State = "DC"
},
new AddressData
{
Address = "407 N Maple Dr. #1",
City = "Beverly Hills",
State = "CA"
}
};
// Constructor has 3 overload
// No parameters. It does not use API Key
var gls = new GoogleLocationService();
// Boolean parameter to force the requests to use https
// var gls = new GoogleLocationService(useHttps: true);
// String paremeter that provides the google map api key
// var gls = new GoogleLocationService(apikey: "YOUR API KEY");
foreach (var address in addresses)
{
try
{
var latlong = gls.GetLatLongFromAddress(address);
var Latitude = latlong.Latitude;
var Longitude = latlong.Longitude;
System.Console.WriteLine("Address ({0}) is at {1},{2}", address, Latitude, Longitude);
}
catch(System.Net.WebException ex)
{
System.Console.WriteLine("Google Maps API Error {0}", ex.Message);
}
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论