Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a height model of a quite big area saved in Esri ASCII grid files and a road network of this same area in a shapefile. I'd like to convert every height model value outside the road network to -999.999 (NODATA_value in my .asc-files), as I won't be needing them. This would reduce amount of data massively as I will later use only real values and forget those NODATA_values.

Is there any reasonable way to do this, for example in QGIS or ArcMap? Would it even be possible to have a few meters wide buffer around the roads, just to be sure that there will be every needed height value in the end?

share|improve this question
    
Are you sure you want to make such a sparse matrix grid? Would it work for you if you simply overlayed roads with DTM (digital terrain model) to add elevation data to the road network layer? –  U2ros Sep 4 '12 at 12:35
1  
As @sgrieve points out in an answer, this isn't going to do you much good, because in an ASCII file those NoData values have to be represented as some numerical value. The way to achieve huge space savings is to extract the heights for the road cells only, convert the result to integer format, and save it in native ESRI grid format (which uses run length encoding). You can expect around 99% compression depending on the cell size (smaller cells will result in more compression). –  whuber Sep 4 '12 at 12:37
    
I should have mentioned more clearly that this shapefile + ASCII grid is only temporary. Changing real heights to NoData will make .asc-files even larger than those were, but this helps because a script reads those grids and it skips all NoData values. –  Jussi V Sep 5 '12 at 7:33
    
This is not the best way to do this, but with advice from @sgrieve, I can get things working. It would be better to put that height data to shapefile, but right now I don't have time for modifications it would need (algo, gui, dataloader) in the app using this data. –  Jussi V Sep 5 '12 at 7:40
add comment

1 Answer 1

up vote 1 down vote accepted

You can perform an extract by mask in Arcmap to extract the raster cells which fall within a masking polygon, in your case the road network.

If you want to buffer the road network first, you can run a simple buffer using the buffer Arcmap tool and then use the buffered road network as the mask to extract data with.

As a side note, if you are trying to reduce the size of these ASCII rasters, avoid spurious precision in your nodata values. If you change your nodata value from -999.999 to -9999, you will save a not insignificant amount of space in large rasters.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.