Skip to content

Instantly share code, notes, and snippets.

@leighghunt
Created July 22, 2019 09:58
Show Gist options
  • Save leighghunt/b9166da9a3621dbce66952ae74746304 to your computer and use it in GitHub Desktop.
Save leighghunt/b9166da9a3621dbce66952ae74746304 to your computer and use it in GitHub Desktop.
postgres/postgis on AWS cheatsheet
select current_user;
CREATE EXTENSION postgis
CREATE EXTENSION fuzzystrmatch
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION postgis_topology;
  • Add data in QGIS
  • Test SQL:
CREATE TABLE geometries (name varchar, geom geometry);

INSERT INTO geometries VALUES
  ('Point', 'POINT(0 0)'),
  ('Linestring', 'LINESTRING(0 0, 1 1, 2 1, 2 2)'),
  ('Polygon', 'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'),
  ('PolygonWithHole', 'POLYGON((0 0, 10 0, 10 10, 0 10, 0 0),(1 1, 1 2, 2 2, 2 1, 1 1))'),
  ('Collection', 'GEOMETRYCOLLECTION(POINT(2 0),POLYGON((0 0, 1 0, 1 1, 0 1, 0 0)))');

SELECT name, ST_AsText(geom) FROM geometries;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment