Skip to content

Commit 1c1acf8

Browse files
authored
Merge pull request #137 from wri/dev
export GBIF data by city to data hub #136
2 parents 80269a9 + 7281a29 commit 1c1acf8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

baseline-indicators/biodiversity/scripts/extract-gbif-by-city.R

+19
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,22 @@ leaflet(data = city_boundary, height = 500, width = "100%") %>%
168168
overlayGroups = c("Birds observations","Birds clusters"),
169169
options = layersControlOptions(collapsed = FALSE)
170170
)
171+
172+
#########################
173+
# convert to geojson format
174+
#########################
175+
176+
city_name = "BRA-Florianopolois"
177+
city_gbif = read.csv(paste("./data/biodiversity/data/gbif/GBIF-",city_name,".csv", sep = ""))
178+
179+
# convert country gbif data to sf objects
180+
city_gbif_sf = st_as_sf(city_gbif,
181+
coords = c("lat", "long"),
182+
crs = st_crs(4326))
183+
184+
# export geojson
185+
st_write(city_gbif_sf,
186+
paste("./data/biodiversity/data/gbif/GBIF-",city_name,".geojson", sep = ""),
187+
append=FALSE)
188+
189+

0 commit comments

Comments
 (0)