Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
GoogleMaps obtiene la ubicación central de la vista actual

Estoy usando google maps js en mi proyecto. PRoject muestra ubicaciones por marcador en googlemaps. Puedo agregar un marcador con algún botón, pero el marcador necesita valores de latitud y longitud, así que pongo las locations[0].lat,locations[0].lon, pero no es fácil de usar.

Entonces, lo que quiero hacer es hacer un marcador estático en el centro del mapa, cuando el usuario deslice el mapa, permanecerá en el medio cuando el usuario se desplace por el mapa, luego haga clic en el botón Agregar ubicación y luego agregue.

También se puede hacer con agregar marcador en el centro de vista actual

El código de ubicación agregado actual, el mapa y el título son globales, el índice proviene de document.ready bucle foreach

 function addLocation(){ var myLatlng = new google.maps.LatLng(allMarkers[0].position.lat()+0.20, allMarkers[0].position.lng()+0.20); var marker = new google.maps.Marker({ position: latlng, map: map, title: title, draggable: true, index:index }); marker.addListener('dragend', handleEvent); marker.addListener("click", () => { allMarkers[index].isDeleted='1'; allMarkers[index].setMap(null); }); allMarkers.push(marker); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!