Make screen from Geoportail site, hiding help
✓ Published0🌍 Public
TThomasG77
Last edited Sep 12, 2021
Created on Sep 12, 2021
This example captures a screenshot of a Geoportail map page after programmatically hiding its help layer. It uses Puppeteer, a Node.js library controlling headless Chrome, to navigate to the provided URL. The script waits for the map to fully load with `waitUntil: 'networkidle0'`, then locates and clicks the `#help-layer` element to dismiss it before saving the view as a PNG. A Python version uses the ported Pyppeteer library with identical logic.
AI-generated descriptionMake screen from Geoportail site, hiding help
Node version
Prerequisites
Get Node.js with associated npm
Install
npm i
Run
# Default to file example.png
node screenshot-geoportail.js your_geoportail_url
or
node screenshot-geoportail.js your_geoportail_url filename.png
Real example in action
node screenshot-geoportail.js 'https://www.geoportail.gouv.fr/carte?c=-1.55364,47.218383000000046&z=11&l0=ORTHOIMAGERY.ORTHOPHOTOS::GEOPORTAIL:OGC:WMTS(1)&permalink=yes' out.png
Python version
Prerequisites
Get Python 3.6+ and associated pip
Install
python -m pip install pyppeteer
Run
# Default to file example.png
python screenshot-geoportail.py your_geoportail_url
or
python screenshot-geoportail.py your_geoportail_url filename.png
Real example in action
python screenshot-geoportail.py 'https://www.geoportail.gouv.fr/carte?c=-1.55364,47.218383000000046&z=11&l0=ORTHOIMAGERY.ORTHOPHOTOS::GEOPORTAIL:OGC:WMTS(1)&permalink=yes' out.png
ISC Licensed