[gdal-dev] using gdal_viewshed

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] using gdal_viewshed

Ben Avrahami
Hello all, I've been trying trying to use the newest gdal_viewshed in gdal-dev release, and I've run into an error I can't quite understand.

The input I've been using is:

    gdal_viewshed -md 1000 -ox "691868.511" -oy "3492031.487" <input tiff> <output tiff>

And I get the response:

    ERROR 5: C:\temp\files\out.tif, band 1: Access window out of range in RasterIO().  Requested
    (0,-1) of size 67x1 on raster of 67x67.
    ERROR 1: RasterIO error when writing target raster

I get a similar error if I try to use the GDALViewshedGenerate C-API function. The input us a valid WGS84-UTM tiff file, and the output is a valid path, but the file does not actually exist until I run the command. After I run the command, the output file is created but only filled halfway. Any help at wall would be appreciated.

regards, Ben

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: using gdal_viewshed

Eli Adam
Hi Ben,

On Sun, Nov 10, 2019 at 3:57 AM Ben Avrahami <[hidden email]> wrote:
>
> Hello all, I've been trying trying to use the newest gdal_viewshed in gdal-dev release, and I've run into an error I can't quite understand.
>
> The input I've been using is:
>
>     gdal_viewshed -md 1000 -ox "691868.511" -oy "3492031.487" <input tiff> <output tiff>

It might be helpful to copy and paste your command so if there are
typos or otherwise, they can be spotted.

A gdalinfo report on your input file could also be helpful.  That
would show coordinates of the image and allow looking at things like
are those coordinates within the image?  Is it in the coordinate
system of the image?  A gdalinfo report details that nicely.

>
> And I get the response:
>
>     ERROR 5: C:\temp\files\out.tif, band 1: Access window out of range in RasterIO().  Requested
>     (0,-1) of size 67x1 on raster of 67x67.
>     ERROR 1: RasterIO error when writing target raster

This makes it seem like something isn't lining up correctly.  With the
absence of information some random guess include: that the coordinate
is not within the image, or perhaps the coordinate is less than -md
1000 units from the edge (although testing that on other data here
worked fine), that there are pixel alignment/resolution issues and
using coordinates not to three decimal places would work better.

I see that gdal_viewshed -md 900 -ox 985710 -oy 658590
http://download.osgeo.org/gdal/data/aaigrid/095b_dem_90m.asc
output2.tif works

and

gdal_viewshed -md 800 -ox 985710 -oy 658590
http://download.osgeo.org/gdal/data/aaigrid/095b_dem_90m.asc
output3.tif fails with the error:

0ERROR 5: output3.tif, band 1: Access window out of range in
RasterIO().  Requested
(0,-1) of size 19x1 on raster of 19x19.
ERROR 1: RasterIO error when writing target raster

it seems that -md must be a multiple of the resolution.

Best regards, Eli

>
> I get a similar error if I try to use the GDALViewshedGenerate C-API function. The input us a valid WGS84-UTM tiff file, and the output is a valid path, but the file does not actually exist until I run the command. After I run the command, the output file is created but only filled halfway. Any help at wall would be appreciated.
>
> regards, Ben
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: using gdal_viewshed

Tamas Szekeres
I've recently fixed the implementation in my local version causing a similar issue (RasterIO error when writing target raster), where the given maxdistance setting would produce an empty row at the top or the bottom of the result image.
I'll prepare a fix in gdal in the next few days and let us see if that fixes this issue as well.

Best regards,

Tamas


Eli Adam <[hidden email]> ezt írta (időpont: 2019. nov. 12., K, 22:26):
Hi Ben,

On Sun, Nov 10, 2019 at 3:57 AM Ben Avrahami <[hidden email]> wrote:
>
> Hello all, I've been trying trying to use the newest gdal_viewshed in gdal-dev release, and I've run into an error I can't quite understand.
>
> The input I've been using is:
>
>     gdal_viewshed -md 1000 -ox "691868.511" -oy "3492031.487" <input tiff> <output tiff>

It might be helpful to copy and paste your command so if there are
typos or otherwise, they can be spotted.

A gdalinfo report on your input file could also be helpful.  That
would show coordinates of the image and allow looking at things like
are those coordinates within the image?  Is it in the coordinate
system of the image?  A gdalinfo report details that nicely.

