Skip to content

Instantly share code, notes, and snippets.

@ykrkn
Last active November 1, 2016 13:31
Show Gist options
  • Save ykrkn/2b63d90c83947266b9344f86ccd715c2 to your computer and use it in GitHub Desktop.
Save ykrkn/2b63d90c83947266b9344f86ccd715c2 to your computer and use it in GitHub Desktop.
\copy (select '<location title="'||locations.title||'" lat="'||latitude||'" lng="'||longitude||'" />' from locations left join spatial on spatial.loc_id=locations.loc_id where latitude is not null and wkt is null union all select '<location title="'||locations.title||'" lat="'||latitude||'" lng="'||longitude||'" wkt="'||spatial.wkt||'" />' from locations left join spatial on spatial.loc_id=locations.loc_id where latitude is not null and wkt is not null) TO 'spatial.xml'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment