गूगल जियोकोडर कई अलग अलग पतों के लिए अक्षांश / एलएनजी के एक ही सेट देता है। अक्षांश / Lng शहर के निर्देशांक या टाउनशिप और पता नहीं कर रहे हैं

वोट
0

मैं google.geocoder कई पतों भेज रहा हूँ, लेकिन परिणाम [0] .geometry.location में मानों सब एक ही हैं। मेरा मानना ​​है कि मैं कॉल कॉल बैक का उपयोग करने का अतुल्यकालिक प्रकृति के लिए जिम्मेदार है। जब मैं मूल्यों लौटे, पते geocoder.geocode में पारित (देखने के लिए अलर्ट जोड़ने { 'पता': addr} ... सब सही हैं, स्थिति लौटा ठीक है है, लेकिन अक्षांश / देशांतर के लिए ही कर रहे हैं हर कॉल। मैं बहुत अच्छी तरह से जावास्क्रिप्ट में निपुण हूँ नहीं है, और .net पर्यावरण के लिए नया हूँ, इसलिए किसी भी मदद बहुत सराहना की जाएगी।

इस कोड को दिसम्बर के पास कुछ समय तक 2012/04/01 से पूरी तरह से काम किया है या 2013 के आरंभ में कुछ गूगल एपीआई के साथ बदल गया है? मैं गूगल की वेबसाइट पर ध्यान दिया है, लेकिन कुछ भी नहीं मिल सकता है।

यहाँ मेरी प्रारंभिक कॉल है:

    <script type=text/javascript src=http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false></script>

<script type=text/javascript>   

 var geocoder;
 var map;
 var directionsDisplay;
 var directionsRenderer;
 var startPoint;
 var endPoint;

 function initialize() 
 {
  geocoder = new google.maps.Geocoder();

   codeAddress();
   var myOptions = 
   {
    zoom: 12,
    mapTypeId: google.maps.MapTypeId.ROADMAP
   }
    map = new google.maps.Map(document.getElementById(map_canvas), myOptions);  

   var trafficLayer = new google.maps.TrafficLayer();
   trafficLayer.setMap(map);

   setMarkers(map);

   google.maps.event.addListener(map, 'click', function(event) {
   dirMarker(event.latLng);
   startPoint = event.latLng;
      });
  }


 function codeAddress() 
 {
   var address =  document.getElementById(<%=hCVT.ClientID%>).value;

   geocoder.geocode( { 'address': address}, function(results, status) {

     if (status == google.maps.GeocoderStatus.OK) {
      alert(Status:  + status + res from CODE ADDRESS --  +  results[0].geometry.location);  //TO REMOVE
     map.setCenter(results[0].geometry.location);
    } else {
      alert(Geocode of CVT was not successful for the following reason:  + status);
     }
   });
 }

मार्करों और जानकारी विंडो जानकारी सेट करने समारोह (मैं कोड उस प्रश्न का अप्रासंगिक लगी में से कुछ को हटा दिया है)

    function setMarkers(map) 
    {
     // Add markers to the map

      var shape = {
      coord: [1, 1, 1, 20, 18, 20, 18 , 1],
      type: 'poly'
     };

  var places = new Array([,,,,]);
     var xx = String; 
     xx = document.getElementById(<%=addys.ClientID%>).value;
     var placeholder = xx.split(,);

     var latlng;


     var i = 0;
     for(var y = 0; y < (placeholder.length / 5 - 1); i=i+5)
     {

     places[y, 0] = placeholder[i];
     places[y, 1] = placeholder[i+1]; //Unit Status
     places[y, 2] = placeholder[i+2]; // Long - not used
     places[y, 3] = placeholder[i+3]; // Zindex
     places[y, 4] = placeholder[i+4]; // HTML for information window

     addr = places[y,0];
     ustat = places[y,1];   
     zind = places[y,3];
     iwdata = places[y,4];

     getLatLong(addr, iwdata, ustat, zind, function(latlng, addr, iwdata, ustat, zind)   {






var marker = new google.maps.Marker({
     position: latlng,
     map: map,
     html: iwdata,
     icon: pinImage,
     shadow: pinShadow,
     shape: shape,
     title: addr,
     zIndex: parseInt(places[y,3])
     });

   var infowindow = new google.maps.InfoWindow({
           content: iwdata}); 



  });

   y = y + 1;
  }

   }

समारोह मैं कहाँ का मानना ​​है कि समस्या है इस प्रकार है। के बाद से वहाँ थे कई पते Google को भेजा जा रहा है, मैं एक समय समाप्ति में बनाया ताकि सीमाओं से अधिक नहीं करने के लिए जोड़ा। फिर, यह सब के बारे में 8 महीने के लिए काम किया है और अचानक रुक गया है। जहां कई चिह्न नक्शे पर दिखाने के लिए इस्तेमाल किया, अब वहाँ एक मार्कर जो लिखा क्योंकि अक्षांश / एलएनजी वापसी codeAddress () फ़ंक्शन में प्रारंभिक कॉल के रूप में ही है से अधिक प्रतीयमान जाता है। एक समाधान खोजने के प्रयास में मैं मुझे वापसी मान दिखाने के लिए अलर्ट जोड़ने की है। मैं बगजिला मूल्यों के साथ भ्रमित हो रही थी के रूप में वे मेरे गूगल जावास्क्रिप्ट जो पूरी तरह से मेरे सिर पर था करने के लिए अपने हाथ में ले जाएगा।

     function getLatLong(addr, iwdata, ustat, zind, callback){

       geocoder.geocode( { 'address': addr}, function(results, status){       
        if (status == google.maps.GeocoderStatus.OK){                       
          callback(results[0].geometry.location, addr, iwdata, ustat, zind);
            } else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {

             window.setTimeout(function() {self.getLatLong(addr, iwdata, ustat, zind, callback);
             },500);
            } else {
            alert(Address Geocode failure:  + addr +  ====  + status + Y value:  + zind +  res --- + res);
            }
    });
    }

क्या कोई मुझे इस बारे में सहायता कर सकता है?

22/02/2013 को 16:05
का स्रोत उपयोगकर्ता
अन्य भाषाओं में...                            


1 जवाब

वोट
0

खैर, यह कोड यह पता लगाने की कोशिश घूर के कुछ लंबे समय तक के बाद, मैं अंत में चालाकी रखा अलर्ट का उपयोग करके कुछ पर ठोकर खाई। जाहिर है addr चर निहित " '" और जियोकोडर एक परिणाम के रूप अक्षांश / एलएनजी डेटा प्रदान करने में सक्षम नहीं था। इस लाइन समायोजित:

addr = places[y,0].replace(/'/g, "");

सभी अब काम करता है।

28/03/2013 को 18:42
का स्रोत उपयोगकर्ता

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more