Closed grcolli closed 4 years ago
@grcolli thanks very much for this report. I think I've fixed it, if you get a chance can you please try out the development version by installing from here:
# install.packages("remotes")
remotes::install_github("ateucher/rmapshaper")
library(rmapshaper)
Hi Andy, thanks a lot for your prompt response. I reran the code but apparently the issue was not solve (see below). I'm ready to help and provide any additional info deemed necessary. Cheers, G.
remove(list = ls())
Load packages
library(iterators) library(magrittr) setwd("~/GitHub/COVID-19")
Make sure working directory has been correctly set before running this!
my.dir <- paste(getwd(), "/", sep = "")
Load shape files
shape_municipios <-
- rgdal::readOGR(paste(my.dir, "data/shape_municipios/BRMUE250GC_SIR.shp", sep = ""),
- stringsAsFactors = F) OGR data source with driver: ESRI Shapefile Source: "C:\Users\Guarino R. Colli\Documents\GitHub\COVID-19\data\shape_municipios\BRMUE250GC_SIR.shp", layer: "BRMUE250GC_SIR" with 5572 features It has 2 fields
Simplify shape files with rmapshaper
Make sure mapshaper is installed in system
shape_municipios_simp <- rmapshaper::ms_simplify(shape_municipios, sys = T) Error: [o] Command expects a single value. Received: C:\Users\Guarino R. Colli\AppData\Local\Temp\RtmpeAV1bp\file5cd4186c1b71.geojson Run mapshaper -h to view help Error: Cannot open "C:\Users\Guarino R. Colli\AppData\Local\Temp\RtmpeAV1bp\file5cd4186c1b71.geojson"; The file doesn't seem to exist.
Andy, my bad. After installing the development version of rmapshaper, the code ran smoothly! Thanks a lot. Best, G.
Simplify shape files with rmapshaper
Make sure mapshaper is installed in system
shape_municipios_simp <- rmapshaper::ms_simplify(shape_municipios, sys = T) [i] Snapped 40638 points [simplify] Repaired 23 intersections [filter] Retained 5,572 of 5,572 features [o] Wrote C:\Users\Guarino R. Colli\AppData\Local\Temp\RtmpkhLjym\file62482e77698e.geojson
Oh excellent! I was scratching my head, as I was sure my patch would fix it. Thanks for trying again and reporting back
One more unrelated thought @grcolli - it's generally a bit risky to post the output of Sys.getenv()
as many people store sensitive info such as authorization tokens there. Yours looked safe enough, but I hope you don't mind I removed it from your comment.
Thanks Andy. Will be more careful next time!
From other forums, the issue is related to a username (and directory names) with spaces. Is there a way around this, other than creating a new user? Thanks, Guarino.
[output of
Sys.getenv()
deleted by @ateucher]