2

I'm an amateur when it comes to the command line.

My problem is that the script I'm trying to run (rio) is in the Python\Python36-32\Scripts folder on my C:drive and I'm trying to run it using images found on my f:drive raid as input, but I cant seem to get the command to recognize the path to the imagery even when typing out the full path F:\imagery\input.tif. This command works fine when input.tif and out.tif are in the same dir as the script (Python\Python36-32\Scripts) but I want to be able to run this script on any directory I choose.

How can I achieve this?

I can run RIO from anywhere as I added the scripts folder to the path, so the problem is getting the command to recognize a different directory/drive for the input output. I already tried setting the F:\imagery directory to the path but that didn't work and my google searches are not turning up much for me as I am not to sure what to search for.

Here is the command:

rio color -d uint8 -j 1 input.tif out.tif sigmoidal rgb 2 0.35

and here is a link to rio (im using command line interface) https://github.com/mapbox/rio-color

and rasterio: https://github.com/mapbox/rasterio/blob/master/docs/cli.rst

  • What error message do you get? I assume you're on Windows, is that correct? Where are you specifying the full path to the images in your command? You shouldnt – Michael Stimson Jan 18 '18 at 22:53
  • I'm getting Error: Invalid value for "src_path": Path "F:\imagedirectory\input.tif" does not exist. – mapperdan Jan 18 '18 at 23:02
  • You shouldn't need to add F:\imagery to your %PATH% environment variable as this variable is for executable files (.com, .exe, .dll etc) not for where to look for data. If you have your %PATH% set correctly you could navigate to F:\Imagery in your DOS (CMD window) by typing F: (return) then CD F:\Imagery (return).. try to run your rio from there if it's having trouble with paths. By far the most common problem with full paths is SPACES, you have to quote your full path if it contains any spaces. Is your directory called imagery or imagerydirectory? Try drag 'n drop from explorer. – Michael Stimson Jan 18 '18 at 23:03
  • This is what im doing now. I launch up command prompt as admin, type F: to switch drives and then cd imagery which puts me into the correct dir. I can then run rio (which works), but like I said above it doesnt like the path to my input even though im running it on the F:drive. There are no spaces in any of my paths. – mapperdan Jan 18 '18 at 23:06
  • 1
    @MichaelStimson I figured out the issue..when I renamed my input.tif file earlier from its original name I accidentally included .tif in the end of its name.... so to use it as input in the f:\image directory I would have needed to type input.tif.tif I have it working now, but maybe you could help me with another question I have about the command line. How would I go about iterating a folder of tifs with this command? Thanks – mapperdan Jan 18 '18 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.