Skip to content

Instantly share code, notes, and snippets.

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