Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

93
Visualizações
Highlight an existing business on Google Maps API

I have a list of store addresses, and I'm trying to create a map out of it. Using the Places API I am able to retrieve most of the informations and manually create and place the markers on the map:

const service = new google.maps.places.PlacesService(map);
service.findPlaceFromQuery({
  query: '212 Enterprise Dr, Rockaway, Frank Pizza',
  fields: ['all']
}, onPlaceFound);

However I'd like to select the original marker instead of overlapping a new one.

That is because I want the user to be able to open the default info window with store phone number, directions and stuff.

I know that I can re-create it, but it feels kinda lame since all the info is already there.

Original GM Marker Custom Marker

This SO post ask about the same, yet no solution has been found.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Based on the documentation found here, which shows findPlaceFromQuery(), the second parameter of findPlaceFromQuery should be a function where the first argument of that function is an Array of placeResults.

Therefore, after reviewing a link here and here your onPlaceFound function should be looking something like:

function onPlaceFound(placeResultsArray){
  const firstResult = placeResultsArray[0], firstIconURL = firstResult.icon;
  const latLng = firstResult.geometry.location, lat = latLng.lat(), lng = latLng.lng();
  // do stuff with those variables here
}
  

Of course, that does not select Google's result as a Marker, but now you have the actual icon, and latitude and longitude.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda