Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Ramsey pramsey

View GitHub Profile
View geos-overlay-sr-valgrind.txt
This file has been truncated, but you can view the full file.
==6519== Memcheck, a memory error detector
==6519== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6519== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==6519== Command: ./bin/test_xmltester /home/ec2-user/TestOverlay-stmlf.xml
==6519== Parent PID: 5704
==6519==
==6519==
==6519== HEAP SUMMARY:
==6519== in use at exit: 375,717,152 bytes in 2,849,152 blocks
View voronoi.sql
CREATE OR REPLACE
-- Tile generating function takes in tile coordinates
-- and parameters and returns a tile in a bytea return.
-- We take in a click point and a count of how many
-- hydrants to build our voronoi with.
FUNCTION public.hydrants_delaunay(
z integer, x integer, y integer,
lon float8 default -123.129,
lat float8 default 49.253,
@pramsey
pramsey / early.txt
Last active Jan 21, 2020
FOSS4G 2020 Early Acceptance Letter
View early.txt
Subject: FOSS4G 2020 Early Paper Deadline is Feb 4!
FOSS4G 2020 will be in Calgary, Canada this year, from August 24-29.
It seems so far away, and yet, the first submission deadline is almost here...
https://2020.foss4g.org/early-acceptance/
If you submit your talk to the Call for Papers before February 4,
you will be eligible for Early Acceptance!
@pramsey
pramsey / vsicurl_ogr_fdw.sql
Last active Nov 25, 2019
OGR FDW against remote static files
View vsicurl_ogr_fdw.sql
--
-- Not only does this FDW definition read a remote file over HTTP and provide
-- a tabular view of the data, it also does so even though the file
-- is encased in a ZIP file!
-- See https://gdal.org/user/virtual_file_systems.html for more magic.
--
CREATE EXTENSION postgis;
CREATE EXTENSION ogr_fdw;
CREATE SERVER myserver
@pramsey
pramsey / remote-regress.sh
Created Jul 22, 2019
PostGIS Remote Regress
View remote-regress.sh
VER=2.4
svn co https://svn.osgeo.org/postgis/branches/${VER}/ postgis-${VER}-svn
cd postgis-${VER}-svn
touch loader/shp2pgsql loader/pgsql2shp
chmod 755 loader/shp2pgsql loader/pgsql2shp
touch raster/loader/raster2pgsql
chmod 755 raster/loader/raster2pgsql
cd regress
@pramsey
pramsey / streets.sql
Last active May 31, 2019
Streets Data
View streets.sql
-- shp2pgsql -s 26918 -D -I -i nyc_streets | psql streets
-- Generate gaussian offset random points from input roads
-- add more roads in the 'gid' list as desired
DROP TABLE IF EXISTS pts;
CREATE TABLE pts AS
WITH s AS (
SELECT
gid,
nextval('nyc_streets_gid_seq') AS a,
@pramsey
pramsey / addressnormsearch.md
Created May 2, 2019
Quick and Dirty Address Matching with LibPostal
View addressnormsearch.md

Quick and Dirty Address Matching with LibPostal

Most businesses have databases of previous customers, and data analysts will frequently be asked to join arbitrary data to the customer tables in order to provide analysis.

Unfortunately joining address data together is notoriously difficult:

  • The same address can be expressed in many ways
  • The parts of addresses are not always clear
  • There are valid lexically very similar addresses very nearby any given address
View 3005.txt
-- Resolving 3005 via Proj4
postgis=# select st_astext(st_transform('SRID=4326;POINT(-125 45)',3005));
st_astext
------------------------------------------
POINT(1079515.82040926 561.626612238131)
(1 row)
-- Also resolving 3005 via Proj4!!!!
postgis=# select st_astext(st_transform('SRID=4326;POINT(-125 45)','EPSG:3005'));
st_astext
View proj.c
#include <stdio.h>
#include <strings.h>
#include <stdlib.h>
#include <math.h>
#include <regex.h>
#include "/usr/local/include/proj.h"
static void print_coord(PJ_COORD *c)
{
printf("COORD %g %g\n", c->xyzt.x, c->xyzt.y);
You can’t perform that action at this time.