[R-sig-Geo] geolocating image with info of other image

Rodofili, Esteban Nicolas erodo|||| @end|ng |rom u||@edu
Tue May 18 20:29:10 CEST 2021


Hi! I am trying to use the geolocation information of a tiff image to geolocate another. Both images are frames from the same drone footage, with the drone still over the same position. The one geolocated is a tif and the one to geolocate is a png, and it is to be converted to a tif. However, when I open the new tif in Google Earth Engine, I got it where I want it, but its almost all white. I have also noticed that the stack created from the original .png has a fourth layer that should not be there, all of it at maximum spectral value of 255. Do you know hwat might be going on? I have also tried with the first image not as a png but as a tif without geolocation and the same happened. I have also tried with bricks instead of stacks. I tried first with rasters, but the result was even worse. All the image was white. Here is my code:

library(raster)
library(rgdal)
library(ggplot2)
library(dplyr)

## Loading image of interest as raster
R_test <-
  stack("Pt6_clear.png")
R_test ## It does not have any CRS
plot(R_test)


## Loading image already geolocated from GIS
frame2 <-
  stack("Pt6_frame2.tif")
frame2 ##
plot(frame2)
# Give image of interest the lat/lon coords of the geolocated image as appear in its metadata in the console
extent(R_test) <- c(-9073461, -9073269, 2974255, 2974366)
# Copy the projection data of the geolocated image as appears in the console to the image of interest
projection(R_test) <- CRS("+proj=merc +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs")
plot(R_test)

## Write new geolocated image into a file
writeRaster(R_test, "R_test_geolocated.tif", format = "GTiff")


Esteban N. Rodofili
Ph.D. Student - Interdisciplinary Ecology Program, SNRE
Lic. in Biology - Mgtr. in Public Policy
Marine Geomatics Lab
University of Florida
UF Climate Action Plan - Transportation Working Group
352-284-6828
erodofili using ufl.edu
https://www.thelecourslab.org/

I stand in solidarity with Graduate Assistants United and demand the University of Florida:
1.      Follow through with its agreement to pay certain fees on behalf of GAs as outlined in Article 10.6 of our Collective Bargaining Agreement.
2.      Discontinue all business relationships with Aramark due to their use of prison labor, and directly consult with the Food Justice League, Gator NAACP, Dream Defenders, and allied groups on the upcoming food service vendor contract to ensure racial equity.
3.      Immediately reverse its plan to demolish the Maguire and UVS Graduate Family Housing complexes.
4.      Immediately revoke its new furlough policy.



	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list