Indexing UNHCR¶
Example notebook how to index UNHCR dataset
In [18]:
Copied!
import json
from datetime import datetime
from pathlib import Path
import contextily as cx
import pandas as pd
import requests
from h3ronpy.arrow import cells_parse
from h3ronpy.pandas.vector import cells_dataframe_to_geodataframe
from worldex.datasets.unhcr import UNHCRDataset
import json
from datetime import datetime
from pathlib import Path
import contextily as cx
import pandas as pd
import requests
from h3ronpy.arrow import cells_parse
from h3ronpy.pandas.vector import cells_dataframe_to_geodataframe
from worldex.datasets.unhcr import UNHCRDataset
In [3]:
Copied!
# datasets based of https://data.unhcr.org/en/geoservices/ export tool
datasets = [{'id': 0,
'name': 'UNHCR Presence',
'description': 'The GDS presence layer is a geographic representation of the UNHCR operational presence in the countries where UNHCR is operating. It shows the diverse types of presence including temporary presence such as Field Units. Each office is either Active or Inactive depending on the operational status reported by the field. The status of the GIS layer represents the current operational presence in the world.',
'exportName': '_marker_presence_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_marker_presence_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,name_fr,name_sp,loc_type,address_1,address_2,address_3,address_4,city,ds_code,msrp_sp_id',
'type': 'point'},
{'id': 1,
'name': 'UNHCR PoC Locations',
'description': "Geographic point layer representing all the people of concern's known locations in the world (Refugees, Internally displaced, Stateless persons and other of concern). The data is displayed by population type and location type (typology adapted from the SPHERE handbook standard).",
'exportName': '_prp_p_unhcr_PoC',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_prp_p_unhcr_PoC/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,adm1_pcode,adm2_pcode,loc_type,loc_subtype,pop_type,hierarchy_pcode,footnote,source',
'type': 'point'},
{'id': 2,
'name': 'UNHCR Population Referential Points (including PoC locations)',
'description': "Point layer that represents populated places locations (e.g. capitals/ cities/ towns) and of administrative units (Level 1, 2 and 3 depending on availability)",
'exportName': '_prp_p_unhcr_ALL',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_prp_p_unhcr_ALL/FeatureServer/0',
'worldGeom': False,
'worldCSV': False,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,adm1_pcode,adm2_pcode,loc_type,loc_subtype,pop_type,hierarchy_pcode,footnote,source',
'type': 'point'},
{'id': 3,
'name': 'UNHCR First Administrative Divisions',
'description':"This layer shows the different administrative boundaries (level 1) used in the UNHCR GIS system. It is mostly from governments and official sources but also other UN bodies or NGOs. The OCHA CODs and Pcodes are examined and considered. The boundaries and names do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_polbnd_adm1_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_adm1_a_unhcr/FeatureServer/0',
'worldGeom': False,
'worldCSV': False,
'csv': True,
'outFields': 'iso3,pcode,gis_name',
'type': 'poly'},
{'id': 4,
'name': 'UNHCR Second Administrative Divisions',
'description':"This layer shows the different administrative boundaries (level 2) used in the UNHCR GIS system. It is mostly from governments and official sources but also other UN bodies or NGOs. The OCHA CODs and Pcodes are examined and considered. The boundaries and names do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_polbnd_adm2_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_adm2_a_unhcr/FeatureServer/0',
'worldGeom': False,
'worldCSV': False,
'csv': True,
'outFields': 'iso3,pcode,gis_name,adm1_pcode',
'type': 'poly'},
{'id': 5,
'name': 'Countries boundaries - Polygon - 1m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_1m_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_a_unhcr/FeatureServer/0',
'worldGeom': False,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,gis_name,name_fr,name_sp,color_code,terr_id,terr_name,secondary_territory,status_un',
'type': 'poly'},
{'id': 6,
'name': 'Countries boundaries - Lines - 1m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_1m_l_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_l_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': False,
'csv': False,
'outFields': 'iso3_1,iso3_2,type_unhcr,cartography',
'type': 'line'},
{'id': 7,
'name': 'Countries boundaries - Polygon - 15m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_15m_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_15m_a_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,gis_name,name_fr,name_sp,color_code,terr_id,terr_name,secondary_territory,status_un',
'type': 'poly'},
{'id': 8,
'name': 'Countries boundaries - Lines - 15m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_15m_l_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_15m_l_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': False,
'csv': False,
'outFields': 'iso3_1,iso3_2,type_unhcr,cartography',
'type': 'line'},
{'id': 9,
'name': 'Countries centroids',
'description':"Country centroids used by UNHCR.",
'exportName': '_polbnd_int_1m_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,gis_name,name_fr,name_sp,color_code,terr_id,terr_name,secondary_territory,status_un',
'type': 'point'},
{'id': 10,
'name': 'Border Crossing Points',
'description':"Country border crossing points. The boundaries and names included in this web service do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_marker_crossing_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_marker_crossing_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'pcode,iso3_1,iso3_2,name_1,name_2,loc_type',
'type': 'point'},
{'id': 11,
'name': 'UNHCR Warehouses',
'description':"This layer shows the different UNHCR active warehouses in the world. The boundaries and names included in this web service do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_marker_warehouse_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_marker_warehouse_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,loc_type,code_shipto,code_location,capacity_m3,occupancy,occupancy_date',
'type': 'point'}]
# datasets based of https://data.unhcr.org/en/geoservices/ export tool
datasets = [{'id': 0,
'name': 'UNHCR Presence',
'description': 'The GDS presence layer is a geographic representation of the UNHCR operational presence in the countries where UNHCR is operating. It shows the diverse types of presence including temporary presence such as Field Units. Each office is either Active or Inactive depending on the operational status reported by the field. The status of the GIS layer represents the current operational presence in the world.',
'exportName': '_marker_presence_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_marker_presence_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,name_fr,name_sp,loc_type,address_1,address_2,address_3,address_4,city,ds_code,msrp_sp_id',
'type': 'point'},
{'id': 1,
'name': 'UNHCR PoC Locations',
'description': "Geographic point layer representing all the people of concern's known locations in the world (Refugees, Internally displaced, Stateless persons and other of concern). The data is displayed by population type and location type (typology adapted from the SPHERE handbook standard).",
'exportName': '_prp_p_unhcr_PoC',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_prp_p_unhcr_PoC/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,adm1_pcode,adm2_pcode,loc_type,loc_subtype,pop_type,hierarchy_pcode,footnote,source',
'type': 'point'},
{'id': 2,
'name': 'UNHCR Population Referential Points (including PoC locations)',
'description': "Point layer that represents populated places locations (e.g. capitals/ cities/ towns) and of administrative units (Level 1, 2 and 3 depending on availability)",
'exportName': '_prp_p_unhcr_ALL',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_prp_p_unhcr_ALL/FeatureServer/0',
'worldGeom': False,
'worldCSV': False,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,adm1_pcode,adm2_pcode,loc_type,loc_subtype,pop_type,hierarchy_pcode,footnote,source',
'type': 'point'},
{'id': 3,
'name': 'UNHCR First Administrative Divisions',
'description':"This layer shows the different administrative boundaries (level 1) used in the UNHCR GIS system. It is mostly from governments and official sources but also other UN bodies or NGOs. The OCHA CODs and Pcodes are examined and considered. The boundaries and names do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_polbnd_adm1_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_adm1_a_unhcr/FeatureServer/0',
'worldGeom': False,
'worldCSV': False,
'csv': True,
'outFields': 'iso3,pcode,gis_name',
'type': 'poly'},
{'id': 4,
'name': 'UNHCR Second Administrative Divisions',
'description':"This layer shows the different administrative boundaries (level 2) used in the UNHCR GIS system. It is mostly from governments and official sources but also other UN bodies or NGOs. The OCHA CODs and Pcodes are examined and considered. The boundaries and names do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_polbnd_adm2_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_adm2_a_unhcr/FeatureServer/0',
'worldGeom': False,
'worldCSV': False,
'csv': True,
'outFields': 'iso3,pcode,gis_name,adm1_pcode',
'type': 'poly'},
{'id': 5,
'name': 'Countries boundaries - Polygon - 1m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_1m_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_a_unhcr/FeatureServer/0',
'worldGeom': False,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,gis_name,name_fr,name_sp,color_code,terr_id,terr_name,secondary_territory,status_un',
'type': 'poly'},
{'id': 6,
'name': 'Countries boundaries - Lines - 1m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_1m_l_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_l_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': False,
'csv': False,
'outFields': 'iso3_1,iso3_2,type_unhcr,cartography',
'type': 'line'},
{'id': 7,
'name': 'Countries boundaries - Polygon - 15m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_15m_a_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_15m_a_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,gis_name,name_fr,name_sp,color_code,terr_id,terr_name,secondary_territory,status_un',
'type': 'poly'},
{'id': 8,
'name': 'Countries boundaries - Lines - 15m scale',
'description':"Country boundaries used by UNHCR.",
'exportName': '_polbnd_int_15m_l_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_15m_l_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': False,
'csv': False,
'outFields': 'iso3_1,iso3_2,type_unhcr,cartography',
'type': 'line'},
{'id': 9,
'name': 'Countries centroids',
'description':"Country centroids used by UNHCR.",
'exportName': '_polbnd_int_1m_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,gis_name,name_fr,name_sp,color_code,terr_id,terr_name,secondary_territory,status_un',
'type': 'point'},
{'id': 10,
'name': 'Border Crossing Points',
'description':"Country border crossing points. The boundaries and names included in this web service do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_marker_crossing_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_marker_crossing_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'pcode,iso3_1,iso3_2,name_1,name_2,loc_type',
'type': 'point'},
{'id': 11,
'name': 'UNHCR Warehouses',
'description':"This layer shows the different UNHCR active warehouses in the world. The boundaries and names included in this web service do not imply official endorsement or acceptance by the United Nations.",
'exportName': '_marker_warehouse_p_unhcr',
'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_marker_warehouse_p_unhcr/FeatureServer/0',
'worldGeom': True,
'worldCSV': True,
'csv': True,
'outFields': 'iso3,pcode,gis_name,name_alt,loc_type,code_shipto,code_location,capacity_m3,occupancy,occupancy_date',
'type': 'point'}]
In [4]:
Copied!
# locations defined
locations = requests.get(
"https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_p_unhcr/FeatureServer/0/query?where=iso3+IS+NOT+NULL+AND+gis_name+IS+NOT+NULL+AND+iso3+%3C%3E+%27AAA%27&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields=iso3%2C+gis_name&returnGeometry=false&maxAllowableOffset=&geometryPrecision=&outSR=&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnExceededLimitFeatures=false&quantizationParameters=&returnCentroid=false&sqlFormat=none&resultType=&featureEncoding=esriDefault&datumTransformation=&f=geojson"
).json()
# locations defined
locations = requests.get(
"https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_polbnd_int_1m_p_unhcr/FeatureServer/0/query?where=iso3+IS+NOT+NULL+AND+gis_name+IS+NOT+NULL+AND+iso3+%3C%3E+%27AAA%27&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields=iso3%2C+gis_name&returnGeometry=false&maxAllowableOffset=&geometryPrecision=&outSR=&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnExceededLimitFeatures=false&quantizationParameters=&returnCentroid=false&sqlFormat=none&resultType=&featureEncoding=esriDefault&datumTransformation=&f=geojson"
).json()
In [32]:
Copied!
dataset = datasets[2]
location = locations['features'][12]
location
dataset = datasets[2]
location = locations['features'][12]
location
Out[32]:
{'type': 'Feature', 'geometry': None, 'properties': {'iso3': 'LKA', 'gis_name': 'Sri Lanka'}}
In [33]:
Copied!
dataset
dataset
Out[33]:
{'id': 2, 'name': 'UNHCR Population Referential Points (including PoC locations)', 'description': 'Point layer that represents populated places locations (e.g. capitals/ cities/ towns) and of administrative units (Level 1, 2 and 3 depending on availability)', 'exportName': '_prp_p_unhcr_ALL', 'url': 'https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_prp_p_unhcr_ALL/FeatureServer/0', 'worldGeom': False, 'worldCSV': False, 'csv': True, 'outFields': 'iso3,pcode,gis_name,name_alt,adm1_pcode,adm2_pcode,loc_type,loc_subtype,pop_type,hierarchy_pcode,footnote,source', 'type': 'point'}
In [34]:
Copied!
# Parse information
dataset_id = dataset['id']
baseUrl = datasets[dataset_id]['url']
iso3 = location['properties']['iso3']
gis_name = location['properties']['gis_name']
dataset_name = dataset['name']
title = f"{dataset_name} - {gis_name}"
description = dataset['description']
# Parse information
dataset_id = dataset['id']
baseUrl = datasets[dataset_id]['url']
iso3 = location['properties']['iso3']
gis_name = location['properties']['gis_name']
dataset_name = dataset['name']
title = f"{dataset_name} - {gis_name}"
description = dataset['description']
In [35]:
Copied!
# Create dir to save files
path = Path(f"../data/worldbankcatalog/{title}")
path.mkdir(parents=True, exist_ok=True)
# Create dir to save files
path = Path(f"../data/worldbankcatalog/{title}")
path.mkdir(parents=True, exist_ok=True)
In [36]:
Copied!
if (iso3=="wrl"):
raise ValueError("Need to skip worldwide")
else:
if dataset_id == 6 or dataset_id == 8 or dataset_id == 10:
query = "/query?where=iso3_1+%3D+%27"+iso3+"%27+OR+iso3_2+%3D+%27"+iso3+"%27&"
else:
query = "/query?where=iso3%3D%27"+iso3+"%27&"
endUrl = "objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields="+datasets[dataset_id]['outFields']+"&returnGeometry=true&maxAllowableOffset=&geometryPrecision=4&outSR=4326&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnExceededLimitFeatures=false&quantizationParameters=&returnCentroid=false&sqlFormat=none&resultType=&featureEncoding=esriDefault&datumTransformation=&f=geojson"
dataUrl = baseUrl + query + endUrl
if (iso3=="wrl"):
raise ValueError("Need to skip worldwide")
else:
if dataset_id == 6 or dataset_id == 8 or dataset_id == 10:
query = "/query?where=iso3_1+%3D+%27"+iso3+"%27+OR+iso3_2+%3D+%27"+iso3+"%27&"
else:
query = "/query?where=iso3%3D%27"+iso3+"%27&"
endUrl = "objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields="+datasets[dataset_id]['outFields']+"&returnGeometry=true&maxAllowableOffset=&geometryPrecision=4&outSR=4326&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnExceededLimitFeatures=false&quantizationParameters=&returnCentroid=false&sqlFormat=none&resultType=&featureEncoding=esriDefault&datumTransformation=&f=geojson"
dataUrl = baseUrl + query + endUrl
In [37]:
Copied!
# prefetch data to ensure it is valid
resp = requests.get(dataUrl)
if resp.status_code >= 300:
raise Exception("invalid status code ")
if resp.json()['features'] == 0:
raise Exception("empty feautres")
# prefetch data to ensure it is valid
resp = requests.get(dataUrl)
if resp.status_code >= 300:
raise Exception("invalid status code ")
if resp.json()['features'] == 0:
raise Exception("empty feautres")
In [38]:
Copied!
dataset = UNHCRDataset(
name=title,
last_fetched=datetime.now().isoformat(),
files=[dataUrl],
data_format="GeoJSON",
description=description,
projection="EPSG:4326",
keywords=[],
date_start=None,
date_end=None,
accessibility="public/open",
url="https://data.unhcr.org/en/geoservices/",
)
dataset.set_dir(path)
dataset.index()
dataset = UNHCRDataset(
name=title,
last_fetched=datetime.now().isoformat(),
files=[dataUrl],
data_format="GeoJSON",
description=description,
projection="EPSG:4326",
keywords=[],
date_start=None,
date_end=None,
accessibility="public/open",
url="https://data.unhcr.org/en/geoservices/",
)
dataset.set_dir(path)
dataset.index()
Out[38]:
h3_index | |
---|---|
0 | 8861022489fffff |
1 | 88611c70ebfffff |
2 | 88611cb109fffff |
3 | 88611eb9bdfffff |
4 | 88611e62b3fffff |
... | ... |
327 | 886110b4c3fffff |
328 | 88611c5167fffff |
329 | 88611c78d3fffff |
330 | 886111d617fffff |
331 | 88611cb121fffff |
332 rows × 1 columns
In [39]:
Copied!
with open(path / "metadata.json") as f:
metadata = json.load(f)
metadata
with open(path / "metadata.json") as f:
metadata = json.load(f)
metadata
Out[39]:
{'id': 'bc4c5f3e-8919-4c1c-86c9-bfa160f010e4', 'name': 'UNHCR Population Referential Points (including PoC locations) - Sri Lanka', 'source_org': 'UNHCR', 'last_fetched': '2024-03-22T09:37:19.962220', 'files': ['https://gis.unhcr.org/arcgis/rest/services/core_v2/wrl_prp_p_unhcr_ALL/FeatureServer/0/query?where=iso3%3D%27LKA%27&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields=iso3,pcode,gis_name,name_alt,adm1_pcode,adm2_pcode,loc_type,loc_subtype,pop_type,hierarchy_pcode,footnote,source&returnGeometry=true&maxAllowableOffset=&geometryPrecision=4&outSR=4326&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnExceededLimitFeatures=false&quantizationParameters=&returnCentroid=false&sqlFormat=none&resultType=&featureEncoding=esriDefault&datumTransformation=&f=geojson'], 'description': 'Point layer that represents populated places locations (e.g. capitals/ cities/ towns) and of administrative units (Level 1, 2 and 3 depending on availability)', 'data_format': 'GeoJSON', 'projection': 'EPSG:4326', 'properties': None, 'bbox': 'POLYGON ((81.8555000000000064 5.9367000000000001, 81.8555000000000064 9.8241999999999994, 79.6894999999999953 9.8241999999999994, 79.6894999999999953 5.9367000000000001, 81.8555000000000064 5.9367000000000001))', 'keywords': [], 'date_start': None, 'date_end': None, 'accessibility': 'public/open', 'url': 'https://data.unhcr.org/en/geoservices/'}
In [40]:
Copied!
h3 = pd.read_parquet(path / "h3-compact.parquet")
h3_gdf = cells_dataframe_to_geodataframe(
pd.DataFrame({"cell": cells_parse(h3.h3_index)})
)
h3_gdf_reprojected = h3_gdf.to_crs(epsg=3857)
ax = h3_gdf_reprojected.plot(figsize=(10, 10), alpha=0.5, edgecolor="k")
cx.add_basemap(ax, source=cx.providers.CartoDB.Positron)
h3 = pd.read_parquet(path / "h3-compact.parquet")
h3_gdf = cells_dataframe_to_geodataframe(
pd.DataFrame({"cell": cells_parse(h3.h3_index)})
)
h3_gdf_reprojected = h3_gdf.to_crs(epsg=3857)
ax = h3_gdf_reprojected.plot(figsize=(10, 10), alpha=0.5, edgecolor="k")
cx.add_basemap(ax, source=cx.providers.CartoDB.Positron)
In [ ]:
Copied!