It is currently 7 June 2025, 17:36 Advanced search

GOOGLE MAPS

Domande e risposte su come utilizzare Instant Developer Cloud al meglio

GOOGLE MAPS

Postby merlomixnow » 29 June 2023, 13:26

dati 3 campi input (indirizzo,città,nazione)
nell’evento onclick di un pulsante devo
-assegnare il valore della latitudine ad un campo input
-assegnare il valore della longitudine ad un campo input
merlomixnow
 
Posts: 168
Joined: 25 June 2013, 14:57

Re: GOOGLE MAPS

Postby majinbu » 10 July 2023, 13:52

Io faccio così:
Code: Select all

App.SelectTargetLocationFrm.prototype.getPosFromAddress = function(address)
{
  if (address)
  {
    var u = app.fs.url("https://maps.googleapis.com/maps/api/geocode/json?address=" + address + "&" + app.theme.gmapKey);
    var res = yield u.get();
    if (res.status === 200)
    {
      results = res.body;
      var obj = JSON.parse(results);
      if (obj.results[0].geometry) {
        var geometry = obj.results[0].geometry;
        var location = geometry.location;
        return location;
      }
    }
    return null;
  } else return null;
  return null;
};




getPosFromAddress è un metodo che restituisce un oggetto, poi dall'oggetto ti tiri fuori le info che ti servono.

Ciao
majinbu
 
Posts: 34
Joined: 4 June 2020, 8:15


Return to Tips & Tricks - Cloud

Who is online

Users browsing this forum: No registered users and 5 guests