Questions tagged [affine-transformation]

An affine transformation is a 2-dimension cartesian transformation applied to both vector and raster data, which can rotate, shift, scale (even applying different factors on each axis) and skew geometries.

Filter by
Sorted by
Tagged with
5 votes
1 answer
78 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
64 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
241 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'...
  • 23
1 vote
0 answers
38 views

Combining affine transformations and COMPOUNDCRS

I have a need to define a WKT CRS which is both affine-transformed in 2D, and vertically shifted in the height direction. What I would like to say is something like this: COMPOUNDCRS["Modified ...
  • 153
1 vote
0 answers
103 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(...
  • 119
0 votes
0 answers
102 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
47 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. ...
  • 145
1 vote
0 answers
111 views

How to remove banding artifact in R after reprojecting sf with st_transform

I have several global map layers I am plotting using ggplot() + geom_sf() + etc. All data is "+proj=longlat +datum=WGS84 +no_defs". My goal is to have Eurasia be a contiguous land mass. This ...
  • 11
1 vote
0 answers
349 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 ...
0 votes
1 answer
384 views

GDAL coordinate transformation using C/C++ API (OGRCoordinateTransformation)

I'm in a puzzle of figuring out how to create correct coordinate transformations using GDAL C/C++ API. I have referenced code from tutorial - https://gdal.org/tutorials/osr_api_tut.html#coordinate-...
  • 103
1 vote
0 answers
39 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 ...
  • 327
0 votes
0 answers
174 views

How to efficiently find pixel coordinate in raster if affine transform is not, but coordinates of all pixels are given?

I have two 2D numpy arrays, one of them contains the latitudes, the other contains longitudes of a raster. For example: lats = \ np.array([[26.21965851, 26.21965851, 26.2196585 ], [26....
0 votes
1 answer
105 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 ...
  • 136
2 votes
3 answers
588 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....
2 votes
1 answer
133 views

Visually correcting systematic shift between two geodatasets using QGIS

The equivalent question has been asked wrt ArcMap, but I'm using QGIS and am also an inexperienced user. I have multiple rasters, provided as GeoTIFFs, that are all projected to the same custom CRS ...
1 vote
0 answers
98 views

Transforming raster with matrix

I would like to apply a similarity transformation matrix (potentially a homography matrix) on a valid raster (with proper CRS, resolution, bounds, width height, etc). The 1st image is the original ...
  • 220
0 votes
1 answer
227 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 ...
  • 53
0 votes
0 answers
75 views

How to convert an affine matrix setup in a metric coordinate system to a pseudo web mercator System

I have an affine matrix (with rotation and translation), which is setup in a local metric coordinate system. 1 0 0 10 M = 0 1 0 15 0 0 1 14 0 0 0 1 webMercPoint = (20000, 1000, 0) ...
  • 101
8 votes
1 answer
1k 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 ...
1 vote
0 answers
52 views

Custom Projection Definition - Excel Formula to ArcGIS Pro

I have been given an Excel formula for converting a custom projection coordinate point to a known defined system (state plane AZ East) I'm trying to get create a custom projection definition in ArcGIS ...
2 votes
1 answer
57 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 ...
  • 1,917
2 votes
1 answer
293 views

Custom-derived CRS by affine transformation from EPSG:32633: Setting as layer-CRS works only for current QGis-session. Information lost after restart

I am working with QGIS 3.16, Win10. With help of another SE-user I created several derived CRS by an affine transformation from EPSG:32633 CRS (see below) in order to shift some related layers a ...
  • 477
2 votes
1 answer
278 views

How do I find these values for an Affine Transformation (state plane to local grid)?

so I need to perform some kind of transformation. I have a bunch of points like so: <record id="Localization Points" > <record id="Point 1" > <value name="Lat&...
2 votes
0 answers
41 views

3D transformation of local points

I was wondering if anyone could assist me with a problem. Undertaking some archaeological excavations we use a laser level as a datum to take heights or Z values, the laser level is free floating and ...
  • 21
1 vote
1 answer
2k 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 ...
  • 1,917
1 vote
1 answer
511 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 ...
1 vote
0 answers
86 views

Cannot georeference an image using a custom projection in QGIS

I am trying to georeference a map using a custom projection I created in QGIS. I get the error Transform failed: "Failed to compute GCP transform: Transform is not solvable" Does anyone have ...
  • 11
3 votes
0 answers
696 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 ...
  • 109
1 vote
2 answers
411 views

Reading CRS and Affine transformation from a NetCDF with CF conventions

I have a NetCDF with geographical information. I'd like to obtain a GeoTIFF file with rasterio. The problem is how to translate the geographical information from CF standard to something that GeoTIFF ...
  • 327
0 votes
0 answers
207 views

Width and value problems with rasterstats

I am trying to extract data from a raster with a gpkg file as a vector. The issue is that, the data can't be extracted because the internal Bounding Box is negative. There I am not sure, whether this ...
3 votes
1 answer
718 views

How to use affine transform parameters in a PROJ or WKT2 string

Can anyone show me how I can construct a PROJ or WKT2 string with affine transformation parameters to create a custom CRS in QGIS? I wish to use the following affine transformation parameters to ...
  • 61
1 vote
1 answer
820 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: ...
  • 135
2 votes
1 answer
354 views

Rotation of a cropped portion of a raster map

We create printed maps from a GeoTIFF file projected in LCC, which is a common projection for aviation maps. Part of our process includes customization of the raster image by selecting a region and ...
  • 141
4 votes
2 answers
551 views

Renaming multiple layers in the legend from an attribute in each layer in QGIS

I have 72 layers that have been generated via affine transform of a single layer that has 72 categories. But the 72 layers have been given names that are sequential numeric. The original categories ...
2 votes
1 answer
7k 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 ...
  • 1,917
2 votes
1 answer
144 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" ...
2 votes
1 answer
234 views

Visually correcting systematic shift between two geodatasets using ArcMap

I often have two datasets that are obviously not georeferenced correctly. Most of the time a simple translation (shift by x/y) could fix this. Is there an easy way to do this e.g. by specifying one or ...
  • 1,402
0 votes
1 answer
137 views

Rotate, Scale, Translate in OpenLayers 4 and MapServer

Sometimes, I get spatial data (usually DGNs but I am not sure the format matters) that in the coordinate control sheet a 'Project Datum Factor' is noted. Say: 1.000073496. If I add them as is in ...
  • 2,340
2 votes
1 answer
202 views

Affine Tranformation Matrix; shapely asks 6 coefficients, but rasterio delivers 9; how to translate

Some lines have been extracted via scikit-image, now tho goal is to vectorize them within the origin coordinate reference system #some geotif opened with rasterio src = rasterio.open(raster_path) ...
3 votes
0 answers
416 views

Difference between Affine, Bilinear and Helmert Transformations

I'm georeferencing old arial photos with a commercial GIS. The software offers me 'Affine', 'Bilinear' and 'Helmert transformation' as transformation options. Unfortunately, the support of the GIS can'...
  • 2,407
0 votes
1 answer
2k 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 ...
4 votes
1 answer
668 views

How do I mirror a vector layer along a line in QGIS?

ArcGIS (Map & Pro) has a nifty utility that allows you to mirror a vector layer along a line segment you give it. Before I spend time trying to write something from scratch, I wanted to see if ...
  • 1,387
2 votes
1 answer
528 views

Get geopandas geo or affine transform

Does anyone know how to get the affine transformation from a geopandas dataframe? I need this for rasterising geospatial vector data with rasterio. shapes = ((geom,value) for geom, value in zip(...
1 vote
0 answers
283 views

Transform rectangle from decimal degrees to Cartesian coordinates

I'm trying to achieve the following: Given four coordinates (lat, lng) decimal degrees and a query coordinate within the formed shape, how can I transform these coordinates into Cartesian space where ...
  • 111
1 vote
1 answer
1k 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, ...
  • 129
0 votes
0 answers
95 views

QGIS v.transform output extent not lining up with input

I am using the updated Affine tool (v.transform) to rescale my vector layer (containing multiple polygons). I want to shrink each polygon to half of its size. So I enter in 0.5 for both the x and y ...
  • 1,097
3 votes
0 answers
346 views

Coordinate transformation for antenna pointing

I may have bitten off more than I can chew with some coordinate transformation math. As a background, I'm working on a project where we need to mechanically point an antenna to a receiving tower. The ...
2 votes
1 answer
757 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 ...
3 votes
1 answer
1k 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, ...
  • 77
2 votes
1 answer
1k 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 (...