Skip to main content
edited title
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Define Defining Affine transform with rasterio

Post Reopened by Ian Turton
added 322 characters in body
Source Link
ReutKeller
  • 2.2k
  • 4
  • 37
  • 91

I have the next transform (using sentinelhub functionvector that I have gotten from bbox.get_transform_vector()) with sentinelhub:

transform=bbox.get_transform_vector(10,10)
>>>
(-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

The type of this affine vector is tuple:

type(transform)

>>>tuple

I want to define this transform to be affine transform in rasterio, we.g to change it type to be affine.Affine a,so it will look like this type:

Affine((-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

meaningI haven't found any way to make my tuple (-101.7359960059834, 10.0, 0, 20.8312118894487, 0change it, -10I have tried:

#try1
Affine(transform)

#try2
affine(transform)

but obviously non of them work.0) int orasterio

I have also tried:

rasterio.transform.guard_transform(transform)

but then I get this error:

TypeError: GDAL-style transforms have been deprecated. This exception will be raised for a period of time to highlight potentially confusing errors, but will eventually be removed.

I still haven't found the way to create affine type from tuple.

How can I do that?My end goal: to get my tuple as type affine in rasterio

I have the next transform (using sentinelhub function bbox.get_transform_vector()) :

(-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

I want to define this transform to be affine transform in rasterio, w.g to be this type:

Affine((-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

meaning to make my tuple (-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0) int orasterio affine type.

How can I do that?

I have transform vector that I have gotten from bbox with sentinelhub:

transform=bbox.get_transform_vector(10,10)
>>>
(-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

The type of this affine vector is tuple:

type(transform)

>>>tuple

I want to define this transform to be affine transform in rasterio, e.g to change it type to be affine.Affine a,so it will look like this:

Affine((-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

I haven't found any way to change it, I have tried:

#try1
Affine(transform)

#try2
affine(transform)

but obviously non of them work.

I have also tried:

rasterio.transform.guard_transform(transform)

but then I get this error:

TypeError: GDAL-style transforms have been deprecated. This exception will be raised for a period of time to highlight potentially confusing errors, but will eventually be removed.

I still haven't found the way to create affine type from tuple.

My end goal: to get my tuple as type affine in rasterio

Post Closed as "Not suitable for this site" by Ian Turton
Source Link
ReutKeller
  • 2.2k
  • 4
  • 37
  • 91

Define Affine transform with rasterio

I have the next transform (using sentinelhub function bbox.get_transform_vector()) :

(-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

I want to define this transform to be affine transform in rasterio, w.g to be this type:

Affine((-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0)

meaning to make my tuple (-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0) int orasterio affine type.

How can I do that?