Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

96
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda