Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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