Skip to content

Instantly share code, notes, and snippets.

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)),
@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)
);
@smithdc1
smithdc1 / gist:86ff4bb4ef27dd975a93d3105d0bebdd
Created June 22, 2025 19:39
django postgis 3.5 and geos 3.13 failure
python : Creating test database for alias 'default'...
At line:1 char:1
+ python .\runtests.py gis_tests.geoapp.tests.GeoLookupTest.test_relate ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Creating test d...as 'default'...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
E
======================================================================
@smithdc1
smithdc1 / gist:00c8464c2d162b214520680fd5cee037
Created June 7, 2025 13:34
Benchmark for tokenizing a Django Template.
import timeit
crispy = """{% load crispy_forms_field %}
{% if field.is_hidden %}
{{ field }}
{% else %}
{% if field|is_checkbox and tag != "td" %}
<div class="mb-3{% if 'form-horizontal' in form_class %} row{% endif %}">
{% if label_class %}
@smithdc1
smithdc1 / django_sphinx_inventory.md
Created April 4, 2025 09:24
Django Sphinx Inventory
Location Name Type Reference
@smithdc1
smithdc1 / django_sphinx_inventory.md
Created April 4, 2025 09:24
Django Sphinx Inventory
Location Name Type Reference
@smithdc1
smithdc1 / django_sphinx_inventory.md
Created April 4, 2025 09:24
Django Sphinx Inventory
Location Name Type Reference
'PCIDSK'
'netCDF'
'PDS4'
'VICAR'
'JP2OpenJPEG'
'PDF'
'MBTiles'
'EEDA'
'OGCAPI'
'ESRI Shapefile'
@smithdc1
smithdc1 / gist:602ed0eec628746de54f98b67b533f74
Last active February 24, 2022 08:07
Django tests 24th Feb
(django) PS C:\Users\smith\PycharmProjects\django\tests> python .\runtests.py --shuffle
Testing against Django installed in 'c:\users\smith\pycharmprojects\django\django' with up to 8 processes
Using shuffle seed: 2714725009 (generated)
Found 15614 test(s).
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
======================================================================
ERROR: test_bulk_update (postgres_tests.test_bulk_update.BulkSaveTests) [<object object at 0x000002D559D6DFE0>] (model=<class 'postgres_tests.models.HStoreModel'>, field='field')
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\users\smith\pycharmprojects\django\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: can't adapt type 'dict'
The above exception was the direct cause of the following exception: