GPSInfoTool.cs 660 B

123456789101112131415161718192021
  1. using Azylee.Jsons;
  2. using Azylee.YeahWeb.HttpUtils;
  3. namespace Azylee.YeahWeb.BaiDuWebAPI.GPSAPI
  4. {
  5. public class GPSInfoTool
  6. {
  7. public static GPSInfoWebModel GetInfo(string ak, double longitude, double latitude)
  8. {
  9. try
  10. {
  11. string url = $"http://api.map.baidu.com/geocoder/v2/?location={latitude},{longitude}&coordtype=wgs84ll&output=json&ak={ak}";
  12. string rs = HttpTool.Get(url);
  13. GPSInfoWebModel obj = Json.String2Object<GPSInfoWebModel>(rs);
  14. if (obj != null) return obj;
  15. }
  16. catch { }
  17. return null;
  18. }
  19. }
  20. }