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

323
Views
Compruebe si una latitud y longitud está dentro de un círculo de Google Maps en JS

¿Cómo puedo encontrar si el lat y el lng dados están dentro de un área circular particular en los mapas de Google?

El siguiente código es para crear un área circular en lat: 41.878, lng: -87.629 , con un radio de 500.

 const citymap = { chicago: { center: { lat: 41.878, lng: -87.629 }, population: 2714856, }, }; function initMap() { // Create the map. const map = new google.maps.Map(document.getElementById("map"), { zoom: 15, center: { lat: 41.878, lng: -87.629 }, mapTypeId: "terrain", }); // Construct the circle for each value in citymap. for (const city in citymap) { // Add the circle for this city to the map. const cityCircle = new google.maps.Circle({ strokeColor: "#FF0000", strokeOpacity: 0.8, strokeWeight: 2, fillColor: "#FF0000", fillOpacity: 0.35, map, center: citymap[city].center, radius: 500, }); } }

Ahora que tengo una ubicación de usuario, ¿cómo puedo encontrar si el usuario está dentro del círculo o no?

 const userLocation = { lat: 51.878, lng: -77.629 } function isUserInsideCircle(userLocation){ // check user inside circle or not }

muestra de violín - https://jsfiddle.net/bmt4ruon/

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!