I need to convert from iso-3166-1/iso-3166-2 codes to longitude/latitude
Since I didn't get any answers, I will explain how I solved it.
I found this csv listing for the iso-3166-1 country code centroids: http://dev.maxmind.com/geoip/legacy/codes/country_latlon/ (I had to make a few manual tweaks)
As for the iso-3166-2 region centroids, I ended up creating a shell script which uses the Google Maps API to print the region centroids in csv format (note that I didn't verify the full output but the cases I checked are correct). Here's a simplified version of the script using curl and jq to process the API's output:
#!/bin/bash # Example list of regions (full list can be obtained from https://www.ip2location.com/free/iso3166-2 ) REGIONS="VE-O GB-BKM GB-CAM GB-CMA" for REGION in $REGIONS; do LATLON=$(curl -s "maps.googleapis.com/maps/api/geocode/json?sensor=false&address=$REGION" | jq -r '.results.geometry.location.lat,@text ",",.results.geometry.location.lng') echo $REGION , $LATLON | tr -d ' ' done
Then I imported the csv listings in my java code using Apache Commons CSV