我想做一个地图查询,想直接调用google map api,但是不知道它能不能满足我的要求,我需要有中国的完整地图,包括港、澳、台,然后点到省的时候,就标出市一级的城市出来、再到市、就会出来县。然后我不需要其它的地标,只需要我想要的地标,大概在某个位置上就行了,然后点到它的时候,可以出来具体的内容。这样可以做到吗?????

解决方案 »

  1.   

    可以的..google api :http://code.google.com/intl/en/apis/ajaxsearch/documentation/reference.html
      

  2.   


    String key = "XXXXXXX";
    // String output = "JSON";
    String output = "xml";
    Document document = null;
    String address = "changsha";
    try {
    String urlpath = "http://maps.google.com/maps/geo?output=" + output
    + "&key=" + key + "&q="
    + URLEncoder.encode(address, "UTF-8");
    URL url = new URL((urlpath));
    SAXReader reader = new SAXReader();
    document = reader.read(new InputStreamReader(url.openStream()));
    } catch (Exception e) {
    throw new LutherslistException(e, "Get location failed.");
    }
    Element root = document.getRootElement();
    System.out.println(root.asXML());
    List<Element> list = root.element("Response").elements("Place");
    然后解析xml 就可以了....  
    当然还支持json 操作的.
      

  3.   

    你需要知道到经纬度,google是通过这个定位的。
      

  4.   

    还没找到啊,给你一个参考:
    存为html文件<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAAo07eA8IJ1Wof9febizJTRSqlJ1UWL_pe0SJD0tF2XORmmD5nhTo6VGitXjGGI5Xp0wGAHMt41e0oQ"></script>
    </head>
    <body>
    <div id="singleMap" style="width:document.body.clientWidth; height: 700px"></div>
    <script type="text/javascript">
        //解析参数    var map;
        var geocoder;
        var latlng;
    var longitude = 112.123456;//经度
    var latitude = 29.234567;//纬度
    map = new GMap2(document.getElementById("singleMap"));
    latlng = new GLatLng(latitude,longitude);
    map.setCenter(latlng, 11);
    map.setUIToDefault();
            er = new GMarker(latlng);
            map.addOverlay(er);       
            geocoder = new GClientGeocoder();
            GEvent.addListener(er, "click", getAddress);
        function getAddress(er,latlng) {
    //        if (latlng != null) {
    latlng = map.getCenter();
                address = latlng;
              geocoder.getLocations(latlng, showAddress);
    //        }
          }      function showAddress(response) {
            if (!response || response.Status.code != 200) {
              alert("Status Code:" + response.Status.code);
            } else {
              place = response.Place[0];
              er.openInfoWindowHtml(
              '<b>原纬经度: </b>' + response.name + '<br/>' + 
              '<b>纬度经度: </b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
              '<b>具体地址: </b>' + place.address + '<br>' +
              '<b>分  辨   率: </b>' + place.AddressDetails.Accuracy + " 米"+'<br>' +
              '<b>国家代码: </b> ' + place.AddressDetails.Country.CountryNameCode);
            }
          }
      
     
    </script></body>
    </html>    
      

  5.   

    我看GOOGLE好像会把所有的地方都显示出来,如果只显示我想显示的地方,这样可以的吗????