Skip to content

Instantly share code, notes, and snippets.

@orm011
Created September 19, 2018 21:55
Show Gist options
  • Save orm011/62ecff81ffb198e05ddaf10592170991 to your computer and use it in GitHub Desktop.
Save orm011/62ecff81ffb198e05ddaf10592170991 to your computer and use it in GitHub Desktop.
postgis handy
osm=# select postgis_full_version();
postgis_full_version
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
POSTGIS="2.2.1 r14555" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.3, released 2015/09/16" LIBXML="2.9.3" LIBJSON="0.11.99" RASTER
(1 row)
-- the 10 is for decimal points, the 2 is for adding the SRID to the result.
osm=# select ST_AsGeoJSON(geometry, 10, 2) from import.osm_roads where osm_id = 8616015;
-- the 4326 stands for 'SRID:4326'
osm=# select ST_Transform(geometry, 4326) from import.osm_roads where osm_id = 8616015;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment