0

클라이언트 주소가 적은 (3000 이하) 임의의 시간에 생성 된 CSV 파일이 거의 없습니다. 지도보기를 생성하기 위해 Google지도 엔진에 보낼 수 있습니까? (파일을 dag-drop하지 않고 자동화하려고 함) 감사합니다.Google지도 엔진에 CSV 파일을 전달할 수있는 방법이 있습니까? (쿼리 문자열 또는 다른 방법으로)

+0

https://support.google.com/mapsengine/answer/3187059?hl=en – geocodezip

+0

그게 어느 정도 도움을 생성하는 VBA 코드를 사용했다. csv 형식을 얻었습니다. 하지만지도를 생성하려면지도 엔진에 수동으로 드래그해야합니다. 정말 다른 응용 프로그램의지도 엔진에 직접 파일을 보내려고합니다. 예. 클릭 한 버튼을 지원하면 csv가로드되고지도가 생성됩니다. 감사 – rchacko

답변

0

내 요구 사항은 간단했고이를 해결하는 간단한 방법을 찾았습니다. 런타임시 모든 텍스트 주소가 자바 스크립트 배열에 삽입 된 상태로 HTML 페이지를 생성 한 다음이를 반복하여 지오 코딩 및 마크 된 장소를 생성합니다. 단 1 초 간격으로 연속적인 지오 코딩 요청이 필요하기 때문에 성능 저하가있었습니다. 나는하여 HTML

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset='utf-8'> 
     <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'> 
     <title>Data : geographically linked</title> 
     <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'></script> 
     <script src='https://maps.googleapis.com/maps/api/js?v=3.11&sensor=false' type='text/javascript'></script> 
     <script type='text/javascript'> 
     // check DOM Ready 
     $(document).ready(function() { 
      // execute 
      (function() { 
       /////////////// Addresses /////////////////// 
       var locations = new Array(); 
       var i = 0; 
       locations[i++] = 'L,Riversea: office Loc1,1 Wallace Lane Mosman Park WA 6012' 
       locations[i++] = 'C,Wearne: office Loc2,3 Gibney St Cottesloe WA 6011' 
       locations[i++] = 'S,Beachside: office Loc3,621 Two Rocks Rd Yanchep WA 6035' 
       /////// Addresses///////// 
       var total_locations = i; 
       i = 0; 
       console.log('About to look up ' + total_locations + ' locations'); 
       // map options 
       var options = { 
        zoom: 10, 
        center: new google.maps.LatLng(-31.982484, 115.789329),//Bethanie 
        mapTypeId: google.maps.MapTypeId.HYBRID,//TERRAIN/ ROADMAP/ SATELLITE 
        mapTypeControl: true 
       }; 
       // init map 
       console.log('Initialise map...'); 
       var map = new google.maps.Map(document.getElementById('map_canvas'), options); 
       // use the Google API to translate addresses to GPS coordinates 
       //(See Limits: https://developers.google.com/maps/documentation/geocoding/#Limits) 
       var geocoder = new google.maps.Geocoder(); 
       if (geocoder) { 
        console.log('Got a new instance of Google Geocoder object'); 
        // Call function 'createNextMarker' every second 
        var myVar = window.setInterval(function(){createNextMarker()}, 700); 
        function createNextMarker() { 
         if (i < locations.length) 
         { 
          var customer = locations[i]; 
          var parts = customer.split(','); // split line into parts (fields) 
          var type= parts.splice(0,1); // type from location line (remove) 
          var name = parts.splice(0,1); // name from location line(remove) 
          var address =parts.join(','); // combine remaining parts 
          console.log('Looking up ' + name + ' at address ' + address); 
          geocoder.geocode({ 'address': address }, makeCallback(name, type)); 
          i++; // next location in list 
          updateProgressBar(i/total_locations); 


         } else 
         { 
          console.log('Ready looking up ' + i + ' addresses'); 
          window.clearInterval(myVar); 
         } 
        } 

        function makeCallback(name,type) 
        { 
         var geocodeCallBack = function (results, status) { 
          if (status == google.maps.GeocoderStatus.OK) { 
           var longitude = results[0].geometry.location.lng(); 
           var latitude = results[0].geometry.location.lat(); 
           console.log('Received result: lat:' + latitude + ' long:' + longitude); 
           var marker = new google.maps.Marker({ 
            position: new google.maps.LatLng(latitude, longitude), 
            map: map, 
            title: name + ' : ' + '\r\n' + results[0].formatted_address});// this is display in tool tip/ icon color 
            if (type=='E') {marker.setIcon('http://maps.google.com/mapfiles/ms/icons/green-dot.png')}; 
            if (type=='L') {marker.setIcon('http://maps.google.com/mapfiles/kml/pal4/icon53.png')}; 
            if (type=='S') {marker.setIcon('http://maps.google.com/mapfiles/ms/icons/blue-dot.png')}; 
          } 
          else { 
           console.log('No results found: ' + status); 
          } 
         } 
         return geocodeCallBack; 
        } 
       } else 
       { 
        console.log('Failed to instantiate Google Geocoder object'); 
       } 

       function updateProgressBar(percentage_factor) { 
        var map_canvas = document.getElementById('map_canvas'); 
        var node = document.getElementById('progress_bar'); 
        var w = map_canvas.style.width.match(/\d+/); 
        w = w * percentage_factor; 
        node.style.width = parseInt(w) + 'px'; 
        if (percentage_factor == 1) { 
         // jscript style properties are different to the CSS style properties... 
         node.style.backgroundColor = 'green'; 
        } 
       } 

      })(); 

     }); 

     </script> 
    </head> 
    <body> 
    <div style='border: 1px solid black; width:1366px; height:3px;'> 
     <div id='progress_bar' style='height:3px; width:0px; background-color:red;'/> 
    </div> 
    <!-- if you change this id, then also update code of progress bar above --> 
     <div id='map_canvas' style='width:1900px; height:1000px;'></div> 
    </body> 
</html>