>
> And I get the response:
>
>     ERROR 5: C:\temp\files\out.tif, band 1: Access window out of range in RasterIO().  Requested
>     (0,-1) of size 67x1 on raster of 67x67.
>     ERROR 1: RasterIO error when writing target raster

This makes it seem like something isn't lining up correctly.  With the
absence of information some random guess include: that the coordinate
is not within the image, or perhaps the coordinate is less than -md
1000 units from the edge (although testing that on other data here
worked fine), that there are pixel alignment/resolution issues and
using coordinates not to three decimal places would work better.

I see that gdal_viewshed -md 900 -ox 985710 -oy 658590
http://download.osgeo.org/gdal/data/aaigrid/095b_dem_90m.asc
output2.tif works

and

gdal_viewshed -md 800 -ox 985710 -oy 658590
http://download.osgeo.org/gdal/data/aaigrid/095b_dem_90m.asc
output3.tif fails with the error:

0ERROR 5: output3.tif, band 1: Access window out of range in
RasterIO().  Requested
(0,-1) of size 19x1 on raster of 19x19.
ERROR 1: RasterIO error when writing target raster

it seems that -md must be a multiple of the resolution.

Best regards, Eli

>
> I get a similar error if I try to use the GDALViewshedGenerate C-API function. The input us a valid WGS84-UTM tiff file, and the output is a valid path, but the file does not actually exist until I run the command. After I run the command, the output file is created but only filled halfway. Any help at wall would be appreciated.
>
> regards, Ben
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: using gdal_viewshed

Tamas Szekeres
The fix has now been committed to GDAL/master

Tamas

Tamas Szekeres <[hidden email]> ezt írta (időpont: 2019. nov. 12., K, 22:37):
I've recently fixed the implementation in my local version causing a similar issue (RasterIO error when writing target raster), where the given maxdistance setting would produce an empty row at the top or the bottom of the result image.
I'll prepare a fix in gdal in the next few days and let us see if that fixes this issue as well.

Best regards,

Tamas


Eli Adam <[hidden email]> ezt írta (időpont: 2019. nov. 12., K, 22:26):
Hi Ben,

On Sun, Nov 10, 2019 at 3:57 AM Ben Avrahami <[hidden email]> wrote:
>
> Hello all, I've been trying trying to use the newest gdal_viewshed in gdal-dev release, and I've run into an error I can't quite understand.
>
> The input I've been using is:
>
>     gdal_viewshed -md 1000 -ox "691868.511" -oy "3492031.487" <input tiff> <output tiff>

It might be helpful to copy and paste your command so if there are
typos or otherwise, they can be spotted.

A gdalinfo report on your input file could also be helpful.  That
would show coordinates of the image and allow looking at things like
are those coordinates within the image?  Is it in the coordinate
system of the image?  A gdalinfo report details that nicely.

>
> And I get the response:
>
>     ERROR 5: C:\temp\files\out.tif, band 1: Access window out of range in RasterIO().  Requested
>     (0,-1) of size 67x1 on raster of 67x67.
>     ERROR 1: RasterIO error when writing target raster

This makes it seem like something isn't lining up correctly.  With the
absence of information some random guess include: that the coordinate
is not within the image, or perhaps the coordinate is less than -md
1000 units from the edge (although testing that on other data here
worked fine), that there are pixel alignment/resolution issues and
using coordinates not to three decimal places would work better.

I see that gdal_viewshed -md 900 -ox 985710 -oy 658590
http://download.osgeo.org/gdal/data/aaigrid/095b_dem_90m.asc
output2.tif works

and

gdal_viewshed -md 800 -ox 985710 -oy 658590
http://download.osgeo.org/gdal/data/aaigrid/095b_dem_90m.asc
output3.tif fails with the error:

0ERROR 5: output3.tif, band 1: Access window out of range in
RasterIO().  Requested
(0,-1) of size 19x1 on raster of 19x19.
ERROR 1: RasterIO error when writing target raster

it seems that -md must be a multiple of the resolution.

Best regards, Eli

>
> I get a similar error if I try to use the GDALViewshedGenerate C-API function. The input us a valid WGS84-UTM tiff file, and the output is a valid path, but the file does not actually exist until I run the command. After I run the command, the output file is created but only filled halfway. Any help at wall would be appreciated.
>
> regards, Ben
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev