importing bil file errors

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

importing bil file errors

Tyler Smith-2
Hello,

I am trying to import a .bil raster file into GRASS 7.0. The file is
available here:
http://webarchive.iiasa.ac.at/Research/LUC/External-World-soil-database/HTML/HWSD_Data.html?sb=4

Unzipping the data, I have three files:
hwsd.bil
hwsd.blw
hwsd.hdr

First I tried:
g.proj -c location=hwSoilsDB
georef=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil

which resulted in:
WARNING: Read of file
         /home/tws/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
         was successful, but it did not contain projection information. 'XY
         (unprojected)' will be used

I get the same warning if I try with hwsd.blw. Trying with hwsd.hdr instead:

g.proj -c location=hwSoilsDB
georef=~/grassdata/downloads/harmonized_world_soil_database/hwsd.hdr
ERROR 1: The selected file is an ESRI BIL header file, but to
open ESRI BIL datasets, the data file should be selected
instead of the .hdr file.  Please try again selecting
the data file (often with the extension .bil) corresponding
to the header file:
/home/tws/grassdata/downloads/harmonized_world_soil_database/hwsd.hdr

ERROR: Could not read georeferenced file
       /home/tws/grassdata/downloads/harmonized_world_soil_database/hwsd.hdr
       using either OGR nor GDAL

This is confusing, because I already know GRASS won't load the .bil file.

GDAL doesn't list bil as a supported format, but since r.in.bin
doesn't support creating a new location I tried it anyways. It looks
promising:

r.in.gdal -c input=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
location=hwSoilsDB output=hwSoil

This succeeds without complaint. So I switch into the new location and
import the raster, again with no complaints:

r.in.gdal input=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
output=hwSoil

However, if I try to display the map I get an error:

d.rast map=hwSoil
ERROR: Cairo_begin_raster: Failed to create surface

Interestingly, if I now try to stop the display, I get another error:

d.mon stop=wx0
ERROR: PID file not found

I also tried r.in.bin, but the best I could do was:

r.in.bin input=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
output=hwSoil bytes=1 rows=21600 cols=43200
ERROR: Invalid coordinates

And now I'm stuck. How do I get this bil file into GRASS?

Thanks,

Tyler
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: importing bil file errors

Tyler Smith-2
Following-up on my own question, I *can* view the raster in Grass 6.4, so it did get imported. So I guess the problem is with the display in grass 7.

I tried to update to the latest version of 7 from svn, but it failed to build with a pile of errors, so I can't check that.

Tyler

Tyler Smith <[hidden email]> wrote:
Hello,

I am trying to import a .bil raster file into GRASS 7.0. The file is
available here:
http://webarchive.iiasa.ac.at/Research/LUC/External-World-soil-database/HTML/HWSD_Data.html?sb=4

Unzipping the data, I have three files:
hwsd.bil
hwsd.blw
hwsd.hdr

First I tried:
g.proj -c location=hwSoilsDB
georef=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil

which resulted in:
WARNING: Read of file
/home/tws/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
was successful, but it did not contain projection information. 'XY
(unprojected)' will be used

I get the same warning if I try with hwsd.blw. Trying with hwsd.hdr instead:

g.proj -c location=hwSoilsDB
georef=~/grassdata/downloads/harmonized_world_soil_database/hwsd.hdr
ERROR 1: The selected file is an ESRI BIL header file, but to
open ESRI BIL datasets, the data file should be selected
instead of the .hdr file. Please try again selecting
the data file (often with the extension .bil) corresponding
to the header file:
/home/tws/grassdata/downloads/harmonized_world_soil_database/hwsd.hdr

ERROR: Could not read georeferenced file
/home/tws/grassdata/downloads/harmonized_world_soil_database/hwsd.hdr
using either OGR nor GDAL

This is confusing, because I already know GRASS won't load the .bil file.

GDAL doesn't list bil as a supported format, but since r.in.bin
doesn't support creating a new location I tried it anyways. It looks
promising:

