walkerke / mapboxapi

R interface to Mapbox web services
https://walker-data.com/mapboxapi/
Other
109 stars 8 forks source link

tippecanoe function with Windows 10 #7

Closed a-brasch closed 2 years ago

a-brasch commented 3 years ago

I'm having an issue using the tippecanoe() function. I am running R via a Windows 10 machine and understand that that is a bit problematic for tippecanoe; however, I followed the "Installing tippecanoe on Windows [with Cygwin]" instructions in this ArcGIS2Mapbox GitHub article. Nonetheless, I am running into an error in R: "tippecanoe is not installed. Please visit https://github.com/mapbox/tippecanoe for installation instructions."

I assume this has something to do with tippecanoe needing to be run through the Cygwin emulator, but I am not running R in that environment (full disclosure: I'm novice when it comes to emulators and other operating systems).

Also note that I came across another possible way to install tippecanoe on Windows using Ubuntu Linux Bash shell

walkerke commented 3 years ago

Thanks for the note! I'd like to get this working if it is possible. mapboxapi's tippecanoe "wrapper" isn't really a wrapper per se given how tippecanoe works; instead it uses system() and stitches together command-line arguments from R arguments. However, I don't believe system() works on Windows.

I'll try this out on my Windows machine and see what we can get working!

sth-new commented 2 years ago

Hi All! Were you ever able to find a solution to this just out of curiosity? I have encountered the same issue ;-/ I installed tippecanoe via Ubuntu (running tippecanoe --version in Ubuntu returns tippecanoe v1.36.0), but when I try to use the tippecanoe() function in R I get the error code "tippecanoe is not installed. Please visit https://github.com/mapbox/tippecanoe for installation instructions." I couldn't find anything else about this issue online and would appreciate any guidance -- thanks so much :-)

a-brasch commented 2 years ago

I was never able to solve, sorry.

walkerke commented 2 years ago

@sth-new Hmm - I can't reproduce on Ubuntu. What happens in R when you run system("tippecanoe -v")?

@a-brasch sorry - I haven't been using a Windows computer for a while. I just got a new one and I'm going to try to get this working on the Windows side.

sth-new commented 2 years ago

Hi @walkerke, I just had the chance to come back to this so apologies for the late reply! When I run system("tippecanoe -v") I get syntax error near unexpected token "tippecanoe -v"' but if I just run tippecanoe -v, it returns tippecanoe v1.36.0.

So it does seem that it's installed, but when I try to use the tippecanoe() mapboxapi function in R I get the error code Error: tippecanoe is not installed. Please visit https://github.com/mapbox/tippecanoe for installation instructions. ;-/

walkerke commented 2 years ago

@a-brasch @sth-new @mrworthington -

I've been digging on this and it appears to be an RStudio issue beyond the scope of mapboxapi. In certain cases (and honestly I'm not entirely sure which ones), the output of Sys.getenv("PATH") is different in RStudio than it is outside of RStudio.

I was able to resolve this by copying the printed PATH outside my RStudio then running Sys.setenv(PATH = "xyz") where "xyz" was the printed PATH. mapboxapi::tippecanoe() then ran as expected. Presumably this could be set in a user's .Renviron.

I'm leaning toward not resolving this issue on the mapboxapi side and instead printing instructions on how to do this if tippecanoe() errors as I don't want to mess with users' PATHs.

walkerke commented 2 years ago

I'm resolving this with the following error message:

Error in `tippecanoe()`:
! tippecanoe is not installed or cannot be found by the application you are using to run mapboxapi.
• If you haven't installed tippecanoe, please visit https://github.com/mapbox/tippecanoe for installation instructions.
• If you have installed tippecanoe, run `Sys.getenv('PATH')` and make sure your application can find tippecanoe. If it cannot, adjust your PATH accordingly.
Run `rlang::last_error()` to see where the error occurred.
a-brasch commented 2 years ago

Much appreciated @walkerke!