Comments (8)
Hi @manab-prakash -- I am unable to reproduce your issue. Please try to run the code below and let me know if it fails.
library(spData)
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.7.3, PROJ 9.2.1; sf_use_s2() is TRUE
us_states_simp2 = rmapshaper::ms_simplify(us_states, keep = 0.01,
keep_shapes = TRUE)
#> Warning in ms_de_unit(input): Coercing these 'units' columns to class numeric:
#> AREA
Created on 2024-03-09 with reprex v2.0.2
from geocompr.
Works fine for me too so closing for now.
from geocompr.
from geocompr.
Have you tried to run the code as one line? This error does not sound like an R error, but an external one...
library(spData)
library(sf)
us_states_simp2 = rmapshaper::ms_simplify(us_states, keep = 0.01, keep_shapes = TRUE)
from geocompr.
rmapshaper::ms_simplify(us_states, keep = 0.01,+
Could the + be an issue?
from geocompr.
from geocompr.
Another idea, @manab-prakash -- are you using the current source code of the book? We do not have an object us_states2163
anymore in the book...
from geocompr.
Yes, I tried the newer version too. The result is the same. The source of the error seems to be from C++. It is definitely not an issue from geocompr. The complete traceback is:
traceback()
10: stop(structure(list(message = "SyntaxError: Unexpected token '.'",
call = NULL, cppstack = NULL), class = c("std::invalid_argument",
"C++Error", "error", "condition")))
9: context_eval(join(src), private$context, serialize, await)
8: get_str_output(context_eval(join(src), private$context, serialize,
await))
7: evaluate_js(readLines(file, encoding = "UTF-8", warn = FALSE))
6: ctx$source(system.file("mapshaper/mapshaper-browserify.min.js",
package = "rmapshaper"))
5: ms_make_ctx()
4: apply_mapshaper_commands(data = geojson, command = call, force_FC = TRUE,
sys = sys, sys_mem = sys_mem, quiet = quiet)
3: ms_sf(input, call, ...)
2: ms_simplify.sf(us_states, keep = 0.01, keep_shapes = TRUE)
1: rmapshaper::ms_simplify(us_states, keep = 0.01, keep_shapes = TRUE)
from geocompr.
Related Issues (20)
- The **st_coordinates** will drop the decimal part. HOT 7
- Legends overlap objects in Figure 9.6 HOT 3
- Subsetting multilayer rasters with double brackets [[ ]] HOT 1
- Restructure data I/O chapter? HOT 10
- Additional information about Table 5.1 regarding geometry conversions might be needed HOT 5
- Add formula for resolution to Chapter 5 HOT 2
- GitHub API maxxed out HOT 7
- Update workflows to use r-universe
- Using write_sf() to add a new layer (8.4.1) HOT 7
- style argument for some tmap functions is deprecated HOT 4
- About contents HOT 3
- Ch. 5 Exercise #4 faulty solutions HOT 1
- Code fails in section 12.5.1 HOT 5
- Error in Section 8.9 HOT 1
- Proof-reading - RL
- Review Edition 2 RL II
- Move checked-in images in figures/ into images/'
- Reference error in text of section 2.2 HOT 1
- Reword content that relies on hyperlink HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geocompr.