Created
December 19, 2017 18:46
-
-
Save tiernanmartin/921d0b2529525bb8d1e3250c5a26bc3f to your computer and use it in GitHub Desktop.
A benchmarking comparison of two methods: read_sf(geojson_url) vs. esri2sf(rest_service_url)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup ---- | |
library(rbenchmark) | |
library(tidyverse) | |
library(sf) | |
library(esri2sf) | |
cols <- c( "elapsed", "relative", "user.self", "sys.self") | |
geojson_url <- "https://opendata.arcgis.com/datasets/3fdb7c41de8548c5ab5f96cb1ef303e2_446.geojson" | |
rest_url <- "https://gisdata.kingcounty.gov/arcgis/rest/services/OpenDataPortal/admin___base/MapServer/446" | |
# Benchmarks ---- | |
benchmark({ | |
read_sf(geojson_url) | |
},columns = cols,replications = 10) | |
## elapsed relative user.self sys.self | |
## 1 27.24 1 9.36 0.55 | |
benchmark({ | |
esri2sf(rest_url) | |
},columns = cols,replications = 10) | |
## elapsed relative user.self sys.self | |
## 1 67.95 1 17.55 1.06 | |
# Test for sameness ---- | |
geojson <- read_sf(geojson_url) | |
rest <- esri2sf(rest_url) | |
all.equal(geojson, rest) | |
## [1] "Cols in y but not x: `geoms`. " "Cols in x but not y: `geometry`. " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment