Skip to content

Instantly share code, notes, and snippets.

@smithdc1
smithdc1 / Example.sql
Created July 3, 2025 06:09
PostGIS and GEOS 3.13
-- Enable PostGIS extension
CREATE EXTENSION IF NOT EXISTS postgis;
-- Create City table with PostGIS geometry column
CREATE TABLE City (
ID SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
point GEOMETRY(POINT, 4326)
);
sqlite> .load /usr/local/lib/mod_spatialite.so
sqlite> CREATE TABLE test_geometries (
id INTEGER PRIMARY KEY,
name TEXT,
geom GEOMETRY
);
sqlite> INSERT INTO test_geometries (id, name, geom) VALUES
(1, 'Valid Point', GeomFromText('POINT(1 1)', 4326)),
(2, 'Valid Polygon', GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))', 4326)),
(3, 'Empty Point', GeomFromText('POINT EMPTY', 4326)),