Skip to content

Instantly share code, notes, and snippets.

@mrw34
Last active December 20, 2015 08:49
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 mrw34/6103482 to your computer and use it in GitHub Desktop.
Save mrw34/6103482 to your computer and use it in GitHub Desktop.
Convert IP addresses (e.g. from httpd logs) to GeoJSON
#!/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