Skip to content

Commit 2d9bfce

Browse files
author
Saif Shabou
committedMar 10, 2022
generate metadata file #140
1 parent a5811ad commit 2d9bfce

File tree

2 files changed

+285
-0
lines changed

2 files changed

+285
-0
lines changed
 

‎geospatial-layers/scripts/metedata.R

+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
library(jsonlite)
2+
3+
4+
5+
urbanshift_metadata <-list(list(filename = "dataset 1",
6+
description="This a description",
7+
title = "This is a title",
8+
tags=c("tag_1","tag_2","tag_3")),
9+
list(filename = "dataset 2",
10+
description="This a description",
11+
title = "This is a title",
12+
tags=c("tag_1","tag_2"))
13+
)
14+
15+
16+
17+
urbanshift_metadata_json =jsonlite::toJSON(urbanshift_metadata,pretty=TRUE,auto_unbox=TRUE)
18+
19+
write(urbanshift_metadata_json, "./data/urbanshift_metadata_json")
20+
21+
#########################
22+
# ESA world cover
23+
#########################
24+
25+
city_name = "CRI-San_Jose"
26+
27+
data_url = paste("https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/land_use/esa_world_cover/world_cover_",
28+
city_name,
29+
".tif",
30+
sep = "")
31+
32+
data = raster(data_url)
33+
34+
dataset_name = paste("ESA World cover land cover extract for", city_name, sep = " ")
35+
description = "The European Space Agency (ESA) WorldCover 10 m 2020 product provides a global land cover map for 2020 at 10 m resolution based on Sentinel-1 and Sentinel-2 data. The WorldCover product comes with 11 land cover classes, aligned with UN-FAO’s Land Cover Classification System, and has been generated in the framework of the ESA WorldCover project. The World Cover product comes with 11 land cover classes: Tree cover, Shrubland, Grassland, Cropland, Built-up, Bare / sparse vegetation, Snow and ice, Open water, Herbaceous wetland, Mangroves, Moss and lichen."
36+
tags = c(city_name,
37+
"Biodiversity",
38+
"Land cover",
39+
"Geography:America:Costa_Rica")
40+
year = 2020
41+
spatial_resolution = "10m"
42+
temporal_resolution = "yearly"
43+
spatial_extent = "Global"
44+
temporal_extent = "2020"
45+
extent = list(list(extent(data)[1], extent(data)[3]),list(extent(data)[2], extent(data)[4]))
46+
format = "raster"
47+
source = "https://esa-worldcover.org/en"
48+
provider = "European Space Agency (ESA)"
49+
50+
51+
metadata_esa_world_cover = list(title = dataset_name,
52+
description = description,
53+
tags = tags,
54+
year = year,
55+
spatial_resolution = spatial_resolution,
56+
temporal_resolution = temporal_resolution,
57+
spatial_extent = spatial_extent,
58+
temporal_extent = temporal_extent,
59+
extent = extent,
60+
format = format,
61+
source = source,
62+
provider = provider,
63+
url = data_url)
64+
65+
metadata_esa_world_cover_json =jsonlite::toJSON(metadata_esa_world_cover,
66+
pretty=TRUE,
67+
auto_unbox=TRUE)
68+
69+
70+
#########################
71+
# Global Biodiversity Information Facility
72+
#########################
73+
74+
data_url = paste("https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/biodiversity/GBIF-",
75+
city_name,
76+
".geojson",
77+
sep = "")
78+
79+
dataset_name = paste("Global Biodiversity Information Facility for", city_name, sep = " ")
80+
description = "The Global Biodiversity Information Facility (GBIF) is an international network and data infrastructure funded by the world’s governments and aimed at providing anyone, anywhere, open access to data about all types of life on Earth.."
81+
tags = c(city_name,
82+
"Biodiversity",
83+
"Geography:America:Costa_Rica")
84+
year = 2020
85+
format = "geojson"
86+
source = "https://www.gbif.org/en/"
87+
provider = "Global Biodiversity Information Facility"
88+
89+
metadata_gbif = list(title = dataset_name,
90+
description = description,
91+
tags = tags,
92+
year = year,
93+
format = format,
94+
source = source,
95+
provider = provider,
96+
url = data_url)
97+
98+
metadata_gbif_json =jsonlite::toJSON(metadata_gbif,
99+
pretty=TRUE,
100+
auto_unbox=TRUE)
101+
102+
103+
#########################
104+
# Amenity
105+
#########################
106+
107+
data_url = paste("https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/biodiversity/amenity_",
108+
city_name,
109+
".geojson",
110+
sep = "")
111+
112+
dataset_name = paste("Urban amenities extract for", city_name, sep = " ")
113+
description = "OpenStreetMap (OSM) provides a free access to the different geographical features mapped by OSM contributors. Amenity data represents physical features on the ground with their corresponding geographic attributes."
114+
tags = c(city_name,
115+
"Amenity",
116+
"Geography:America:Costa_Rica")
117+
year = 2022
118+
format = "geojson"
119+
source = "https://wiki.openstreetmap.org/wiki/Elements"
120+
provider = "OpenStreetMap"
121+
122+
metadata_amenity = list(title = dataset_name,
123+
description = description,
124+
tags = tags,
125+
year = year,
126+
format = format,
127+
source = source,
128+
provider = provider,
129+
url = data_url)
130+
131+
metadata_amenity_json =jsonlite::toJSON(metadata_amenity,
132+
pretty=TRUE,
133+
auto_unbox=TRUE)
134+
135+
#########################
136+
# Boundaries
137+
#########################
138+
139+
data_url = paste("https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/biodiversity/",
140+
city_name,
141+
"-boundary.geojson",
142+
sep = "")
143+
144+
dataset_name = paste("Administrative boundaries extract for", city_name, sep = " ")
145+
description = "OpenStreetMap (OSM) provides a free access to the different geographical features mapped by OSM contributors. Amenity data represents physical features on the ground with their corresponding geographic attributes."
146+
tags = c(city_name,
147+
"Amenity",
148+
"Geography:America:Costa_Rica")
149+
year = 2022
150+
format = "geojson"
151+
source = "https://wiki.openstreetmap.org/wiki/Elements"
152+
provider = "OpenStreetMap"
153+
154+
metadata_amenity = list(title = dataset_name,
155+
description = description,
156+
tags = tags,
157+
year = year,
158+
format = format,
159+
source = source,
160+
provider = provider,
161+
url = data_url)
162+
163+
metadata_amenity_json =jsonlite::toJSON(metadata_amenity,
164+
pretty=TRUE,
165+
auto_unbox=TRUE)
166+
167+
#########################
168+
# Urban Land Use
169+
#########################
170+
171+
172+
data_url = paste("https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/land_use/urban_land_use/",
173+
city_name,
174+
"-urbanlanduse2020.tif",
175+
sep = "")
176+
177+
data = raster(data_url)
178+
179+
dataset_name = paste("Urban Land Use extract for", city_name, sep = " ")
180+
description = "The ULU data provides land use and land cover information of urban areas based on the application of supervised classification model trained on high resolution Sentinel-2 stallite imagery data. Urban land classes include: open space,non residential area,residential atomistic,residential informal,residential forma,housing project, and roads."
181+
tags = c(city_name,
182+
"Land Use",
183+
"Geography:America:Costa_Rica")
184+
year = 2020
185+
extent = list(list(extent(data)[1], extent(data)[3]),list(extent(data)[2], extent(data)[4]))
186+
format = "raster"
187+
source = "https://www.wri.org/research/spatial-characterization-urban-land-use-through-machine-learning"
188+
provider = "World Resources Institute (WRI)"
189+
190+
191+
metadata_ulu = list(title = dataset_name,
192+
description = description,
193+
tags = tags,
194+
year = year,
195+
extent = extent,
196+
format = format,
197+
source = source,
198+
provider = provider,
199+
url = data_url)
200+
201+
metadata_ulu_json =jsonlite::toJSON(metadata_ulu,
202+
pretty=TRUE,
203+
auto_unbox=TRUE)
204+
205+
206+
#########################
207+
# Store output
208+
#########################
209+
210+
metadata = list(metadata_esa_world_cover,
211+
metadata_gbif,
212+
metadata_amenity,
213+
metadata_ulu)
214+
215+
metadata_json =jsonlite::toJSON(metadata,
216+
pretty=TRUE,
217+
auto_unbox=TRUE)
218+
219+
write(metadata_json, "./data/metadata.json")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[
2+
{
3+
"title": "ESA World cover land cover extract for CRI-San_Jose",
4+
"description": "The European Space Agency (ESA) WorldCover 10 m 2020 product provides a global land cover map for 2020 at 10 m resolution based on Sentinel-1 and Sentinel-2 data. The WorldCover product comes with 11 land cover classes, aligned with UN-FAO’s Land Cover Classification System, and has been generated in the framework of the ESA WorldCover project. The World Cover product comes with 11 land cover classes: Tree cover, Shrubland, Grassland, Cropland, Built-up, Bare / sparse vegetation, Snow and ice, Open water, Herbaceous wetland, Mangroves, Moss and lichen.",
5+
"tags": ["CRI-San_Jose", "Biodiversity", "Land cover", "Geography:America:Costa_Rica"],
6+
"year": 2020,
7+
"spatial_resolution": "10m",
8+
"temporal_resolution": "yearly",
9+
"spatial_extent": "Global",
10+
"temporal_extent": "2020",
11+
"extent": [
12+
[
13+
-84.47,
14+
9.5508
15+
],
16+
[
17+
-83.6458,
18+
10.4142
19+
]
20+
],
21+
"format": "raster",
22+
"source": "https://esa-worldcover.org/en",
23+
"provider": "European Space Agency (ESA)",
24+
"url": "https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/land_use/esa_world_cover/world_cover_CRI-San_Jose.tif"
25+
},
26+
{
27+
"title": "Global Biodiversity Information Facility for CRI-San_Jose",
28+
"description": "The Global Biodiversity Information Facility (GBIF) is an international network and data infrastructure funded by the world’s governments and aimed at providing anyone, anywhere, open access to data about all types of life on Earth..",
29+
"tags": ["CRI-San_Jose", "Biodiversity", "Geography:America:Costa_Rica"],
30+
"year": 2020,
31+
"format": "geojson",
32+
"source": "https://www.gbif.org/en/",
33+
"provider": "Global Biodiversity Information Facility",
34+
"url": "https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/biodiversity/GBIF-CRI-San_Jose.geojson"
35+
},
36+
{
37+
"title": "Urban amenities extract for CRI-San_Jose",
38+
"description": "OpenStreetMap (OSM) provides a free access to the different geographical features mapped by OSM contributors. Amenity data represents physical features on the ground with their corresponding geographic attributes.",
39+
"tags": ["CRI-San_Jose", "Amenity", "Geography:America:Costa_Rica"],
40+
"year": 2022,
41+
"format": "geojson",
42+
"source": "https://wiki.openstreetmap.org/wiki/Elements",
43+
"provider": "OpenStreetMap",
44+
"url": "https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/biodiversity/amenity_CRI-San_Jose.geojson"
45+
},
46+
{
47+
"title": "Urban Land Use extract for CRI-San_Jose",
48+
"description": "The ULU data provides land use and land cover information of urban areas based on the application of supervised classification model trained on high resolution Sentinel-2 stallite imagery data. Urban land classes include: open space,non residential area,residential atomistic,residential informal,residential forma,housing project, and roads.",
49+
"tags": ["CRI-San_Jose", "Land Use", "Geography:America:Costa_Rica"],
50+
"year": 2020,
51+
"extent": [
52+
[
53+
-84.4689,
54+
9.5511
55+
],
56+
[
57+
-83.6465,
58+
10.4137
59+
]
60+
],
61+
"format": "raster",
62+
"source": "https://www.wri.org/research/spatial-characterization-urban-land-use-through-machine-learning",
63+
"provider": "World Resources Institute (WRI)",
64+
"url": "https://cities-urbanshift.s3.eu-west-3.amazonaws.com/data/land_use/urban_land_use/CRI-San_Jose-urbanlanduse2020.tif"
65+
}
66+
]

0 commit comments

Comments
 (0)
Please sign in to comment.