Skip to content

Instantly share code, notes, and snippets.

@ozjimbob
Created October 11, 2022 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozjimbob/473a862914e4a11a5919ca786bca7cad to your computer and use it in GitHub Desktop.
Save ozjimbob/473a862914e4a11a5919ca786bca7cad to your computer and use it in GitHub Desktop.
blah.r
library(tidyverse)
library(plumber)
library(sf)
library(geojson)
register_serializer("geojson", serializer_geojson, verbose = TRUE)
#* @serializer geojson
#* @get /points
points <- function() {
data <- read_csv("https://gist.githubusercontent.com/kochis/535208c97d99651e052487618bde7730/raw/35d43acbe8f9188691fde4238f838ad0572ea871/locations.csv")
data <- st_as_sf(data,coords=c("longitude","latitude"),crs=4326)
return(data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment