diff --git a/get_countries.py b/get_countries.py index e137ff30bdde75457e4ad19b532164c86736f3ba..fa289a919dd704f17f12db97a9b23b1b99caffef 100644 --- a/get_countries.py +++ b/get_countries.py @@ -2,6 +2,7 @@ import cartopy.crs as ccrs import cartopy.feature as cf from cartopy.feature import ShapelyFeature import cartopy.io.shapereader as shpreader +from shapely.geometry import Point proj = ccrs.PlateCarree() @@ -12,13 +13,11 @@ shpfilename = shpreader.natural_earth(resolution='10m', reader = shpreader.Reader(shpfilename) # Filter for a specific country -kenya = [country for country in reader.records() if country.attributes["NAME_LONG"] == "Kenya"][0] - -# Determine bounding box -lon_min, lat_min, lon_max, lat_max = kenya.bounds -print(kenya.bounds) +countries = [country for country in reader.records()] # Display Kenya's shape -shape_feature = ShapelyFeature([kenya.geometry], ccrs.PlateCarree(), facecolor="lime", edgecolor='black', lw=1) -print(shape_feature) -print(kenya.geometry) \ No newline at end of file +#shape_feature = ShapelyFeature([country.geometry for country in countries], ccrs.PlateCarree(), facecolor="lime", edgecolor='black', lw=1) + +boundaries = [country.geometry for country in countries] +print(boundaries[0]) +print(boundaries[0].contains(Point(0,0))) \ No newline at end of file