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

105
Visualizações
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 à 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