zoukankan      html  css  js  c++  java
  • 利用google地图获取位置经纬度坐标的方法

    利用google地图获取位置经纬度坐标的方法

        public static void main(String[] args) throws UnsupportedEncodingException {
            String address = URLEncoder.encode("北京 香山公园","UTF-8");
            String url = "http://maps.google.cn/maps/geo?q="+address+"&output=csv&oe=utf8\\&sensor=true_or_false&           key=ABQIAAAAqaGKijD7euSpqDeVsNA85xTT3OL8VXjPlPTFW7n7OgOFwXoSnxT7IP1pHznaiGwWMvsEq_SkxvESLw";
            String content = Spider.getContent(url);
            String[] info = content.split(",");
            System.out.println(info[2]+","+info[3]);
        }

    一下为改过后的代码

        public static void main(String[] args) throws UnsupportedEncodingException {
            String address = URLEncoder.encode("北京 香山公园","UTF-8");
            String url = "http://maps.google.cn/maps/geo?q="+address+"&output=json&ie=utf8";
            String content = Spider.getContent(url);
            String[] info = content.split(",");
            System.out.println(info[2]+","+info[3]);
        }
    http://maps.google.cn/maps/geo?q=南京市&output=json&ie=utf8
    {
      "name": "南京市",
      "Status": {
        "code": 200,
        "request": "geocode"
      },
      "Placemark": [ {
        "id": "p1",
        "address": "中国江苏省南京市",
        "AddressDetails": {
       "Accuracy" : 4,
       "Country" : {
          "AdministrativeArea" : {
             "AdministrativeAreaName" : "江苏省",
             "Locality" : {
                "LocalityName" : "南京市"
             }
          },
          "CountryName" : "中国",
          "CountryNameCode" : "CN"
       }
    },
        "ExtendedData": {
          "LatLonBox": {
            "north": 32.3940135,
            "south": 31.8045247,
            "east": 119.0501690,
            "west": 118.4253323
          }
        },
        "Point": {
          "coordinates": [ 118.7968770, 32.0602550, 0 ]
        }
      } ]
    }
  • 相关阅读:
    c#同类型操作最终得到的结果将是同类型
    RabbitMQ的高级特性(五)延迟队列 lq
    RabbitMQ的高级特性(二)消费端限流 lq
    RabbitMQ的高级特性(一)可靠性传递 lq
    RabbitMQ的高级特性(四)死信队列 lq
    RabbitMQ的高级特性(三)TTL lq
    rabbitmq的常见问题及解决方案 lq
    RabbitMQ集群搭建 lq
    炫酷设计
    【转】全球超酷智能眼镜扫描
  • 原文地址:https://www.cnblogs.com/blogsme/p/2933362.html
Copyright © 2011-2022 走看看