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

244
Visualizações
How can I convert longitude and latitude to a country name?

After printing the long and the lat, I want it to print out the country name. Is there a way of using the long and lat to figure out the country and then print that out to the console at the end?

  const puppeteer = require("puppeteer"); 
  const url = "https://www.google.com/";
  

  async function StartScraping() {
    await puppeteer
      .launch({
        headless: false,
      })
      .then(async (browser) => {
        const page = await browser.newPage();
  
        await page.setViewport({
          width: 1800,
          height: 800,
        });
  
        page.on("response", async (response) => {
  
         
          if (response.url().includes("CoordinateFile")) 
          {
            const location = await response.text() 
            let intlong = location.indexOf("Coordinates:")
            const longlat = location.substring(intlong +12, intlong + 44)
            //split long lat here 
            
            var long = longlat.substring(0, longlat.indexOf(',') - 5);
            var lat = longlat.substring(longlat.indexOf(',') +1, (longlat.indexOf(',') + 7));
            console.log(`Longitude: ${long}`);
            console.log(`Latitude: ${lat}`);
           

          }
  
        });
  
        await page.goto(url, {
          waitUntil: "load",
          timeout: 0,
        });
      });
  }

  StartScraping();
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