Skip to content

Instantly share code, notes, and snippets.

View balazsdukai's full-sized avatar

Balázs Dukai balazsdukai

View GitHub Profile
# Returns the size of object in bytes
from sys import getsizeof
CityJSON = {
"appearance": {
"materials": [
{
"name": "door",
"ambientIntensity": 0.2000,
"diffuseColor": [0.9000, 0.1000, 0.7500],
@balazsdukai
balazsdukai / cityjson_address.json
Last active October 18, 2021 08:57
A proposal for storing addresses in CityJSON
{
"type": "CityJSON",
"version": "1.0",
"CityObjects": {
"NL.IMBAG.Pand.0518100000285075": {
"type": "Building",
"geometry": [],
"address": [
{
"openbareRuimteNaam": "C.A. van Beverenplein",
import requests
import pathlib
import gzip
import json
from cjio import cityjson
datadir = pathlib.Path(__file__).parent.absolute()
tile = "5908"
url = f"https://data.3dbag.nl/cityjson/v21031_7425c21b/3dbag_v21031_7425c21b_{tile}.json.gz"
@balazsdukai
balazsdukai / subset_las.sh
Last active May 30, 2018 12:49
Subset a LAS/LAZ by a set of polygons
#! /bin/bash
# Crop a LAS file by multiple polygons. Implemented for lastools.
# example:
# subset_las.sh <path to LAS file> <path to polygons directory>
LAS_IN=$1
DIR=$2
for f in $(dir $DIR)
@balazsdukai
balazsdukai / objsplit.py
Last active February 9, 2024 14:22
Split an OBJ file into separate files per named object
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Split an OBJ file into separate files per named object
Ignores vertex texture coordinates, polygon groups, parameter space vertices.
The individual files are named as the object they contain. The material file
(.mtl) is not split with the objects.
Run:
@balazsdukai
balazsdukai / genbind_citygml2
Created February 20, 2017 10:55
PyXB binding generator for CityGM2.0
# Attempt to prevent catastrophe by validating required settings
# and aborting on any subshell error
set -e
if [ -z "${PYXB_ROOT+notset}" ] ; then
echo 1>&2 ERROR: PYXB_ROOT not set
exit 1
fi
BUNDLE_TAG=opengis