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

115
Vistas
Javascript- How to check if a cord is inside a polygon

I created a polygon şn google maps which coords are

const osevioServingArea = [
    { lat: 41.0064636, lng: 29.0139668 },
    { lat: 41.0057511, lng: 29.0148251 },
    { lat: 40.8916216, lng: 29.1868298 },
    { lat: 40.9989817, lng: 29.2390148 },
    { lat: 41.0375782, lng: 29.0725033 },
    { lat: 41.0064636, lng: 29.0139668 },
];

And I took an point input and check the point if it is inside the polygon.

var lat = response.data.results[0].geometry.location.lat;
var lng = response.data.results[0].geometry.location.lng;
        if(lat>= 40.8916216 && lat<= 41.0375782 && lng<=29.2390148 && lng>=29.0139668){
            isInside= true;
        }

But I think it is wrong because the polygon has not a clear shape. Therefore the point can be smaller than the biggest lat and smaller than the biggest leg but does not locate inside the polygon.(sorry but I can't add an image) How do I check the given point is inside the polygon?

about 4 years ago · Juan Pablo Isaza
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