Skip to content

Instantly share code, notes, and snippets.

@arzola
Created November 5, 2014 00:32
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 arzola/5f5753fb1dd1c06f20be to your computer and use it in GitHub Desktop.
Save arzola/5f5753fb1dd1c06f20be to your computer and use it in GitHub Desktop.
Regex to convert coordinates string to Google Maps Points
//str example
-87.6361173230483,41.9184733663886,0 -87.63625063290191,41.9186879407643,0 -87.63638917236651,41.9188946307294,0 -87.63638597726001,41.9196072396054,0 -87.63640288658171,41.9201768975391,0 -87.6364176789852,41.9206761120529,0 -87.6364281700465,41.921033421017,0 -87.6364463383626,41.9216235169182,0 -87.636450850147,41.921817693737,0 -87.63645747855981,41.9219928494608,0 -87.6364639198159,41.9221636969844,0 -87.6364641782462,41.9221721963153
(-\d\d\.+(\d)*)+,(\d\d\.+(\d)*)+,(0)
Regex replace
new google.maps.LatLng($1,$3),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment