Skip to main content

I have a request to produce files in a custom format that is almost but not quite an esri ascii grid.

 

The header is different and the raster portion is individually hex encoded. I can deal with the header easily enough, but I'm a bit stuck on how to produce the hex encoded body.

 

I can write an ascii grid file, read it back in as a text file, strip the header and then hex encoded it but that seems a bit elaborate.

 

The RasterExtractor doesn't have ascii grid as a format, otherwise I would use that.

 

Thoughts?

 

Ex snip of a file

 

512

512

200000

200000

-3150

0

 

 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 6 6 6 6 6 6 6 6 6

 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 6 6 6 6 6 6 6 6 6 6 6 6

 0 0 0 0 1 1 5 6 6 6 6 6 6 6 7 a 10 28 43 60 7e 9c b9 d3 ee fe ff ff ff ff ff ff ff

 0 1 4 4 6 6 6 6 6 11 22 37 54 71 8e ab c9 e5 f1 fb ff ff ff ff ff ff ff ff ff ff ff ff ff

 4 6 6 6 6 6 6 7 b 13 28 44 62 7f 9d ba d5 ed ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 10 22 38 54 72 8f ac ca e5 f3 fc ff ff ff ff

 4 6 6 6 6 6 8 13 2b 47 65 83 a0 bd d7 ee fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff f

 4 6 6 6 6 6 6 6 f 23 3a 56 74 91 ae cc ea f3 fc ff ff ff ff ff ff ff ff ff ff ff ff ff ff

 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 e 16 2b 49 66 83 a1 be d8 ef

 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 e 24 3c 5a 76 94 b2 cf eb f6 fc ff ff

 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 e 16 2c 4a 67 85 a2 c0 d9 ee ff ff ff ff ff ff ff

 

I took a look at this but I really couldn't see a better solution than you. I had a similar task recently, where I wanted to actually write data to an attribute in a specific format, and it just couldn't be done. It's a pity that the underlying function for the RasterExtractor doesn't let us just use any format we wanted.

 

Our raster expert/developer suggests that you could coerce the cells to points, aggregate the resulting values, and write them out to a text file. It's more elegant for sure, but still not quite the ideal solution.


I took a look at this but I really couldn't see a better solution than you. I had a similar task recently, where I wanted to actually write data to an attribute in a specific format, and it just couldn't be done. It's a pity that the underlying function for the RasterExtractor doesn't let us just use any format we wanted.

 

Our raster expert/developer suggests that you could coerce the cells to points, aggregate the resulting values, and write them out to a text file. It's more elegant for sure, but still not quite the ideal solution.

I had considered coercing to individual points, but vectorization is notoriously inefficient in FME.

I ended up writing the asc file in FME and then post-processing it elsewhere.


Reply