Skip to content

Instantly share code, notes, and snippets.

@rustprooflabs
Last active May 18, 2021 17:32
Show Gist options
  • Select an option

  • Save rustprooflabs/a86e3ff5c829b0fa32ebbd5702883ebe to your computer and use it in GitHub Desktop.

Select an option

Save rustprooflabs/a86e3ff5c829b0fa32ebbd5702883ebe to your computer and use it in GitHub Desktop.

Revisions

  1. rustprooflabs revised this gist May 10, 2020. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions srid_units.sql
    Original file line number Diff line number Diff line change
    @@ -5,10 +5,12 @@ SELECT srid, CASE WHEN proj4text LIKE '%+units=%' THEN True
    CASE WHEN proj4text LIKE '%+units=m%' THEN 'Meters'
    WHEN proj4text LIKE '%+units=ft%' THEN 'Feet'
    WHEN proj4text LIKE '%+units=us-ft%' THEN 'Feet'
    WHEN proj4text LIKE '%+units=link%' THEN 'Link (Dunno)'
    WHEN proj4text LIKE '%+units=%' THEN 'Set, not caught properly'
    WHEN proj4text LIKE '%+units=link%'
    OR proj4text LIKE '%+units=%'
    THEN 'Set, not caught properly'
    ELSE 'Decimal Degrees'
    END AS units,
    proj4text, srtext
    FROM public.spatial_ref_sys
    ;
    COMMENT ON VIEW public.srid_units IS 'PostGIS specific view to make it easier to find what units each SRID is in. From https://gist.github.com/rustprooflabs/a86e3ff5c829b0fa32ebbd5702883ebe';
  2. rustprooflabs revised this gist Jan 20, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions srid_units.sql
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@ SELECT srid, CASE WHEN proj4text LIKE '%+units=%' THEN True
    END AS units_set,
    CASE WHEN proj4text LIKE '%+units=m%' THEN 'Meters'
    WHEN proj4text LIKE '%+units=ft%' THEN 'Feet'
    WHEN proj4text LIKE '%+units=us-ft%' THEN 'Feet (US)'
    WHEN proj4text LIKE '%+units=us-ft%' THEN 'Feet'
    WHEN proj4text LIKE '%+units=link%' THEN 'Link (Dunno)'
    WHEN proj4text LIKE '%+units=%' THEN 'Set, not caught properly'
    ELSE 'Decimal Degrees'
    END AS units,
    proj4text
    proj4text, srtext
    FROM public.spatial_ref_sys
    ;
  3. rustprooflabs created this gist Jan 20, 2020.
    14 changes: 14 additions & 0 deletions srid_units.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    CREATE OR REPLACE VIEW public.srid_units AS
    SELECT srid, CASE WHEN proj4text LIKE '%+units=%' THEN True
    ELSE False
    END AS units_set,
    CASE WHEN proj4text LIKE '%+units=m%' THEN 'Meters'
    WHEN proj4text LIKE '%+units=ft%' THEN 'Feet'
    WHEN proj4text LIKE '%+units=us-ft%' THEN 'Feet (US)'
    WHEN proj4text LIKE '%+units=link%' THEN 'Link (Dunno)'
    WHEN proj4text LIKE '%+units=%' THEN 'Set, not caught properly'
    ELSE 'Decimal Degrees'
    END AS units,
    proj4text
    FROM public.spatial_ref_sys
    ;