Skip to content

Instantly share code, notes, and snippets.

View esgn's full-sized avatar
🐬
seapunk

Emmanuel S. esgn

🐬
seapunk
  • France
  • 08:21 (UTC +02:00)
View GitHub Profile
@esgn
esgn / generate_pdal_pipeline.py
Created November 15, 2024 08:44
Generate PDAL pipeline to download from LIDAR HD COPC coverage
import sys
import argparse
import geopandas as gpd
import pandas as pd
import json
def parse_args():
parser = argparse.ArgumentParser(
"Create JSON PDAL pipelines to download point cloud extract")
parser.add_argument("--input_footprints", "-i",
@esgn
esgn / github-actions-push-gcr.md
Last active June 26, 2024 14:15
How to push a Docker image to Google Artifact Registry with a GitHub Action without using a Service Account

How to push a Docker image to Google Artifact Registry with a GitHub Action without using a Service Account

This how I managed to push a Docker image in a Google Cloud Artifact Registry using a GitHub Actions workflow without using a GCP Service Account.

Before using this tutorial make sure you have :

  • A GitHub repository containing a Dockerfile
  • A GCP project with sufficient permissions to make changes to it
  • The gcloud tool installed, authenticated and configured to use the GCP project. We will not use the --project flag in the following gcloud commands.

Create an Artifact Registry of Docker type

@esgn
esgn / main.tf
Created June 24, 2024 07:58
GCP Terraform : Cloud Scheduler + Batch Job
resource "google_storage_bucket" "osm_dl_planet" {
project = var.project-id
name = var.bucket-name
uniform_bucket_level_access = true
location = var.project-region
storage_class = "REGIONAL"
force_destroy = true
}
resource "google_service_account" "scheduler" {
#!/usr/bin/env bash
# Working area in EPSG:2154
xmin=892000
ymin=6249000
xmax=894000
ymax=6247000
rm -rf footprints
mkdir footprints
@esgn
esgn / merge_las_files.py
Last active February 6, 2023 15:02
Merge las files using laspy (basic example)
#!/usr/bin/env python3
import os
import laspy
import shutil
file_ext = ".las"
output_file = "output.las"
if os.path.exists(output_file):
@esgn
esgn / dl_from_wfs.py
Last active October 29, 2024 13:13
Download GPKG from WFS example
import sys
try:
from osgeo import ogr, osr, gdal
except:
sys.exit('ERROR: cannot find GDAL/OGR modules')
# create the spatial reference
srs = osr.SpatialReference()
srs.ImportFromEPSG(2154)
@esgn
esgn / extraction-lidarhd-copc.md
Last active July 31, 2026 14:43
Extraire une zone du LiDAR HD à distance avec PDAL et PDAL Wrench

Extraire une zone du LiDAR HD à distance avec PDAL et PDAL Wrench

À partir d’une emprise exprimée en Lambert-93, ce tutoriel montre comment extraire depuis la Géoplateforme uniquement les points LiDAR HD nécessaires, même lorsque la zone couvre plusieurs dalles ou plusieurs blocs, sans télécharger intégralement les fichiers COPC sources en local.

Trouver les dalles LiDAR HD concernées sur la zone

Passage par un VPC (Virtual Point Cloud)

Le service de téléchargement de la Géoplateforme propose des fichiers VPC pour chaque bloc de LiDAR HD. Exemple : https://data.geopf.fr/chunk/telechargement/download/LiDARHD-NUALID/NUALHD_1-0__LAZ_LAMB93_PQ_2025-03-14/index.vpc

@esgn
esgn / psr-ransac-fix.cpp
Created November 29, 2022 15:25
psr-ransac-fix.cpp
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/IO/read_points.h>
#include <CGAL/property_map.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
#include <CGAL/Polygonal_surface_reconstruction.h>
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
#include <CGAL/Polygon_mesh_processing/orientation.h>
#include <CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h>
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
@esgn
esgn / psr-ransac-no-fix.cpp
Last active November 29, 2022 15:26
psr-ransac-no-fix.cpp
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/IO/read_points.h>
#include <CGAL/property_map.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
#include <CGAL/Polygonal_surface_reconstruction.h>
#ifdef CGAL_USE_SCIP // defined (or not) by CMake scripts, do not define by hand
@esgn
esgn / gist.md
Created December 23, 2021 09:55
Handle multiple git identities using .gitconfig files

How to use .gitconfig files to handle multiple identities / git providers (github, gitlab, ...)

In the user home, define a parent .gitconfig file for your main account (eg: work account)

[user]
        name = John Doe
        email = john.doe@work.com
[credential]
        helper = store --file /home/johndoe/.git-credentials