Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import osgeo.ogr
  2. shapefile = osgeo.ogr.Open("geodata/worldborders/TM_WORLD_BORDERS-0.3.shp")
  3. layer = shapefile.GetLayer(0)
  4.  
  5. for i in range(layer.GetFeatureCount()):
  6. feature = layer.GetFeature(i)
  7. countryCode = feature.GetField("ISO3")
  8. countryName = feature.GetField("NAME")
  9. print countryCode, countryName
  10.  
  11. geometry = feature.GetGeometryRef()
  12.  
  13. point = osgeo.ogr.Geometry(osgeo.ogr.wkbPoint)
  14. point.SetPoint(0, 474595, 4429281)
  15.  
  16. import countries
  17. cc = countries.CountryChecker('TM_WORLD_BORDERS-0.3.shp')
  18. print cc.getCountry(countries.Point(49.7821, 3.5708)).iso
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement