[mapserver-users] How to use GDAL S3 drivers in MapServer?

Even Rouault even.rouault at spatialys.com
Wed Jun 8 10:51:41 PDT 2016


On Wednesday 08 June 2016 10:30:09 Hari Pradhan wrote:
> Hi All,
> 
> I have GeoTIFF images stored in Amazon S3, and want to access them directly
> from MapServer (without copying them to the machine where MapServer is
> running) to create a WMS service. I have watched a video by Mark Korver
> related to this topic (http://vimeo.com/106833852) in which he uses YAS3FS
> that mounts an S3 bucket as a local folder. But, I wonder if we could
> access those GeoTIFF from MapServer using GDAL S3 drivers (vsis3 or
> vsis3-streaming)?
> 
> I tried with a map file having a layer section something like the
> following, but no luck :(
> 
>  LAYER
>     NAME         landsat
>     DATA
> "/vsis3/landsat-pds/L8/001/003/LC80010032014272LGN00/LC80010032014272LGN00_B
> 1.TIF" STATUS       OFF
>     TYPE         RASTER
>     PROCESSING   "BANDS=1,2,3"
>   END
> 
> 
> Does anyone have any other ways to solve this problem?

/vsis3/ is only meant for buckets that require credentials. For public buckets like landsat-pds, you can just use /vsicurl/

/vsicurl/http://landsat-pds.s3.amazonaws.com/L8/001/003/LC80010032014272LGN00/LC80010032014272LGN00_B1.TIF

As this will try to probe a lot of potential side car files, you can define CPL_VSIL_CURL_ALLOWED_EXTENSIONS=".tif .ovr"
as environment variable to limit to just the ones that will exist in landsat-pds.

Try first with gdalinfo that it works before trying with mapserver.

$ CPL_VSIL_CURL_ALLOWED_EXTENSIONS=".tif .ovr" gdalinfo /vsicurl/http://landsat-pds.s3.amazonaws.com/L8/001/003/LC80010032014272LGN00/LC80010032014272LGN00_B1.TIF
Driver: GTiff/GeoTIFF
Files: /vsicurl/http://landsat-pds.s3.amazonaws.com/L8/001/003/LC80010032014272LGN00/LC80010032014272LGN00_B1.TIF
       /vsicurl/http://landsat-pds.s3.amazonaws.com/L8/001/003/LC80010032014272LGN00/LC80010032014272LGN00_B1.TIF.ovr
Size is 9131, 9121
Coordinate System is:
PROJCS["WGS 84 / UTM zone 29N",
    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"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32629"]]
Origin = (330885.000000000000000,8920815.000000000000000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Metadata:
  AREA_OR_POINT=Point
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  330885.000, 8920815.000) ( 17d57'55.37"W, 80d14' 3.80"N)
Lower Left  (  330885.000, 8647185.000) ( 16d11'23.20"W, 77d48'24.17"N)
Upper Right (  604815.000, 8920815.000) (  3d24'56.67"W, 80d18'22.74"N)
Lower Right (  604815.000, 8647185.000) (  4d31'47.12"W, 77d51'50.18"N)
Center      (  467850.000, 8784000.000) ( 10d31'34.26"W, 79d 7'18.85"N)
Band 1 Block=512x512 Type=UInt16, ColorInterp=Gray
  Overviews: 3044x3041, 1015x1014, 339x338, 113x113


Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



More information about the MapServer-users mailing list