Skip to content

Making Reprojected Raster Tiles Work with FME

by troy.miller on May 3rd, 2013

One of the problems I have come across is taking a set of raster files in a state plane coordinate system and displaying them on a UTM map. The problem comes in when the images are re-projected and it includes a rotation. Extra black pixels are created around the outside so when you bring the tiles together the black edges lay across each other eliminating good sections of imagery. There are various techniques to address this issue like setting nodata values and creating alpha channels but they are not simple and there must be a better way. There must be a method of generating these tiles that is flexible and can be completed with an external hard drive and workstation hardware. I will tell you about my solution to this problem using FME.

Here is an example of a tile set in state plane uncompressed GeoTiff format with a total file size of 817MB. This sample set needs to be converted and compressed for the GIS server. The two format outputs needed are GeoTiff and ECW. Along with this is each tile should line up with the state Township Range and Section area.

Raster Before Reprojection

Raster Before Reprojection

The tiles are square and they lay across each other but the pixels match exactly. Now take that data and reproject it into UTM.

After Reprojection

After Reprojection

You can now see the black edges and the rasters have been rotated. One way to address this is to set a NODATA value on the image so the black area will become see-through.

NODATA Value Set to Black

NODATA Value Set to Black

This looks to have solved it but on closer inspection you can see that anything that was black is now missing from the image.

Black Pixels Missing

Black Pixels Missing

To make matters worse I need to use ER Mapper’s ECW format but the NODATA value is not applicable so the black edges remain in my output ECWs. The file sizes have worked out pretty well though. The ECW set now totals 208MB and my GeoTiffs with JPG compression are at 170MB for a percent compression of 75% and 79% respectively.

The answer to the problem turns out to be simple. Make the new tiles square so the black lines are not created. The next image shows the outline of the reprojected image in blue and the bounding box of that image in green showing the new square tile.

Bounding Box of Reprojected Tile

Bounding Box of Reprojected Tile

Now we can mosaic all the tiles together and cut it up by these new tile boundaries right? If you have 20 tiles then yes, if you have 1800 tiles like this set then no you don’t have enough RAM.

What I did next is I used FME to find all the raster tiles around each tile so I would have a list of images to mosaic and the tile to cut from that mosaic. The output is then saved as an ECW and Geotiff.

FME Script Cuts the Tile

FME Script Cuts the Tile

I created a batch file to call FME and pass in the image names and iteratively loop over each tile. This limited the amount of RAM needed on each run so a standard workstation could complete the task. Start it on Friday evening and it should be ready the next Monday.

From → FME, Raster

Comments are closed.