Skip to content

Instantly share code, notes, and snippets.

View maxcollombin's full-sized avatar

Maxime Collombin maxcollombin

View GitHub Profile

Exercice guidé #1 - Création du modèle physique

Important

Lien vers la présentation.

L'intégralité des modèles présentés peuvent être téléchargés à partir de la ressource suivante : https://github.com/MediaComem/FGDM4GS/tree/main/WP2-WP3/model/Planungszonen_V1_1.

Sur la base des modèles créés, nous vous proposons maintenant un petit test avec ili2gpkg et GDAL afin d'analyer la portée de ce que nous venons de présenter.

Création du GPKG

@maxcollombin
maxcollombin / ili2c.sh
Last active January 30, 2025 05:44
Script for validating muliple INTERLIS .ili files in a directory.
# Truncate the ili2c.log file if it exists, otherwise create it
: > ili2c.log
# Validate each .ili file in the models directory
for file in models/*.ili; do
echo -e "Processing $file\n" >> ili2c.log
java -jar ili2c.jar "$file" >> ili2c.log 2>&1
echo "" >> ili2c.log
done
@maxcollombin
maxcollombin / json-kml.py
Created May 8, 2024 06:47
Convert JSON to KML
import json
import polyline
import simplekml
# Load the JSON file
with open('input.json') as f:
data = json.load(f)
# Create a KML object
kml = simplekml.Kml()
@maxcollombin
maxcollombin / checkzipurlcontent.py
Last active February 14, 2024 18:56
Script to check the content of a zip file from a URL.
# -*- coding: utf-8 -*-
"""
checkzipurlcontent.py
Script to check the content of a zip file from a URL.
Author: [Maxime Collombin]
Date: [14/02/2023]
"""
import requests
import zipfile
@maxcollombin
maxcollombin / TableAttributes.sql
Created February 10, 2024 08:42
PostgreSQL script to retrieve table attributes in schema
SELECT
table_name,
column_name,
is_nullable,
data_type,
character_maximum_length
FROM
information_schema.columns
WHERE
table_schema = 'siges'
@maxcollombin
maxcollombin / relations-list.sql
Last active February 10, 2024 08:19
PostgreSQL script to list relations between tables
SELECT
tc.constraint_name AS constraint_name,
tc.table_name AS table_name,
kcu.column_name AS column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM
information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu
ON tc.constraint_name = kcu.constraint_name
@maxcollombin
maxcollombin / db-to-json-schema.py
Created January 5, 2024 12:25
Script to extract a json schema from a db
import psycopg2
import json
# Connect to the PostgreSQL database
conn = psycopg2.connect(
host="localhost",
database="test",
user="postgres",
password="postgres"
)
@maxcollombin
maxcollombin / test.sld
Last active September 21, 2023 12:37
svg test
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:se="http://www.opengis.net/se" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<se:Name>mf_ste_equipements_publics_poubelle</se:Name>
<UserStyle>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Poubelle</se:Name>
<se:MinScaleDenominator>3000.000000</se:MinScaleDenominator>
<se:MaxScaleDenominator>80000.000000</se:MaxScaleDenominator>
@maxcollombin
maxcollombin / wkt_bbox.sql
Created August 24, 2023 12:56
This script allows to convert a WKT geometry to a BBOX string with WIDTH and HEIGHT to be used in a WMS request.
-- WKT TO BBOX
-- This script allows to convert a WKT geometry to a BBOX string with WIDTH and HEIGHT to be used in a WMS request.
WITH input_geom AS (
SELECT ST_SetSRID('POLYGON((7.210196256637572 46.079631239023286,7.2218477725982675 46.07266495408345,7.22425103187561 46.07465966398232,7.212899923324584 46.08162569712192,7.210196256637572 46.079631239023286))'::geometry, 4326) AS geom
)
SELECT
'BBOX='||
ST_XMin(ST_Transform(geom, 2056)) ||','||
ST_YMin(ST_Transform(geom, 2056)) ||','||
ST_XMax(ST_Transform(geom, 2056)) ||','||