I am looking for a free or even commercial data source for ISO 3166-1 and ISO 3166-2 data, ideally with border data (e.g. in kml). The ISO 3166-1 and ISO 3166-2 data should contain the hierarchical relationships as shown in the following picture:
I've started to collect a list of world (country, cities, etc.) datasets, guides, etc. in the Awesome World List @ Planet Open Data. For example, the GeoNames, Natural Earth, etc. datasets might be some candidates. Cheers.
Natural Earth Data
you can download shapefiles here, not kml
I just created a GitHub repo with a world shapefile of ISO 3166-1 entities, based on Natural Earth 1:10m Cultural Vectors.
The repo includes ready to use shapefiles, original data and script. Please note that there are a few ISO 3166-1 entities that still need fixing (see issue 1).
Here is a script that will attempt to add ISO3166-2 data to Natural Earth 2.0 admin_1_states_province polygons: https://gist.github.com/migurski/4a5821699e1ed519a604
The output can be found in this repository at https://github.com/nvkelso/natural-earth-vector/blob/master/10m_cultural/ne_10m_admin_1_states_provinces.dbf (and related unmodified shapefile in the same folder)