Giter VIP home page Giter VIP logo

Comments (8)

Nowosad avatar Nowosad commented on June 12, 2024

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.

Robinlovelace avatar Robinlovelace commented on June 12, 2024

Works fine for me too so closing for now.

from geocompr.

manab-prakash avatar manab-prakash commented on June 12, 2024

from geocompr.

Nowosad avatar Nowosad commented on June 12, 2024

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.

Robinlovelace avatar Robinlovelace commented on June 12, 2024

rmapshaper::ms_simplify(us_states, keep = 0.01,+

Could the + be an issue?

from geocompr.

manab-prakash avatar manab-prakash commented on June 12, 2024

from geocompr.

Nowosad avatar Nowosad commented on June 12, 2024

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.

manab-prakash avatar manab-prakash commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.