All Questions
Tagged with affine-transformation python
39 questions
0
votes
0
answers
58
views
Rasterio affine transform pixel size meaning
I'm using calculate_default_transform and reproject from rasterio.warp to transform geotiff file from one coordinate reference system (EPSG:25832) to another (EPSG:3857). As a result the pixel size ...
1
vote
1
answer
40
views
Shifting points of LAZ point cloud using Python
I want to shift the coordinates of a .laz pointcloud by tx, and ty with laspy. After reading more about the offset and scale attributes of a las header.
I see that Xcoordinate = (Xrecord * Xscale) + ...
0
votes
0
answers
99
views
Convert a homogenous matrix from xyz coordinate system to zyx coordinate system
I want to change my camera pose from xyz coordinate system(where x-forward direction, y left and z up) to zyx coordinate system ( z-forward y- down and x left)
My camera pose is described in an ...
1
vote
1
answer
487
views
Unexpected crsTransform after reducing an ImageCollection: nominal scale shows 111319.49079327357
I have created an Image from an Imagecollection and I want to export it and to define the crsTransform parameter. I have read the documentation and the post on this forum and tried to export it , and ...
5
votes
1
answer
367
views
Scaling linestrings gives incorrected final scale
I have a shapefile with about 5000 line strings. I am translating and scaling this file using GeoPandas:
import geopandas
green = geopandas.read_file('./shapefiles/unnamed (1)_green.shp')
The ...
2
votes
0
answers
455
views
How to use an affine transformation pipepline with GDAL Python API?
I am trying to transform coordinates from a local grid to a projected coordinate system (UTM) to ultimately reproject raster or vector data.
I am using :
Python 3.9
GDAL 3.6.0
Pyproj 3.4
I generated ...
2
votes
1
answer
1k
views
Scaling rotated rectangle in Shapely
I have a Polygon which looks like this
It's a minimum-oriented bounding box for the LineString geometry contained within it, I generated it using QGIS. Actually, there are many more of these, but let'...
1
vote
0
answers
463
views
rasterio.plot gives different shape using extent after transformation
I plot the following tiff
I plot it using
import matplotlib.pyplot as plt
from rasterio import plot
def plot(self) -> None:
fig, ax = plt.subplots(1, figsize=(10, 7))
ax.ticklabel_format(...
1
vote
0
answers
654
views
Change the origin point of the GeoTIFF files using Rasterio
I created a GeoTIFF file in Python (v3.8) using Rasterio (v1.2.10). The upper left corner is defined as the GeoTIFF file's origin point, which causes some difficulties in subsequent steps. Is there ...
0
votes
1
answer
106
views
Mismatch between Google Earth and RasterIO Transform
I imported an image from a Arc GIS REST Map service and the dimensions of the image as projected don't match the transform, but they do line up correctly in Google Earth with the expected building. ...
1
vote
1
answer
907
views
Georeference and rotate an image using GDAL and Python
I have a drone image with no spatial reference (ungeoreferenced). I know from some calculations the coordinates of the upper left corner, and X and Y resolutions. I was able to georeference the image ...
1
vote
0
answers
60
views
How to get the transformation for a georeferenced dataset in azimuthal equidistant projection using rasterio
I have a squared Numpy array with data. I also have both squared arrays of the same shape with lat and lon. I also know the projection used by this data, an azimuthal equidistant with known center ...
0
votes
1
answer
280
views
Transforming GPM Precip Data using rioxarray
I am working with GPM Precip data on a hydrologic study and I am having a hard time figuring out why the netcdf files I downloaded are giving me issues when I try and map the data.
I am still learning ...
2
votes
3
answers
2k
views
Get the geo-coordinates of a point from a pixel
I need to get the geo-coordinates of a point from a pixel GeoTiff.
I am using the following code:
import gdal
from affine import Affine
# open the dataset and get the geo transform matrix
ds = gdal....
0
votes
1
answer
384
views
Projected coordinates points rotating horizontally
I have this Sentinel-2 picture that uses the WGS84 UTM zone 23S as projection type. My picture is rescaled to 3413 by 4741. My objective is to transform the X and Y pixels to EPSG 32723 and then from ...
8
votes
1
answer
2k
views
How to find a particular coordinate on a Sentinel image using proj:transform?
Background
I am retrieving images from the Sentinel satellites. I plot these images, using pixel coordinates. I would like to show points specified using latitude and longitude on those images.
Data ...
2
votes
1
answer
78
views
Wrong transform after interpolating points
Following this post, I'ms trugglig wwith interpolation and projection of set of points. I have used griddata in order to interpolate, and seems like interpolation hapenns, however, the results look ...
2
votes
1
answer
5k
views
Get the correct transform from bounding box with Rasterio
I have image as numpy array with no projection or geographical data and I have information of the bouding box of this numpy array (the image suppose to match perfectly the bbox).
The bbox is ...
2
votes
1
answer
1k
views
How to get the affine matrix between 2 projection using pyproj?
I'm struggling getting the affine matrix (or crs_transform) using pyproj. The Transformerobject is full of functions to actually transform coordinates but I just want to check the matrix:
I'm stuck ...
3
votes
0
answers
2k
views
Getting extents of raster with GeoTransform
I'm trying to better understand GeoTransform. For getting the extents of a raster, I've seen solutions posted such as below. But doesn't this only account for perfectly square rasters? From my ...
2
votes
1
answer
2k
views
Getting geo transforms (affine) without a TIFF reference image
I have a binary mask with buildings' footprints.
What I have is a latitude and longitude of the center of my image and I want to georeference each polygon first.
And here is what I have done before:
...
3
votes
1
answer
14k
views
Defining Affine transform with rasterio
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 ...
3
votes
1
answer
272
views
rasterio reprojection produces no visible changes
I've been trying to perform translation of a raster using the reproject function from rasterio.warp.
I've calculated the translation amount in X and Y from a series of "control points" ...
0
votes
1
answer
3k
views
Using "raster.transform" function of "rasterio" in Python
When I execute the "raster.transform" function in Python it returns me a matrix.
What I can understand is that it tells me my data has a 10 m pixel resolution,
It also tells me that my left ...
1
vote
1
answer
2k
views
Apply same coordinate system to raster image and GeoJSON with rasterio
I have a dataset containing raster images and corresponding features in geojson files. I would like to use rasterio.features.rasterize to create a footprint image of the features on the raster image, ...
3
votes
1
answer
1k
views
Spatial transformation of latitudes and longitudes that preserve distances between points
I have a set of lat,lon points.
I would like to apply a spatial transformation (rotate, translate) to place these points somewhere else on the earth surface (for anonymization purposes), but preserve ...
5
votes
1
answer
3k
views
Shapely affine transformations with bounds of GeoDataFrame
I understand that I can use Shapely's affinity.translate to translate a geometry like the below:
from shapely import affinity
from shapely.geometry import Polygon
poly = Polygon([(0, 0), (1, 0), (1, ...
2
votes
1
answer
2k
views
How to calculate affine transformation by Python gdal as same as gdal_translate?
I've made a python script which tries to reproduce what gdal_translate does (given a bounding box BBOX in EPSG:4326 and an UTM32 .jp2 file. Then, translates the BBOX from EPSG:4326 to EPSG:32632 (...
2
votes
0
answers
218
views
Raster shapes are not exactly equal after cropping
I clipped multiple rasters to the shape of a polygon shapefile.
But, the output rasters do not have exactly the same shapes. I am doing correlation analyses per pixel so I need the array shapes to ...
1
vote
1
answer
553
views
Creating Affine for 2D Linear Transformation of Fixed Bounding Box
I am currently trying to create an Affine which can transform data from longitude and latitude to a custom CRS that a client is using. Unfortunately the person who originally made this CRS has left ...
5
votes
1
answer
2k
views
Which affine format to use in Rasterstats zonal_stats?
I am working with the Rasterstats package to run zonal statistics on two raster datasets. The documentation calls for the following:
import rasterio
from rasterstats import zonal_stats
with rasterio....
2
votes
0
answers
767
views
Reprojection problem with Rasterio
I have already processed so far NDSI map by using Rrasterio, NumPy, os and matplotlib.pyplot for plotting the data.
Now, I would like to eliminate permanent ice from NDSI map. I am facing one major ...
2
votes
1
answer
3k
views
Transform coordinates from custom projection to lat long PyProj
I am trying to convert a pair of coordinates specified in US survey feet on a custom transverse mercator projection to lat/long using PyProj. I must be doing something wrong because I cannot get the ...
4
votes
2
answers
5k
views
Using shapely.affinity and affine_transform?
I have shapely.geometry Point:
from shapely.geometry import Point
point1 = Point(0, 100, 200)
and I want to swap coordinates Y and Z:
from shapely.affinity import affine_transform
matrix = [1,0,0, ...
3
votes
0
answers
550
views
Why can't I transpose a raster across the pole with rasterio or gdal, and how could it be done?
I have a raster in e.g epsg:4326, it covers all world, from 180E to 180W, from 90S to 90N. I want to re-project a part of it to epsg:3031 and also change the grid size and resolution.
Here is a ...
0
votes
0
answers
74
views
Affine transformation of different sized polygons layer to equal area units
I would like to transform a layer of polygons of different sizearea to become equal in areasize. I have QGIS 2.18 and GRASS GIS 7 available and some basic Python knowledge. Does anyone have an idea of ...
4
votes
1
answer
5k
views
How do I change a raster's geotransform with GDAL?
I'm trying to use GDAL to set the geotransform of a new raster that I've created by following the steps outlined in the GDAL API Tutorial.
# create the new dataset
driver = gdal.GetDriverByName('GTiff'...
3
votes
3
answers
5k
views
How to translate (reposition) a raster in Python?
I tried to use QGIS GeoReferencer to translate a raster layer, but somehow failed. It just goes to somewhere unexpected.
Now I decide to do it myself, with python. I think some libraries like GDAL ...
15
votes
5
answers
15k
views
Python, shapely library: is it possible to do an affine operation on shape polygon?
I am trying to create a rotated rectangle in lat/lon coordinates.
Basically, I have the coordinates of the center and rotation angle around the center.
Is it possible to do using, shapely or gdal, ...