Last active
December 20, 2015 08:49
-
-
Save mrw34/6103482 to your computer and use it in GitHub Desktop.
Convert IP addresses (e.g. from httpd logs) to GeoJSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
echo {\"type\": \"GeometryCollection\", \"geometries\": [ | |
sep= | |
while read ip ; do | |
coordinates=$(curl -s freegeoip.net/csv/$ip | csvtool col 9,8 -) | |
echo $sep{\"type\": \"Point\", \"coordinates\": [$coordinates]} | |
sep=, | |
done | |
echo ]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment