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. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Another solution is to use the command which will open a window like this: In this example you can identify that the port is 39421. Then you can forward it and you will see the tiles on the map. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I usually work with vscode and connect to a remote server.
I had some initial trouble getting
add_raster
to work for me in this setup, so I will share here what ended up working for me.In a nutshell,
add_raster
leverages localtileserver, and one of the keyword arguments that can get passed on to it is theport
number: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
m
is yourleafmap.Map
andm.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 Port
command: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)
.Beta Was this translation helpful? Give feedback.
All reactions