Skip to content

Commit

Permalink
Merge pull request #137 from wri/dev
Browse files Browse the repository at this point in the history
export GBIF data by city to data hub #136
  • Loading branch information
S-AI-F authored Mar 8, 2022
2 parents 80269a9 + 7281a29 commit 1c1acf8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions baseline-indicators/biodiversity/scripts/extract-gbif-by-city.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,22 @@ leaflet(data = city_boundary, height = 500, width = "100%") %>%
overlayGroups = c("Birds observations","Birds clusters"),
options = layersControlOptions(collapsed = FALSE)
)

#########################
# convert to geojson format
#########################

city_name = "BRA-Florianopolois"
city_gbif = read.csv(paste("./data/biodiversity/data/gbif/GBIF-",city_name,".csv", sep = ""))

# convert country gbif data to sf objects
city_gbif_sf = st_as_sf(city_gbif,
coords = c("lat", "long"),
crs = st_crs(4326))

# export geojson
st_write(city_gbif_sf,
paste("./data/biodiversity/data/gbif/GBIF-",city_name,".geojson", sep = ""),
append=FALSE)


0 comments on commit 1c1acf8

Please sign in to comment.