Skip to content

Instantly share code, notes, and snippets.

@briatte
Created March 19, 2019 08:17
Show Gist options
  • Save briatte/4c04f50746223a95393e16f119169839 to your computer and use it in GitHub Desktop.
Save briatte/4c04f50746223a95393e16f119169839 to your computer and use it in GitHub Desktop.
clear
input str500 x
"-73.974651 40.73868,-73.973391 40.73897,-73.97323 40.73955,-73.97298 40.7415304,-73.97247 40.7423406,-73.97229 40.7428504,-73.97213 40.74338,-73.971871 40.7440804,-73.97141 40.7446706,-73.97103 40.7455605,-73.970301 40.7465204,-73.96929 40.7472"
"-73.970301 40.7465204,-73.96929 40.7472"
end
// keep only the first pair of coordinates
replace x = regexr(x, ",.*", "")
// split by space, converting to numeric
split x, parse(" ") generate(coord) destring force float
// there you go
ren (coord1 coord2) (lon lat)
drop x
li
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment