Skip to main content

Hi,

I am trying to extract the four corner coordinates of a tif file using the RasterPropertyExtractor.

What I need are the coordinates of the data extent of the image without Nodata, what I get are the coordinates of the full extent of the image. I guess somehow I have to make the existing Nodata “0” to “real NoData”. 

Any help is appreciated.

Thanks

 

This can be done using the RasterExtentsCoercer set to Data MBR Extents. Depending on how big your raster is this can take some time.

From the documentation:

The RasterExtentsCoercer receives raster features and creates one polygon per raster that covers one of the following:

  • Raster Extents: The extent of the entire raster, as a rectangle, which may be rotated.
  • Data MBR Extents: The minimum bounding rectangle containing all cells with valid data (that is, do not have the Nodata value).
  • Data Extents: The exact footprint of all cells with valid data within the raster, which may produce non-rectangular polygons, and may produce an aggregate polygon with multiple parts per raster feature.

Hi @nielsgerrits,

thanks for your reply.

But its not working for the tiff image. I guess it must have something to do with the NoData…..

 


This can be done using the RasterExtentsCoercer set to Data MBR Extents. Depending on how big your raster is this can take some time.

From the documentation:

The RasterExtentsCoercer receives raster features and creates one polygon per raster that covers one of the following:

  • Raster Extents: The extent of the entire raster, as a rectangle, which may be rotated.
  • Data MBR Extents: The minimum bounding rectangle containing all cells with valid data (that is, do not have the Nodata value).
  • Data Extents: The exact footprint of all cells with valid data within the raster, which may produce non-rectangular polygons, and may produce an aggregate polygon with multiple parts per raster feature.

Great!


Have you tried the RasterToPolygonCoercer? Here you can ignore or exclude the no-data- cells. 

 

If the cells are not no-data, but some fixed value like 0, you can filter afterwards for that. 


Hi @nielsgerrits,

thanks for your reply.

But its not working for the tiff image. I guess it must have something to do with the NoData…..

 

If you check the raster in the Data Inspector, does it recognize NoData where you expect it?


In the Data Inspector it shows (0) NoData. In ArcMap it shows with the identify tool 0.

I have got another tiff which shows in ArcMap with the identify tool NoData.

And with this tiff I can extract the coordinates of the tiffs data extent with the RasterPropertyExtractor.

So maybe the question should be, how can I convert 0 to Nodata?

 


Not sure if I understand your situation. Can you printscreen what you see in the Data Inspector?

You probably need the RasterBandNodataSetter.


I made a screenshot, maybe it will help…..

I tried the RasterBandNodataSetter, but it did not work.


What version FME do you use? I attached a sample workspace, generating a raster, then generating the extents using the RasterExtentsCoercer.

Raster Extents
Data MBR Extents
Data Extents

 


Do you expect the 4 corners of the Data (Yellow) or the 4 corners of the boundingbox (Green)?

Because reading again and looking at your data it might be that you are looking for the 4 corners of your data.

If that's the case the DataExtends setting RasterExtentsCoercer will give you a polygon, and i think the BoundingBoxReplacer with the 2D Oriented Bounding Box settings will give you roughly the yellow dots in below screenshot.

If you want the green dots the Data MBR Extends setting in the RasterExtentsCoercer should do the job.

 

 

 


Thanks to everybody for the help, very much appreciated.

Still not working, but trying now a complete different approach.


Reply