This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Return meiner Variable
#1
Wink 
Hallo zusammen, ich bin JS Anfänger und versuche mich seit ein paar Tagen an einem Problem.

Google bringt mir auch nix wirkliches an hilfe. Villt. könnte mir einer helfen bzw. einen Denkanstoß geben.

function GetGEOAdress(Strasse,HNR,Ort){
        HNR = HNR.trim();
        HNR = HNR.replace(" ", "")
        Ort = Ort.trim();
        Ort = Ort.replace(" ", "%20")
        Strasse =  Strasse.trim();
        Strasse = Strasse.replace(" ", "%20")
        var geo;

        URL = "https://nominatim.openstreetmap.org/search?format=json&limit=1&addressdetails=1&q="+Ort+"%20"+HNR+"%20"+Strasse+"";
        $.getJSON(URL, function(data) {
            $.each( data, function( key, val ) {
                let lat          = val.lat;
                let lon          = val.lon;
                let boundingbox  = val.boundingbox;
                let display_name = val.display_name;
                let plz 		 = val.address.postcode;
                let street       = val.address.pedestrian;
                let hnr          = val.address.house_number;
                geo = lat+":"+lon;
            });
        });
        return geo;
    }

Ich versuche mit diesem Script die GeoDaten über mein Return auszugeben.

Um es zu Testen folgendes nutzen:

GetGEOAdress('Aachener Str.','999','Köln');



Ich verzweifle gerade.....  Dodgy
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste