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

249
Vistas
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 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