-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with asc raster math #40
Comments
I am not exactly sure what is going on, but I added two units tests to make sure ArcGrid Rasters work with the setValue and getValue commands. The only thing I noticed was: def outChmRaster = Format.getFormat(dsmPath).read() Should dsmPath be chmPath? |
Actually not. This is the trick I am using in order to not have to create the Raster manually (part of point 2). Usually one wants to have a new raster of the exact grid of the used rasters, so the simplest is to re-read one of the rasters and use it to overwrite. Is there a better way using the data of an existing raster? I will look into your commit and see if it works for me. Mind that the first point (0.5 resolution) is a bug in my opinion. Your testcases do not consider this, since the rasters you create are not aware of cell resolution: For example in this case:
what is resolution? 1? |
I created two mini ASC files to reproduce in a testcase the cell resolution problem, which I think is a bug: Script used:
Instead with those two it seem to not have the strange diff problem I was experiencing. Will need to check that on my side. |
Last note about the problem 2 in the original issue. The script still doesn't work on large rasters. I have no idea why. But it does if I use the data list approach.
This is just for the record, at the moment I am not able to understand why. |
I think I may have discovered the problem. If you try to set values on a raster that exceed the maximum value of the existing raster, the values seem to wrap when you write to disk. If you save the same raster to a new file using a new Format it doesn't wrap and it seems to work. This script works on a larger raster (the natural earth terrain raster). https://gist.github.com/jericks/bb84e294b25afc89d6fda5a74dbe6237 I think we should look into the GeoTools GridCoverageBuilder as a way to creating new Raster. http://docs.geotools.org/stable/javadocs/org/geotools/coverage/grid/GridCoverageBuilder.html |
By maximum value you mean the row or col? I am not doing that, so I am not sure I understand what you mean. Where you able to guess why the 0.5 resolution breaks the getValue in the right border positions? |
Bands have minimum and maximum values. I think when you try to write a Raster back to an existing Raster with these values are enforced (not by GeoScript but by GeoTools). I am not sure about the 0.5 resolution issue yet. |
Ah, now I understand, the min/max are on the value itself. That makes sense then. Thank you! |
I would like to support a better way to dealing with this. Does this help? |
Hi, I am trying to do a very simple raster diff (manually to teach students). The script is the following:
Issues with this:
The text was updated successfully, but these errors were encountered: