Skip to content

Instantly share code, notes, and snippets.

@statguy
Created August 9, 2018 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statguy/54d459c2a21d64dfaa9008434b744871 to your computer and use it in GitHub Desktop.
Save statguy/54d459c2a21d64dfaa9008434b744871 to your computer and use it in GitHub Desktop.
Inserting data to geometry column in PostGIS directly, enforcing SRID
DROP TABLE IF EXISTS temp;
CREATE TABLE temp (
id INT,
geom GEOMETRY(POINT, 4326)
);
-- \d temp
INSERT INTO temp VALUES (1, 'SRID=4326;0000000001C051C3DC37A3DB3C4048374D37C1376D');
INSERT INTO temp VALUES (2, 'SRID=4326;POINT(-71.060316 48.432044)');
SELECT id, ST_X(geom), ST_Y(geom), geom FROM temp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment