Jump to content

Recommended Posts

  • 1 year later...
Posted
13 minutos atrás, RDybuco disse:

Você resolveu essa tarefa? Como?

Este recurso seria muito útil.

procedure TUniFormConsultaEndereco.cbPesquisaEnderecoRemoteQuery(const QueryString: string; Result: TStrings);
begin
  var lRest := TRestNewUtils.Create('https://maps.googleapis.com/maps/api/place/autocomplete/json?input=' + TSparkleUtils.PercentEncode(QueryString) + '&language=pt_BR&key=' + _CHAVE_MAPS);

  try
    lRest.Execute;

    if lRest.Response.StatusCode <> 200 then Exit;

    var lObjectJson := lRest.ResponseJSONValue as TJSONObject;

    if lObjectJson.GetValue('status').Value.Equals('OK') then
    begin
      var lListPredictions := TJSONArray(lObjectJson.GetValue('predictions'));

      Result.Clear;
      for var I := 0 to lListPredictions.Count - 1 do
        Result.Add(AnsiUpperCase(lListPredictions.Items[I].GetValue<String>('description')));
    end;
  finally
    lRest.Free;
  end;
end;

I made a separate screen without map. query address using google api.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...