Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BigData-radio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ANDRE Quentin
BigData-radio
Commits
16f38c01
Commit
16f38c01
authored
2 years ago
by
Quentin ANDRE
Browse files
Options
Downloads
Patches
Plain Diff
get_countries
parent
d37c7ce4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
get_countries.py
+3
-14
3 additions, 14 deletions
get_countries.py
with
3 additions
and
14 deletions
get_countries.py
+
3
−
14
View file @
16f38c01
import
cartopy.crs
as
ccrs
import
cartopy.feature
as
cf
from
cartopy.feature
import
ShapelyFeature
from
matplotlib
import
pyplot
as
plt
import
cartopy.io.shapereader
as
shpreader
proj
=
ccrs
.
PlateCarree
()
ax
=
plt
.
axes
(
projection
=
proj
)
# Show only Africa
#ax.set_extent([-23, 55, -35, 40])
ax
.
stock_img
()
ax
.
add_feature
(
cf
.
COASTLINE
,
lw
=
2
)
# Make figure larger
plt
.
gcf
().
set_size_inches
(
20
,
10
)
# Read shape file
shpfilename
=
shpreader
.
natural_earth
(
resolution
=
'
10m
'
,
...
...
@@ -26,10 +16,9 @@ kenya = [country for country in reader.records() if country.attributes["NAME_LON
# Determine bounding box
lon_min
,
lat_min
,
lon_max
,
lat_max
=
kenya
.
bounds
ax
.
set_extent
([
lon_min
,
lon_max
,
lat_min
,
lat_max
]
)
print
(
kenya
.
bounds
)
# Display Kenya's shape
shape_feature
=
ShapelyFeature
([
kenya
.
geometry
],
ccrs
.
PlateCarree
(),
facecolor
=
"
lime
"
,
edgecolor
=
'
black
'
,
lw
=
1
)
ax
.
add_feature
(
shape_feature
)
plt
.
show
()
\ No newline at end of file
print
(
shape_feature
)
print
(
kenya
.
geometry
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment