Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8194649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:53:35+00:00 2026-06-07T04:53:35+00:00

I have an array with localizations ("street, city, postalcode, province, country"). I want to

  • 0

I have an array with localizations ("street, city, postalcode, province, country").
I want to have a string with all Lat and Lng values for each localization, like this ("#lat.value|lng.value#lat2.value|lng2.value.." etc). I use for this Google API Geocoder. But Geocoder has a annoying limit 10~11 localizations once. How can I get about 100 lat&lng values for 100 localization? I tried sleep() funcion, but this doesn’t work. This is my function in js.

                function sleep(time){
                   time = time * 1000;
                   var start = (new Date()).getTime();
                   while(true){
                      alarm = (new Date()).getTime();
                      if(alarm - start > time){ break; }
                   }
                }

(..)
                var mystring = "";
                var address = <%=testing %>
                var arrayaddress = address.split("%");

                for (var i = 0; i < arrayaddress.length-1; i++) {
                    sleep(0);
                    geocoder = new google.maps.Geocoder(); 
                    geocoder.geocode( { 'address': arrayaddress[i]}, function(results, status) {
                    if (status == google.maps.GeocoderStatus.OK) {
                        map.setCenter(results[0].geometry.location);
                        var marker = new google.maps.Marker({
                        map: map,
                        position: results[0].geometry.location
                        });
                        var zmiennalat = marker.getPosition().lat();
                        var zmiennalng = marker.getPosition().lng();
                        mystring = mystring + "#" + zmiennalat + "|" + zmiennalng;
                    } 
                    else 
                    {
                        mystring = mystring + "#" + "er" + "|" + "er";
                        //alert("Geocode was not successful for the following reason: " + status);
                    }
                    if (i == arrayaddress.length-1) {
                       var dsa = mystring;
                       document.getElementById("<%=hfWysokosc.ClientID%>").value = mystring;
                       document.getElementById("<%=hfSzerokosc.ClientID%>").value = dsa;
                       document.getElementById("<%=UpdateButton1.ClientID %>").click();
                    }

                    }); 
                 } // for

Then, result is for example:

er|er#34.42342|16.4323#23.32131|43.54545# etc..

always at first localizations is error with decoding (if more than 10 places in array). Why?
Why not at last localizations?

Resuming: How can i get more than 10 lat|lng values in this stirng with this loop?

Thanks!

EDIT

thanks, that work nice !

But there is another problem. string Mystring is showing very slowly.. how to repair it? and it is refreshing when marker is setting on map – maybe it is not a problem, but for 100-150 markers i have to wait a few long minutes to get Mystring value.. Is it any posibility to show more faster Mystring value?

                        var mystring = "";
                    var address = <%=testing %>
                    alert(address);
                    var arrayaddress = address.split("%");

                    (function nextStep(i){
                    if( i >= arrayaddress.length-1 ){
                        return;
                    }
                    geocoder = new google.maps.Geocoder(); 
                    geocoder.geocode( { 'address': arrayaddress[i]}, function(results, status) {
                    if (status == google.maps.GeocoderStatus.OK) {
                        map.setCenter(results[0].geometry.location);
                        var marker = new google.maps.Marker({
                        map: map,
                        position: results[0].geometry.location
                        });
                        var zmiennalat = marker.getPosition().lat();
                        var zmiennalng = marker.getPosition().lng();
                        mystring = mystring + zmiennalat + "|" + zmiennalng + "#";
                    } 
                    else 
                    {
                        mystring = mystring + "er" + "|" + "er" + "#";
                        //alert("Geocode was not successful for the following reason: " + status);
                    }
                    }); 
                    setTimeout(function(){   nextStep(i+1);   }, 800); 
                       var dsa = mystring;
                       document.getElementById("<%=hfSzerokosc.ClientID%>").value = dsa;
                       document.getElementById("<%=UpdateButton1.ClientID %>").click();    
                })(0);

UPDATE

                    function nextStep(i){
                    if( i >= arrayaddress.length-1 ){
                        return;
                    }
                    
                    // code
                    
                    }); 
                    setTimeout(function(){   nextStep(i+1);   }, 1000);     
                };

then

<button type="button" onclick="nextStep(0)">Click Me!</button>

and error is:

nextStep is not defined

what is wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:53:37+00:00Added an answer on June 7, 2026 at 4:53 am

    Instead of for-loop, try this:

    //...............
    //...............
    
    var mystring = "";
    var address = <%=testing %>
    var arrayaddress = address.split("%");
    
    //Modification-----BEGIN
    (function nextStep(i){
        if( i >= arrayaddress.length-1 ){
            return;
        }
    
        //-----------------
        //for-loop body here
        //------------------
    
        //
        setTimeout(function(){   nextStep(i+1);   }, 500);       
    })(0);
    //Modification-----END
    
    //...............
    //...............
    

    UPDATE: If you want to run nextStep function,only when button will be clicked,then modify above code like this:

    function nextStep(i){
        /////   
    };
    

    Then,when onclick will be triggered, simply call nextStep(0).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to enumerate all possible combinations of elements array. For example: I have
Imagine I have array of values ranging from 1 to 24. I want to
I have array in which i insert all the values in sqlite which are
I have Array of time string like 10:10:12,12:10:34,05:23:11 this. I want to calculate less(min)
I have array of strings, String[] data and it's 10 elements has value P
An array is defined of assumed elements like I have array like String[] strArray
I have array of class Person in ViewModel and I want to show their
I have array of words and I want to get a hash, where keys
I have array and contains 50 values , example [ 'london', 'bluehit', 'green', 'lonpark',
I have array of objects with created images (Object.Image), i want to show images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.