Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created October 26, 2012 21:55
Show Gist options
  • Select an option

  • Save andrewxhill/3961805 to your computer and use it in GitHub Desktop.

Select an option

Save andrewxhill/3961805 to your computer and use it in GitHub Desktop.
parenthesis enclosed NYC open data lat/lon to the_geom
--replace table_1 with your table name
--replace both instances of column_name with your column, often it is called 'shape'
UPDATE
table_1
SET
the_geom = ST_SetSRID(
ST_MakePoint(
(string_to_array(
replace(
replace(column_name,'(',''),
')',''
),
','
))[2]::float,
(string_to_array(replace(replace(column_name,'(',''),')',''),','))[1]::float),4326)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment