GeographicaGS / Docker-GDAL2

GDAL 2.x Docker images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ENV ROOTDIR /usr/local/

opened this issue · comments

I'm not 100% sure, I'm using "GeographicaGS/Docker-GDAL2" image entirely as intended, but there seems to be an issue in the DockerFile with the "ENV ROOTDIR /usr/local/" syntax.

I say this because, I set my "DataFolder" as data volume with this line:
$ export DATAFOLDER="-v /folder_with_your_testdata/:/home/datafolder"

but when I run the image:
$ docker run $DATAFOLDER --name gdal2 -it --rm geographica/gdal2:2.2.2 /bin/bash

the default (Bash) directory is "user/local". Only when I cd to "/home/datafolder" can I perform a command such as "gdalinfo test.tif" and it correctly find the file. So - shouldn't the ENV ROOTDIR be: "ENV ROOTDIR /home/datafolder/", or is this done for some other reason?

Hi @RMuellerJr,

First of all thank you for using the repository.

ROOTDIR env is pointed to /usr/local to use in image building process. I think is not a good idea to change it (it is a fairly standard location).

To run GDAL commands the best option is in this way (follow this real example):

  1. Set your data folder:
    $ export DATAFOLDER="-v /home/cayetano/Descargas/sharks/:/home/datafolder/"

  2. Run a GDAL command from your own shell (it isn't necessary to enter inside container):
    $ docker run $DATAFOLDER --name gdal2 -it --rm geographica/gdal2:2.2.2 gdalinfo /home/datafolder/griddd_43261.tif

  3. Real output in your own shell:

Files: /home/datafolder/griddd_43261.tif
       /home/datafolder/griddd_43261.tif.ovr
       /home/datafolder/griddd_43261.tif.aux.xml
Size is 411, 154
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-5.387576416282009,45.856675997023615)
Pixel Size = (0.101479019093525,-0.101479019093525)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  -5.3875764,  45.8566760) (  5d23'15.28"W, 45d51'24.03"N)
Lower Left  (  -5.3875764,  30.2289071) (  5d23'15.28"W, 30d13'44.07"N)
Upper Right (  36.3203004,  45.8566760) ( 36d19'13.08"E, 45d51'24.03"N)
Lower Right (  36.3203004,  30.2289071) ( 36d19'13.08"E, 30d13'44.07"N)
Center      (  15.4663620,  38.0427915) ( 15d27'58.90"E, 38d 2'34.05"N)
Band 1 Block=128x128 Type=Int32, ColorInterp=Gray
  Min=1.000 Max=12.000 
  Minimum=1.000, Maximum=12.000, Mean=5.387, StdDev=2.568
  NoData Value=2147483647
  Overviews: 206x77
  Metadata:
    STATISTICS_COVARIANCES=6,59611598927392
    STATISTICS_MAXIMUM=12
    STATISTICS_MEAN=5.3872151497304
    STATISTICS_MINIMUM=1
    STATISTICS_SKIPFACTORX=1
    STATISTICS_SKIPFACTORY=1
    STATISTICS_STDDEV=2.5682323020705```

cayetanobv- Thanks for the prompt reply! I was still having intermittent success accessing the data folder, even with your advice above. I was finally able to get things to work after addressing the data availability and how the volume was being mapped.

I found a link that indicated this problem, and looked a little further into VirtualBox (settings/Shared Folders) and saw my C:/Users wasn't mapped correctly. I did some testing to get this path to work, and now modified to use (a more appropriate) D drive instead.

Thanks for the feedback! Hopefully this will help someone else.
-Bob