ateucher / rmapshaper

An R wrapper for the mapshaper javascript library
http://andyteucher.ca/rmapshaper/
Other
200 stars 13 forks source link

ms_clip() returns "Error: SyntaxError: Unexpected token ." #159

Closed lewkrr closed 1 year ago

lewkrr commented 1 year ago

Whenever I attempt to use the ms_clip(), I get the message "Error: SyntaxError: Unexpected token ." I even ran the Examples code directly from the documentation, and I still get the same error message.

Below is my session info. Please advise if there is an fix. Cheers!

> sessionInfo()

R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] stringi_1.7.12     openxlsx_4.2.5.2   geojsonsf_2.0.3    terra_1.7-23       areal_0.1.8        RColorBrewer_1.1-3 rasterVis_0.51.5  
 [8] lattice_0.21-8     sp_1.6-0           leaflet_2.1.2      tmap_3.3-3         rmapshaper_0.5.0   tigris_2.0.1       sf_1.0-12         
[15] flextable_0.9.1    tidyUSDA_0.4.0     lehdr_1.1.1        censusapi_0.8.0    ipumsr_0.5.2       tidycensus_1.3.2   readxl_1.4.2      
[22] lubridate_1.9.2    forcats_1.0.0      stringr_1.5.0      dplyr_1.1.2        purrr_1.0.1        readr_2.1.4        tidyr_1.3.0       
[29] tibble_3.2.1       ggplot2_3.4.2      tidyverse_2.0.0    magrittr_2.0.3    

loaded via a namespace (and not attached):
  [1] leafem_0.2.0            colorspace_2.1-0        deldir_1.0-6            ellipsis_0.3.2          class_7.3-21            rgdal_1.6-6            
  [7] base64enc_0.1-3         dichromat_2.0-0.1       httpcode_0.3.0          rstudioapi_0.14         proxy_0.4-27            hexbin_1.28.3          
 [13] bit64_4.0.5             fansi_1.0.4             xml2_1.3.3              codetools_0.2-19        cachem_1.0.7            knitr_1.42             
 [19] zeallot_0.1.0           jsonlite_1.8.4          tmaptools_3.1-1         png_0.1-8               shiny_1.7.4             compiler_4.1.3         
 [25] httr_1.4.5              fastmap_1.1.1           cli_3.6.1               s2_1.1.2                later_1.3.0             leaflet.providers_1.9.0
 [31] htmltools_0.5.5         tools_4.1.3             gtable_0.3.3            glue_1.6.2              wk_0.7.2                rappdirs_0.3.3         
 [37] V8_4.3.0                Rcpp_1.0.10             raster_3.6-20           cellranger_1.1.0        jquerylib_0.1.4         fontquiver_0.2.1       
 [43] vctrs_0.6.1             crul_1.3                leafsync_0.1.0          crosstalk_1.2.0         lwgeom_0.2-11           xfun_0.39              
 [49] rvest_1.0.3             timechange_0.2.0        mime_0.12               lifecycle_1.0.3         XML_3.99-0.14           zoo_1.8-12             
 [55] scales_1.2.1            vroom_1.6.1             ragg_1.2.5              hms_1.1.3               promises_1.2.0.1        parallel_4.1.3         
 [61] fontLiberation_0.1.0    yaml_2.3.7              curl_5.0.0              gdtools_0.3.3           sass_0.4.5              latticeExtra_0.6-30    
 [67] fontBitstreamVera_0.1.1 e1071_1.7-13            zip_2.3.0               rlang_1.1.0             pkgconfig_2.0.3         systemfonts_1.0.4      
 [73] evaluate_0.20           htmlwidgets_1.6.2       bit_4.0.5               tidyselect_1.2.0        R6_2.5.1                generics_0.1.3         
 [79] DBI_1.1.3               pillar_1.9.0            haven_2.5.2             withr_2.5.0             units_0.8-1             stars_0.6-1            
 [85] abind_1.4-5             crayon_1.5.2            gfonts_0.2.0            interp_1.1-4            uuid_1.1-0              KernSmooth_2.23-20     
 [91] utf8_1.2.3              tzdb_0.3.0              rmarkdown_2.21          officer_0.6.2           jpeg_0.1-10             grid_4.1.3             
 [97] data.table_1.14.8       digest_0.6.31           classInt_0.4-9          xtable_1.8-4            httpuv_1.6.9            textshaping_0.3.6      
[103] openssl_2.0.6           munsell_0.5.0           viridisLite_0.4.2       bslib_0.4.2             askpass_1.1  
lewkrr commented 1 year ago

Here is the traceback given by the documentation's example, in case it's helpful.

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. mapshaper_clip_erase(target_layer = target_geojson, overlay_layer = overlay_geojson,
                     type = type, remove_slivers = remove_slivers, bbox = bbox,
                     force_FC = TRUE, sys = sys, sys_mem = sys_mem)
3. clip_erase_sf(target = target, overlay_layer = clip, type = "clip",
              remove_slivers = remove_slivers, bbox = bbox, ...)
2. ms_clip.sf(poly, clip_poly)
1. ms_clip(poly, clip_poly)
ateucher commented 1 year ago

Thanks. Closing to consolidate in #157

ateucher commented 1 year ago

Can you please report the output of: V8::engine_info()