Getting add_raster to work in a remote host in vscode: port forwarding.
#677
lopezvoliver
started this conversation in
Show and tell
Replies: 2 comments
|
Thank you for sharing the solution! That's very help. I am going to pin the discussion at the top so that others can learn from this. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
I usually work with vscode and connect to a remote server.
I had some initial trouble getting
add_rasterto work for me in this setup, so I will share here what ended up working for me.In a nutshell,
add_rasterleverages localtileserver, and one of the keyword arguments that can get passed on to it is theportnumber:In my experience, vscode typically does a good job of automatically forwarding ports opened by your applications. However, in my case this wasn't working and my raster didn't get displayed on the map. You can manually forward the port, but if you didn't specify a port number to use, how do you figure out which one was opened?
One solution is to print the layer url:
where
mis yourleafmap.Mapandm.layers[1]is a layer you added usingadd_raster. This will print something like:in this case the port number is 34389. Then you can manually forward it using vscode's
Forward a Portcommand:After this, try moving the map or zooming in/out and hopefully you will now start to see some tiles show up in the map.
A simpler solution is to first manually forward a port (e.g. 7778) and specify it in
add_raster(..., port=port).All reactions