Skip to content

Instantly share code, notes, and snippets.

@martin9700
Created January 3, 2014 12:22
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 martin9700/8237095 to your computer and use it in GitHub Desktop.
Save martin9700/8237095 to your computer and use it in GitHub Desktop.
$Locations = @(Invoke-RestMethod -Uri "http://www.seismi.org/api/eqs" -ErrorAction Stop | Select -ExpandProperty Earthquakes | Select -First $Quakes)
$Markers = "var markers = [`n"
ForEach ($Num in (0..($Locations.Count - 1)))
{ $Region = $Locations[$Num].Region.Replace("`'","\'")
$Markers += " ['$Region',$($Locations[$Num].Lat),$($Locations[$Num].Lon),'$($Locations[$Num].timedate)','$($Locations[$Num].magnitude)']"
If ($Num -lt ($Locations.Count - 1))
{ $Markers += ",`n"
}
}
$Markers += "`n ];`n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment