-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ms_simplify 0.4.1 aborts R session #83
Comments
Hi Fabio, Thanks for the report, I can reproduce this and will investigage. Interestingly, this works with library(sf)
library(rmapshaper)
shp.mun.sf <- read_sf("BRMUE250GC_SIR.shp")
shp2 <- ms_simplify(shp.mun) |
Hello Andy,
I tried through sf. It took a while but worked.
However, when fortifying it through broom::tidy(), it generated an error:
shp3 <- tidy(shp2) Error in is.data.frame(x) : (list) object cannot be
coerced to type 'double' In addition: Warning messages: 1:
'tidy.data.frame' is deprecated. See help("Deprecated") 2: In
mean.default(X[[i]], ...) : argument is not numeric or logical:
returning NA 3: In mean.default(X[[i]], ...) : argument is not numeric
or logical: returning NA 4: In mean.default(X[[i]], ...) : argument is
not numeric or logical: returning NA 5: In var(if (is.vector(x) ||
is.factor(x)) x else as.double(x), na.rm = na.rm) : NAs introduced by
coercion
Note that I am able to fortify either when 1) I use gSimplify, or 2)
when I use a smaller map with ms_simplify at
https://1drv.ms/f/s!Av16Xvc5Na3NgrgmU16K-7FG0hN35g
Kind regards,
Fabio Corrêa
Em 27/11/2018 21:39, Andy Teucher escreveu:
…
Hi Fabio,
Thanks for the report, I can reproduce this and will investigage.
Interestingly, this works with |sf|:
library(sf)
library(rmapshaper)
shp.mun.sf <- read_sf("BRMUE250GC_SIR.shp")
shp2 <- ms_simplify(shp.mun)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjqJCaNnOumO2AhK5DYOjmH60iEr-sGLks5uzc0ZgaJpZM4YzhsM>.
---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus
|
Yes, an I recommend checking out the If you want to stay with library(rgdal)
library(sf)
library(rmapshaper)
library(broom)
shp_sp <- readOGR(".", "BRMUE250GC_SIR", stringsAsFactors = FALSE, encoding = "UTF-8")
shp_sf <- st_as_sf(shp_sp)
shp2_sf <- ms_simplify(shp_sf)
shp2_sp <- as(shp2_sf, "Spatial")
shp_tidy <- tidy(shp2_sp) I will look at why it is crashing, but this should work in the meantime... |
Thank you Andy, learning a lot with you.
Best regards,
Fábio
…On Wed, Nov 28, 2018, 03:15 Andy Teucher ***@***.*** wrote:
Yes, an sf object is an entirely different beast than a "Spatial" object
from package sp, and there is no tidy method for sf objects.
I recommend checking out the sf package, and plotting sf objects directly
with ggplot2 via geom_sf (I'm just guessing that's why you want to
fortify).
If you want to stay with sp "Spatial" objects, a work-around is to
convert to sf, run it through ms_simplify(), and then back to "Spatial":
library(rgdal)
library(sf)
library(rmapshaper)
library(broom)shp_sp <- readOGR(".", "BRMUE250GC_SIR", stringsAsFactors = FALSE, encoding = "UTF-8")shp_sf <- st_as_sf(shp_sp)shp2_sf <- ms_simplify(shp_sf)shp2_sp <- as(shp2_sf, "Spatial")shp_tidy <- tidy(shp2_sp)
I will look at why it is crashing, but this should work in the meantime...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjqJCTbEH_DGvmCS7MxHf69Zab90UYwnks5uzhv3gaJpZM4YzhsM>
.
|
My pleasure, thanks again for reporting this. |
Related perhaps. Also on version 0.4.1 my session aborts when simplifying the NTEM boundaries shape. See an example here
|
Thanks @fermm92 - it's due to the size of the spatial object and the memory limitations of You can use the |
Thanks for your answer @ateucher using |
Excellent, glad it worked! |
This should be fixed by #118 |
Hi,
When executing the following code, ms_simplify causes R to abort after about 2 minutes running.
The map file can be found here https://1drv.ms/f/s!Av16Xvc5Na3Ngr12e_gRbjyZXjyh4g
OBS 1): gSimplify can handle this map, thus I believe that map´s format is ok
OBS 2): I successfully simplified other maps using ms_simplify, so my rmapshaper version is supposedly ok and well installed.
Please let me know if you need additional clarification.
Regards Fabio
The text was updated successfully, but these errors were encountered: