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
e2518f21
Commit
e2518f21
authored
2 years ago
by
Quentin ANDRE
Browse files
Options
Downloads
Patches
Plain Diff
get_countries
parent
16f38c01
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
+7
-8
7 additions, 8 deletions
get_countries.py
with
7 additions
and
8 deletions
get_countries.py
+
7
−
8
View file @
e2518f21
...
...
@@ -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
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