Skip to content

Instantly share code, notes, and snippets.

from urllib.request import urlretrieve
import rasterio
import pyproj
from shapely.geometry import box
from shapely.ops import transform
from shapely.geometry import shape, GeometryCollection
import sys
import os
import json
import tarfile
@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
@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 / 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 / poc-flux-lidar-copc.md
Last active December 20, 2023 13:59
Extraction depuis le S3 LIDAR HD

Extraction depuis le S3 LIDAR HD

Question pratique: Comment extraire un morceau de LIDAR HD depuis ces dalles COPC avec PDAL ?

Extraction sur une emprise incluse dans une seule dalle

On streame la donnée pour n'en récupérer qu'un morceau sur une emprise (bounds)

[
@esgn
esgn / dl_from_wfs.py
Created December 29, 2022 13:20
Download GPKG from WFS example
import sys
try:
from osgeo import ogr, osr, gdal
except:
sys.exit('ERROR: cannot find GDAL/OGR modules')
# Set the driver (optional)
wfs_drv = ogr.GetDriverByName('WFS')
@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):
#!/usr/bin/env bash
# Working area in EPSG:2154
xmin=892000
ymin=6249000
xmax=894000
ymax=6247000
rm -rf footprints
mkdir footprints