Skip to content

Instantly share code, notes, and snippets.

View WindfallLabs's full-sized avatar

Garin Wally WindfallLabs

View GitHub Profile
@WindfallLabs
WindfallLabs / gdb_schema_yaml.py
Last active November 25, 2015 00:07
Creates a .yaml file 'psuedo-schema' from a folder directory (including ESRI gdb's)
# -*- coding: utf-8 -*-
"""distribution_yaml.py: Converts Paths and GBDs to dicts, then to a yaml file.
This script 'walks' through a folder structure (including ESRI Geodatabases)
and outputs a .yaml pseudo-schema of the directory-tree and geodatabase(s).
MIT License (MIT)
Copyright (C) 2015 Garin Wally / Windfall Spatial
This code was modified from code by Blake Miller, found here:
@WindfallLabs
WindfallLabs / hellfire.py
Last active November 20, 2015 22:01
This script serves as a double-click DLL dependency-diagnostics utility.
# -*- coding: utf-8 -*-
"""
hellfire.py
This script serves as a double-click DLL dependency-diagnostics utility.
Usage:
1. Place this script in a folder containing one or many DLL(s) to test
2. Double-click this script
3. Read the Windows error-popup
@WindfallLabs
WindfallLabs / read_spatialite_patch.py
Last active November 10, 2015 23:59
A proposed edition to geopandas.io for reading SpatiaLite data via wkt
"""Addition to geopandas.io.sql.py
by Garin Wally / Windfall Spatial, Nov 10, 2015
"""
# Place with the other imports
import shapely.wkt
def read_spatialite(sql, con, geom_col, crs=None, index_col=None,
coerce_float=True, params=None):
"""
@WindfallLabs
WindfallLabs / test_load_dll.py
Created November 5, 2015 22:00
A short gist derrived from dlsw on how to test if a DLL is on your PATH
# A short gist derrived from dlsw on how to test if a DLL is on your PATH. (Best with try/except blocks)
import os
from ctypes import WinDLL
from _ctypes import FreeLibrary # DON'T FORGET THE '_'
dll = "mod_spatialite.dll" # or whatever DLL your heart desires
assert not dll in os.listdir(os.getcwd()) # Ensures that the DLL will not false-positive load because it's in the current working dir
loaded_dll = WinDLL(dll) # Attempt to load DLL. If the DLL is not on PATH or in os.getcwd() it will raise a WindowsError
FreeLibrary(loaded_dll._handle) # if successful, we should be good neigbors and unload it
del loaded_dll # completely rid of the memory instance