r.in.gdal -c input=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
location=hwSoilsDB output=hwSoil

This succeeds without complaint. So I switch into the new location and
import the raster, again with no complaints:

r.in.gdal input=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
output=hwSoil

However, if I try to display the map I get an error:

d.rast map=hwSoil
ERROR: Cairo_begin_raster: Failed to create surface

Interestingly, if I now try to stop the display, I get another error:

d.mon stop=wx0
ERROR: PID file not found

I also tried r.in.bin, but the best I could do was:

r.in.bin input=~/grassdata/downloads/harmonized_world_soil_database/hwsd.bil
output=hwSoil bytes=1 rows=21600 cols=43200
ERROR: Invalid coordinates

And now I'm stuck. How do I get this bil file into GRASS?

Thanks,

Tyler


grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user

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

Re: importing bil file errors

Markus Neteler
Tyler,

the data set lacks the projection metadata, hence GRASS cannot guess that:

[neteler@oboe hwsd_soil]$ gdalinfo hwsd.bil
Driver: EHdr/ESRI .hdr Labelled
Files: hwsd.bil
       hwsd.blw
       hwsd.hdr
Size is 43200, 21600
Coordinate System is `'
Origin = (-180.000000000000000,89.999999999928036)
Pixel Size = (0.008333333333330,-0.008333333333330)
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000)
Lower Left  (-180.0000000, -90.0000000)
Upper Right ( 180.0000000,  90.0000000)
Lower Right ( 180.0000000, -90.0000000)
Center      (  -0.0000000,  -0.0000000)
Band 1 Block=43200x1 Type=UInt16, ColorInterp=Undefined

[neteler@oboe hwsd_soil]$ cat hwsd.blw
                   0.00833333333333
                   0.00000000000000
                   0.00000000000000
                  -0.00833333333333
                -179.99583333333334
                  89.99583333326137

[neteler@oboe hwsd_soil]$ cat hwsd.hdr
BYTEORDER      I
LAYOUT       BIL
NROWS         21600
NCOLS         43200
NBANDS        1
NBITS         16
BANDROWBYTES         86400
TOTALROWBYTES        86400
BANDGAPBYTES         0

So, GRASS 7 import:

grass70 -c EPSG:4326 ~/grassdata/hwsd
# -e: expand location to dataset; -o: override (missing) projection in
input dataset:
r.in.gdal input=hwsd.bil output=hwsd -e -o
g.region rast=hwsd -p
# or use wxGUI...:
d.mon wx0
d.rast hwsd
# ops, too big for our CAIRO driver :p
ERROR: Cairo_begin_raster(): Failed to create surface (invalid value
       (typically too big) for the size of the input (surface, pattern,
       etc.))

g.gui the same at full world extent.

But display works for a subset at least.

The analytical tools do obviously not show this problem.

For convenience added to the Wiki, too:
http://grasswiki.osgeo.org/wiki/Global_datasets#Harmonized_World_Soil_Database_.28HWSD_Database.29

Hope this helps,
Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: importing bil file errors

Tyler Smith-2


Markus Neteler <[hidden email]> wrote:
>
>the data set lacks the projection metadata, hence GRASS cannot guess
>that:
>
...
>
>So, GRASS 7 import:
>
>grass70 -c EPSG:4326 ~/grassdata/hwsd

How did you find the projection? Not having any GIS training, projections are the most confusing part of GRASS to me.


># ops, too big for our CAIRO driver :p
>ERROR: Cairo_begin_raster(): Failed to create surface (invalid value
>       (typically too big) for the size of the input (surface, pattern,
>       etc.))

Ah, I see now. The error message is a little cryptic.

>
>For convenience added to the Wiki, too:
>http://grasswiki.osgeo.org/wiki/Global_datasets#Harmonized_World_Soil_Database_.28HWSD_Database.29

Wow! I didn't know thIs kind of info is on the wiki. That is *very* helpful indeed.

>Hope this helps,

Very much, thank you!

Tyler

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

Re: importing bil file errors

Markus Neteler
On Tue, Jan 21, 2014 at 12:11 AM, Tyler Smith <[hidden email]> wrote:

>
>
> Markus Neteler <[hidden email]> wrote:
>>
>>the data set lacks the projection metadata, hence GRASS cannot guess
>>that:
>>
> ...
>>
>>So, GRASS 7 import:
>>
>>grass70 -c EPSG:4326 ~/grassdata/hwsd
>
> How did you find the projection? Not having any GIS training, projections are the most confusing part of GRASS to me.

I searched online and found some references about the data set.
It is not GRASS' fault that this information is lacking in the dataset :-)

I have now made the EPSG code it a link in the wiki.

>># ops, too big for our CAIRO driver :p
>>ERROR: Cairo_begin_raster(): Failed to create surface (invalid value
>>       (typically too big) for the size of the input (surface, pattern,
>>       etc.))
>
> Ah, I see now. The error message is a little cryptic.

Moreover, it should ideally not happen. It will hopefully be solved.

>>
>>For convenience added to the Wiki, too:
>>http://grasswiki.osgeo.org/wiki/Global_datasets#Harmonized_World_Soil_Database_.28HWSD_Database.29
>
> Wow! I didn't know thIs kind of info is on the wiki. That is *very* helpful indeed.
>
>>Hope this helps,
>
> Very much, thank you!

you are welcome.

Markus

> Tyler
>
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: importing bil file errors

Tyler Smith-2


Markus Neteler <[hidden email]> wrote:
>On Tue, Jan 21, 2014 at 12:11 AM,
>>
>> How did you find the projection? Not having any GIS training,
>projections are the most confusing part of GRASS to me.
>
>I searched online and found some references about the data set.
>It is not GRASS' fault that this information is lacking in the dataset
>:-)
>

Oh, I see. I didn't mean to imply that Grass was deficient on this front, rather that I was! I thought there was something in the data that I was overlooking. This is reassuring - knowing what to look for, I found the required info online as well.

With the data loaded, I have now succeeded in connecting the raster map to the data in the accompanying .mdb file, and can start doing some work. Hurrah!

Thanks again,

Tyler


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

Re: importing bil file errors

Markus Neteler
On Tue, Jan 21, 2014 at 5:59 PM, Tyler Smith <[hidden email]> wrote:
..
> With the data loaded, I have now succeeded in connecting the raster map to the data in the accompanying .mdb file, and can start doing some work. Hurrah!

Great. Please add a note to the Wiki how to do that!

thanks
Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: importing bil file errors

Tyler Smith-2


Markus Neteler <[hidden email]> wrote:
>On Tue, Jan 21, 2014 at 5:59 PM, Tyler Smith <[hidden email]>
>wrote:
>..
>> With the data loaded, I have now succeeded in connecting the raster
>map to the data in the accompanying .mdb file, and can start doing some
>work. Hurrah!
>
>Great. Please add a note to the Wiki how to do that!
>

Done. Feel free to change it if I've done something wrong.

Tyler


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

Re: importing bil file errors

Markus Neteler
In reply to this post by Tyler Smith-2
On Tue, Jan 21, 2014 at 12:11 AM, Tyler Smith <[hidden email]> wrote:
> Markus Neteler <[hidden email]> wrote:
...
>># ops, too big for our CAIRO driver :p
>>ERROR: Cairo_begin_raster(): Failed to create surface (invalid value
>>       (typically too big) for the size of the input (surface, pattern,
>>       etc.))
>
> Ah, I see now. The error message is a little cryptic.

I hopefully improved the error message again:

GRASS 7.0.0svn (nc_spm_08_grass7):~ > d.rast elevation
ERROR: Cairo_begin_raster(): Failed to create surface (invalid value
       (typically too big) for the size of the input (surface, pattern,
       etc.)). Using rows: 155000, cols: 407500

Indeed it is an initialization bug in the wxGUI (to be fixed in d.mon
since it works in the map display)

Markus
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user