Last active
October 12, 2015 03:18
-
-
Save auremoser/3963197 to your computer and use it in GitHub Desktop.
SQL tipsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET GEOM FOR NYC | |
================ | |
UPDATE name_of_db SET the_geom = ST_Transform(ST_SetSRID(ST_MakePoint(x_coordinate, y_coordinate),2263),4326) | |
//Order of Operations nested commands | |
//ST_MakePoint(x,y) turns any x, y value into a geometry. | |
(If this was latitude and longitude, that is the same as saying ST_MakePoint(longitude, latitude); backwards (x,y)->(long,lat) | |
//ST_SetSRID(our_new_geom, 2263) | |
//wrap in ST_Transform to 4326 - standard projection for geom column always - lat/long | |
CHANGE PROJECTION | |
================= | |
SELECT ST_Transform(the_geom_webmercator,26935) AS the_geom_webmercator FROM table_name | |
SEE ALL PROJECTIONS | |
=================== | |
SELECT * FROM spatial_ref_sys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment