Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created January 7, 2012 18:38
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 andrewxhill/1575587 to your computer and use it in GitHub Desktop.
Save andrewxhill/1575587 to your computer and use it in GitHub Desktop.
Finding longest path between two geoms
WITH f as (SELECT
ST_LongestLine(ST_SetSRID(ST_MakePoint(-3,55),4326),ST_SetSRID(ST_Union(ST_MakePoint(-1,51),ST_MakePoint(-1,49)),4326)) as line)
SELECT ST_Distance_Sphere(ST_StartPoint(f.line),ST_EndPoint(f.line)) FROM f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment