Skip to content

Instantly share code, notes, and snippets.

View vojtatom's full-sized avatar

Vojta Tomas vojtatom

View GitHub Profile
@vojtatom
vojtatom / app.py
Created September 29, 2025 14:29 — forked from Maxxen/app.py
DuckDB Vector Tile Serve w/ Flask + MapLibre
import duckdb
import flask
# Initialize Flask app
app = flask.Flask(__name__)
# Setup a global DuckDB connection with spatial extension loaded
# Connect to a persistent database file with the geometry data
config = {"allow_unsigned_extensions": "true"}
con = duckdb.connect("tiles.db", True, config)
@vojtatom
vojtatom / geoparquet.cpp
Created September 29, 2025 13:46 — forked from jpswinski/geoparquet.cpp
Minimal example C++ code to write a GeoParquet file using Apache Arrow
/*
* File: geoparquet.cpp
*
* Purpose: A minimal example to build a GeoParquet file using Apache Arrow.
*
* Prerequisites: The Apache Arrow library is needed and can be installed as follows
* $ git clone https://github.com/apache/arrow.git
* $ cd arrow/cpp
* $ mkdir build
* $ cd build
x y z vx vy vz
0.10 0.10 0.50 0.20 1.99 0.50
0.10 0.10 -0.58 0.20 1.99 -0.58
0.10 0.10 -1.66 0.20 1.99 -1.66
60.00 60.00 -17.84 -0.61 -1.90 -17.84
60.00 60.00 -18.92 -0.61 -1.90 -18.92
60.00 60.00 -20.00 -0.61 -1.90 -20.00
// Möller-Trumbore algorithm
// Find intersection point - from PBRT - www.pbrt.org
float intersect(Ray & ray, bool cullback, float & b1, float & b2)
{
vec3 e1(b - a), e2(c - a);
vec3 pvec = cross(ray.dir, e2);
float det = dot(e1, pvec);
if (cullback)
{
@vojtatom
vojtatom / sage2app.js
Last active March 7, 2019 19:00
SAGE2 animation sync
// SAGE2 is available for use under the SAGE2 Software License
//
// University of Illinois at Chicago's Electronic Visualization Laboratory (EVL)
// and University of Hawai'i at Manoa's Laboratory for Advanced Visualization and
// Applications (LAVA)
//
// See full text, terms and conditions in the LICENSE.txt included file
//
// Copyright (c) 2014