Spaces:
Sleeping
Sleeping
kleinhoellental
commited on
Commit
•
aac19a4
1
Parent(s):
4daa101
Delete modules/getCountrycode.py
Browse files- modules/getCountrycode.py +0 -30
modules/getCountrycode.py
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
import geopandas as gpd
|
2 |
-
|
3 |
-
# Sample DataFrame acording to actual structure (use your own data)
|
4 |
-
data = {'GID_1': ['DEU.1_1','DEU.2_1'],
|
5 |
-
'GID_0': ['DEU', 'DEU'],
|
6 |
-
'COUNTRY': ['Germany', 'Germany'],
|
7 |
-
'NAME_1': ['Baden-Würtenberg', 'Bayern'],
|
8 |
-
'VARNAME_1': ['NA','Bavaria'],
|
9 |
-
'NL_NAME_1': ['NA', 'NA'],
|
10 |
-
'TYPE_1': ['Land', 'Freistaat'],
|
11 |
-
'ENGTYPE_1': ['State', 'Freestate'],
|
12 |
-
'CC_1': ['08','09'],
|
13 |
-
'HASC_1': ['DE.BW', 'DE.BY'], # Extra for subnational countys (https://de.wikipedia.org/wiki/Hierarchical_administrative_subdivision_codes)
|
14 |
-
'ISO_1': ['NA', 'DE-BY'], # International Order --> Check First (https://de.wikipedia.org/wiki/ISO_3166)
|
15 |
-
'geometry': [0,1]
|
16 |
-
}
|
17 |
-
gdf = gpd.GeoDataFrame(data)
|
18 |
-
|
19 |
-
# function to generate output
|
20 |
-
# Land should be a line from the geojson-table
|
21 |
-
# Currently only works for NUTS-1 areas!!!
|
22 |
-
|
23 |
-
def getCountrycode(land):
|
24 |
-
if land['ISO_1'] != 'NA':
|
25 |
-
return land['ISO_1']
|
26 |
-
elif land['HASC_1']:
|
27 |
-
return land['HASC_1']
|
28 |
-
else:
|
29 |
-
return False
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|