Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projection extension best practices? #976

Closed
cholmes opened this issue Feb 8, 2021 · 3 comments
Closed

projection extension best practices? #976

cholmes opened this issue Feb 8, 2021 · 3 comments
Assignees
Labels
prio: should-have would be very good to have in the release
Milestone

Comments

@cholmes
Copy link
Contributor

cholmes commented Feb 8, 2021

I'd like to include proj shape and transform in one of the examples, and I realized I have no idea how to generate that.

Which makes me think we should have a best practice recommending the use of 'proj', and why it's good to include shape and transform - so that virtual catalogs don't have to open the geotiff (in my understanding). And how to generate it.

Is there a rasterio and/or gdal command that can get it for me easily?

@cholmes cholmes added the prio: should-have would be very good to have in the release label Feb 8, 2021
@cholmes cholmes added this to the 1.0.0-RC.1 milestone Feb 8, 2021
@cholmes cholmes mentioned this issue Feb 8, 2021
12 tasks
@kylebarron
Copy link
Contributor

They're both included as part of the rio info command. To use a 6-item transform you just discard the last three numbers.

> export AWS_REQUEST_PAYER="requester"
> rio info s3://usgs-landsat/collection02/level-2/standard/oli-tirs/2020/072/076/LC08_L2SR_072076_20201203_20201218_02_T2/LC08_L2SR_072076_20201203_20201218_02_T2_SR_B1.TIF | jq
{
  "blockxsize": 256,
  "blockysize": 256,
  "bounds": [
    142185,
    -2673615,
    369915,
    -2442885
  ],
  "colorinterp": [
    "gray"
  ],
  "compress": "deflate",
  "count": 1,
  "crs": "EPSG:32601",
  "descriptions": [
    null
  ],
  "driver": "GTiff",
  "dtype": "uint16",
  "height": 7691,
  "indexes": [
    1
  ],
  "interleave": "band",
  "lnglat": [
    -179.3819753343787,
    -23.115073747911566
  ],
  "mask_flags": [
    [
      "nodata"
    ]
  ],
  "nodata": 0,
  "res": [
    30,
    30
  ],
  "shape": [
    7691,
    7591
  ],
  "tiled": true,
  "transform": [
    30,
    0,
    142185,
    0,
    -30,
    -2442885,
    0,
    0,
    1
  ],
  "units": [
    null
  ],
  "width": 7591
}

@cholmes cholmes assigned cholmes and unassigned matthewhanson Feb 8, 2021
@cholmes
Copy link
Contributor Author

cholmes commented Feb 8, 2021

Sweet, thanks @kylebarron! That's easy. Just updated my example 1f1023e

Will write this up and add it. If there are other tools (gdal, etc) that others know let me know and I can add them too.

@kylebarron
Copy link
Contributor

gdalinfo also prints related information, though it doesn't give the transform directly. From the gdalinfo output you could construct the transform using the origin and pixel size.

> gdalinfo /vsis3/usgs-landsat/collection02/level-2/standard/oli-tirs/2020/072/076/LC08_L2SR_072076_20201203_20201218_02_T2/LC08_L2SR_072076_20201203_20201218_02_T2_SR_B1.TIF
Driver: GTiff/GeoTIFF
Files: /vsis3/usgs-landsat/collection02/level-2/standard/oli-tirs/2020/072/076/LC08_L2SR_072076_20201203_20201218_02_T2/LC08_L2SR_072076_20201203_20201218_02_T2_SR_B1.TIF
Size is 7591, 7691
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 1N",
    BASEGEOGCRS["WGS 84",
        DATUM["World Geodetic System 1984",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4326]],
    CONVERSION["UTM zone 1N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",-177,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["Engineering survey, topographic mapping."],
        AREA["Between 180°W and 174°W, northern hemisphere between equator and 84°N, onshore and offshore. Russian Federation; United States (USA) - Alaska (AK)."],
        BBOX[0,-180,84,-174]],
    ID["EPSG",32601]]
Data axis to CRS axis mapping: 1,2
Origin = (142185.000000000000000,-2442885.000000000000000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Metadata:
  AREA_OR_POINT=Point
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  142185.000,-2442885.000) (179d32' 1.37"E, 22d 3'14.84"S)
Lower Left  (  142185.000,-2673615.000) (179d28'47.50"E, 24d 8' 4.17"S)
Upper Right (  369915.000,-2442885.000) (178d15'39.41"W, 22d 5' 9.62"S)
Lower Right (  369915.000,-2673615.000) (178d16'50.09"W, 24d10'11.08"S)
Center      (  256050.000,-2558250.000) (179d22'55.11"W, 23d 6'54.27"S)
Band 1 Block=256x256 Type=UInt16, ColorInterp=Gray
  NoData Value=0
  Overviews: 3796x3846, 1898x1923, 949x962, 475x481, 238x241, 119x121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: should-have would be very good to have in the release
Projects
None yet
Development

No branches or pull requests

3 participants