Skip to content

Instantly share code, notes, and snippets.

@andy-esch
Last active August 29, 2015 14:10
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 andy-esch/bbc3de7c832f739ff295 to your computer and use it in GitHub Desktop.
Save andy-esch/bbc3de7c832f739ff295 to your computer and use it in GitHub Desktop.
Great Circle Arcs

First you need to paste this into the SQL text editor:

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 953027, 'esri', 53027, '+proj=eqdc +lat_0=0 +lon_0=0 +lat_1=60 +lat_2=60 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs ', 'PROJCS["Sphere_Equidistant_Conic",GEOGCS["GCS_Sphere",DATUM["Not_specified_based_on_Authalic_Sphere",SPHEROID["Sphere",6371000,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Equidistant_Conic"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Standard_Parallel_1",60],PARAMETER["Standard_Parallel_2",60],PARAMETER["Latitude_Of_Origin",0],UNIT["Meter",1],AUTHORITY["EPSG","53027"]]');

Just delete everything in there (SELECT * FROM table_name), and replace it with what's above. It tells the PostGIS to do something that projects your lines into the different projection. This allows you to do this in your account from now on. When you hit Apply Query, it should just run without error and clear the text editor.

Next, I would do an "Export Data" so you have a backup copy if something goes awry.

Next, run the following query to reproject the lines to the new geometry. Be sure to change table_name to your table's name.

Here's the SQL

UPDATE table_name
SET the_geom =
   ST_Transform(
     ST_Segmentize(
         ST_Transform(the_geom, 953027),
         100000
    ), 
    4326 
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment