Skip to main content
Question

Georeferencing a raster based on lat and long bands

  • February 26, 2019
  • 5 replies
  • 73 views

adriano
Forum|alt.badge.img+1

Hi,

I'm trying to find the correct workflow to georeference a raster when the lat and long is stored in it's bands.

 

I have a raster that has 3 bands:

  • longitude (band 0)
  • latitude (band 1)
  • OLCI Terrestrial Chlorophyll Index (band 2)

 

 

I think if I can dynamically pull the lat and long for the 4 corners of the raster, then I can use the corner x and y in the "rastergeoreferencer" transformer to correctly georeference it. I need this to be dynamic as the extent of the rasters may be different.

 

5 replies

redgeographics
Celebrity
Forum|alt.badge.img+48

Yes, that's what I would try (after loudly wondering why one would do such a thing when there's perfectly useable other ways of storing the locations)

So, thinking out loud: RasterPropertyExtractor to get the min/max coordinates (in whatever arbitrary coordinate system it currently is), generate points on the extreme corners, turn the raster into polygons with the RasterToVectorCoercer, find the nearest polygon for every point. The attribute _label will contain the band values of that pixel. FeatureMerger to get all of that back to the raster and then the RasterGeoreferencer.


adriano
Forum|alt.badge.img+1
  • Author
  • February 27, 2019
redgeographics wrote:

Yes, that's what I would try (after loudly wondering why one would do such a thing when there's perfectly useable other ways of storing the locations)

So, thinking out loud: RasterPropertyExtractor to get the min/max coordinates (in whatever arbitrary coordinate system it currently is), generate points on the extreme corners, turn the raster into polygons with the RasterToVectorCoercer, find the nearest polygon for every point. The attribute _label will contain the band values of that pixel. FeatureMerger to get all of that back to the raster and then the RasterGeoreferencer.

Yea for some reason I can't explain, sentinel-3 stores their coordinates of the raster in a completely seperate netcdf file rather than georeferencing the data so I am attempting to georeference it in this workbench.

 

 

Is it not possible to do this without converting it to a polygon or point? The raster is very large and the process will end up taking days if we have to convert the raster into a vector for the polygon for point intersection.

 

 

thanks for your help!

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • February 27, 2019
adriano wrote:

Yea for some reason I can't explain, sentinel-3 stores their coordinates of the raster in a completely seperate netcdf file rather than georeferencing the data so I am attempting to georeference it in this workbench.

 

 

Is it not possible to do this without converting it to a polygon or point? The raster is very large and the process will end up taking days if we have to convert the raster into a vector for the polygon for point intersection.

 

 

thanks for your help!

Can you create points on the corners then use a point on raster value extractor? Not sure whether the actual corners would work or if they'd need shuffling in a bit


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • February 27, 2019

What *I* would actually do is send the geo_coordinates.nc file to a Python Caller and get the pixel values of the for corner pixels.

 

 

A less programmatic method would be to use a BoundingBoxReplacer, Chopper (max 1 vertex), Sampler (first 4 points), PointOnRasterValueExtractor.

Either way, you should end up with 4 points that have the geometry of the unprojected raster, and attributes of the lat long (in a list).

 

 

Merge those attributes to the raster and then use those values in a RasterGeoreferencer. The points should be in clockwise order starting with the lower left, but if in doubt use the original coordinates of the points to determine it.

 

LL 0, -R

 

UL 0,0

 

UR C,0

 

LR C,-R

 

 

where R/C is the number of row/columns of the raster.

 

 

 

EDIT: My mistake, the geo_coordinates file values are the center of the pixel, the RasterGeoreferencer uses the outside corners, it's the world files that also uses the center of the pixel.

 

You will need to offset the coordinates by half a pixel if using the georeferencer.

redgeographics
Celebrity
Forum|alt.badge.img+48
ebygomm wrote:

Can you create points on the corners then use a point on raster value extractor? Not sure whether the actual corners would work or if they'd need shuffling in a bit

I would imagine the coordinates are for the center of a pixel so a bit of shuffling would be needed.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings