GPSInfoTool.cs 806 B

1234567891011121314151617181920212223242526
  1. using Azylee.Core.DataUtils.CollectionUtils;
  2. using Azylee.YeahWeb.HttpUtils;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. namespace Azylee.YeahWeb.BaiDuWebAPI.GPSAPI
  9. {
  10. public class GPSInfoTool
  11. {
  12. public static GPSInfoWebModel GetInfo(string ak, double longitude, double latitude )
  13. {
  14. try
  15. {
  16. string url = $"http://api.map.baidu.com/geocoder/v2/?location={latitude},{longitude}&coordtype=wgs84ll&output=json&ak={ak}";
  17. string rs = HttpTool.Get(url);
  18. GPSInfoWebModel obj = JsonConvert.DeserializeObject<GPSInfoWebModel>(rs);
  19. if (obj != null) return obj;
  20. }
  21. catch { }
  22. return null;
  23. }
  24. }
  25. }