Skip to content

Instantly share code, notes, and snippets.

@dsandip
Last active January 30, 2019 07:02
Show Gist options
  • Save dsandip/885f6fac9f86667d7b81e9193817189c to your computer and use it in GitHub Desktop.
Save dsandip/885f6fac9f86667d7b81e9193817189c to your computer and use it in GitHub Desktop.
Custom functions: sample location tables
-- Create PostGIS extensions if they don't exist
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
-- User location data
CREATE TABLE user_location (
user_id INTEGER PRIMARY KEY,
location GEOGRAPHY(Point)
);
-- Landmark location data
CREATE TABLE landmark (
id SERIAL PRIMARY KEY,
name TEXT,
type TEXT,
location GEOGRAPHY(Point)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment