Skip to content

Instantly share code, notes, and snippets.

View hugoledoux's full-sized avatar

Hugo Ledoux hugoledoux

View GitHub Profile
import startinpy
import laspy
import numpy as np
import sys
np.set_printoptions(precision=3, suppress=True)
las = laspy.read('/Users/hugo/teaching/hw04-marking/data/area_full.laz')
print(las)
pts = np.vstack((las.x, las.y, las.z)).transpose()
@hugoledoux
hugoledoux / laspy_create.py
Created January 26, 2024 10:00
laspy create file + matplotlib
import laspy
import numpy as np
import sys
np.set_printoptions(precision=2, suppress=True)
# 0. Creating some dummy data
my_data_xx, my_data_yy = (np.random.random_sample(size=1000) * 100, np.random.random_sample(size=1000) * 100)
# print(my_data_xx)
my_data_zz = np.random.random_sample(size=1000) * 2
my_data = np.hstack((my_data_xx.reshape((-1, 1)), my_data_yy.reshape((-1, 1)), my_data_zz.reshape((-1, 1))))
@hugoledoux
hugoledoux / laspy_filter1.py
Last active January 25, 2024 13:25
laspy filter
import laspy
import numpy as np
import sys
las = laspy.read('/Users/hugo/teaching/hw04-marking/data/area_full.laz')
#-- fetch all points within 100m of the median xyz of the file
coords = np.vstack((las.x, las.y, las.z)).transpose()
median = np.median(coords, axis=0)
{
"type": "CityJSONExtension",
"name": "WeixiaoBuilding",
"description": "Extension to model the building parts",
"url": "https://someurl.org/noise.ext.json",
"version": "0.1",
"versionCityJSON": "2.0",
"extraAttributes": {},
"extraCityObjects": {},
"extraRootProperties": {},
@hugoledoux
hugoledoux / fetch.py
Last active October 13, 2023 11:46
3dbag api fetch
import urllib.request
import json
import sys
# myurl = "http://localhost:3200//collections/pand/items/NL.IMBAG.Pand.1655100000500568"
myurl = "http://localhost:3200//collections/pand/items?bbox=75900.011,447000.034,76000.011,447200.034"
# myurl = "http://localhost:3200//collections/pand/items?bbox=75877.011,446130.034,92446.593,460259.369"
try:
@hugoledoux
hugoledoux / torus.city.json
Created May 11, 2023 09:27
a cube with a genus of 1
{
"CityObjects":
{
"id-1":
{
"geometry":
[
{
"type": "Solid",
"lod": "1",
@hugoledoux
hugoledoux / test.txt
Last active April 26, 2023 09:47
testing 1 2 testing
allo les amis
ça va?
oh oh
@hugoledoux
hugoledoux / sqlal2.py
Last active April 27, 2023 09:21
read from cjdb tests
import sys
import json
import copy
import psycopg2
def remove_duplicate_vertices(j):
def update_geom_indices(a, newids):
for i, each in enumerate(a):
if isinstance(each, list):
@hugoledoux
hugoledoux / vis.py
Created December 13, 2022 15:35
polyscope: LAZ + OBJ example
import numpy as np
import polyscope as ps
import laspy
import point_cloud_utils as pcu
with laspy.open('m1-off-ground.laz') as fh:
las = fh.read()
#-- get the coordinates as numpy array nx3
@hugoledoux
hugoledoux / wordle.py
Last active March 24, 2024 10:38
wordle
import json
import sys
from datetime import datetime
import numpy as np
fin = open("/Users/hugo/temp/result.json")
j = json.loads(fin.read())