地图从http://thematicmapping.org/downloads/world_borders.php下载,使用vpn下载。
确保安装好python和gdal
import os
os.chdir("Pah/to/thefile/world.shp")
import osgeo.ogr
shapefile = ogr.Open("world.shp")
layer = shapefile.GetLayer(0)
for i in range(layer.GetFeatureCount())
feature = layer.GetFeature(i)
countryName = feature.GetField("NAME")
countryCode = feature.GetField("ISO3")
geometry = feature.GetGeometryRef()
minlong,maxlong,minLat,maxLat = geometry.GetEnvelope()
print countryName,countryCode,minlong,maxlong,minLat,maxLat