[GRASS-user] opening .gri anf .bin files in grass gis.

Markus Metz markus.metz.giswork at gmail.com
Thu Jun 2 00:14:07 PDT 2016


On Thu, May 26, 2016 at 11:23 AM, Rengifo Ortega <rengifoo at yahoo.de> wrote:
> Dear community,
> i moved the .bin and .gri file to our ftp
>
> ftp://ftp01.nve.no/gis/NN2000/
>
> user: gis
> passord:mErcat0r ( 0 is a zero not a capital O)
>
> There I have the two files and some png files, that shows the .gri file that
> I was able to open in Global Mapper a while ago. About the question from
> Markus Metz. Sofar, I know I know both files content the same information
> but in 2 different formats. Here some explanations about the  internal
> structure of the file------- free translation from norwegian to
> english------:
>
>
> Liten forklaring av formatet:
> Første linje inneholder følgende informasjon:
> First line contents the following  information
>     57.000000   72.000000    1.000000   33.000000    0.025000    0.050000
>
> 57.000000           Minste bredde (min latitude)
> 72.000000           Største bredde(max latitude)
> 1.000000              Minste lengde(min longitude)
> 33.000000           Største lengde(max longitude)
> 0.025000              Bredde inkrement(latitude increment)
> 0.050000              Lengde inkrement(longitude increment)
>
> Alle andre linjer inneholder differanser mellom NN2000 og NN1954.
> Other lines content difference beween old (NN54) and new model (NN2000)
>
> Første verdi, -3.048, har posisjon lengde 1 og bredde 72, neste verdi lengde
> 1+0.05 og bredde 72, så 1+0.05+0.05 og 72 osv.
> First values -3.048 has position 1 longitude, 72 latitude. next values  has
> 1+0.05 longitude and latitude 72 and so on ... 1+0.05+0.05 og 72
>
>
> Når lengda har nådd 33, begynner neste bredde som er 72-0.025. Første verdi
> ved denne bredda får posisjonen lengde 1 og bredde 72-0.025, så lengde
> 1+0.05  og bredde 72-0.025, deretter  lengde 1+0.05+0.05  og bredde 72-0.025
> osv.
>
> So, when the longitude has reached 33, then it starts with the next latitude
> which is
> 72-0.025. First values heres is then longitude 1 and latitude 72-0.025, so
>   longitude 1+0.05  and latitude 72-0.025, then longitude 1+0.05+0.05  and
> latide 72-0.025 and so on.
>
> Sagt på en annen måte: etter 32/0.05=640 verdier begynner en ny bredde som
> er 0.025 mindre enn den forrige.
>
> In short: after 32/0.05=640 values, a new latitude is started,which 0.025
> less than the one before.
>

If the min and max latitude and longitude are regarded as pixel corners, you get
(72 - 57) / 0.025 = 600 rows
and
(33 - 1) / 0.05 columns
384000 cells total.

But there are 385241 entries in the file, so the min and max latitude
and longitude must be regarded as pixel centers and you get
(72 - 57 + 0.025) / 0.025 = 601 rows
and
(33 - 1 + 0.05) / 0.05 = 641 columns
385241 cells total.

You can try to modify the .gri file by replacing the header with a
GRASS ascii raster header, then import with r.in.ascii. Alternatively,
you can try to convert the .gri file to a format suitable for
r.in.xyz.

HTH,

Markus M


> End of translation-----
>
> As you see I was able to open the .gri file in a test version of global
> mapper, but I woudl rather do it in my software combination  of preference
> (grass+qgis+gdal).
>
> I hope the infomation above is more useful to you Markus Metz , than it was
> to me .
>
>
> As for the question from Markus Neteler, the values used where standard
> values already present in in the example comman line,since I do not know how
> many columns and rows they are in the .bin file.
>
>
> Thanks for the help
> best regards.
> Rengifo Ortega
>
>
> ________________________________
> Von: Markus Metz <markus.metz.giswork at gmail.com>
> An: Markus Neteler <neteler at osgeo.org>
> CC: Rengifo Ortega <rengifoo at yahoo.de>; GRASS User List
> <grass-user at lists.osgeo.org>
> Gesendet: 10:06 Donnerstag, 26.Mai 2016
> Betreff: Re: [GRASS-user] opening .gri anf .bin files in grass gis.
>
> On Thu, May 26, 2016 at 12:23 AM, Markus Neteler <neteler at osgeo.org> wrote:
>> On Tue, May 24, 2016 at 3:27 PM, Rengifo Ortega <rengifoo at yahoo.de> wrote:
>>> Dear Grass  Community.,
>>> first of all a greeting to the community. I have a question and hope some
>>> of
>>> you can help me with it.
>>>
>>> I have got a .gri and a .bin file that represent  a geodetic height
>>> modell
>>> in Norway,which can be downloaded for free from here.
>>>
>>> ftp://ftp.geodesi.no/NNTrans%20-%20Transformasjon%20mellom%20NN2000%20og%20NN1954/
>>
>> ... unfortunately it wants a password.
>>
>>> So, I have tried unsucessfull to import  the .bin file into GRASS GIS and
>>> the .gri file is not even read into GRASS GIS. Have any of you tried to
>>> open
>>> a .gri file in GRASS GIS.
>>>
>>> i tried the r.in.bin with the following parameters with not success:
>>> try 1:
>>> r.in.bin NNTrans2016A.bin out=nntranstest r=5400 c=10800 n=72 s=57 w=
>>> 1 e=33 bytes=2
>>> try 2:
>>> r.in.bin NNTrans2016A.bin out=nntranstest r=5400 c=10800 n=72 s=57 w=
>>> 1 e=33 bytes=4
>>> try 3:
>>> r.in.bin NNTrans2016A.bin out=nntranstest r=5400 c=10800 n=72 s=57 w=
>>> 1 e=33 bytes=8
>>>
>>>
>>> In all three cases I got the  following error;
>>> WARNING: File Size 1577088 ... Total Bytes 116640000
>>> ERROR: Bytes do not match file size
>
> Is it possible that these files are not raster maps but reference
> grids for the Norwegian height model HREF NN2000 to be used e.g. by
> proj4?
>
> Just a guess,
>
> Markus M
>
>
>>
>> So, is the file size 116640000 bytes?
>>
>> Guestimating, I get
>>
>>> 5400*10800
>> [1] 58320000
>>> 116640000 / 58320000
>> [1] 2
>>
>> --> 2 bytes.
>>
>> Or is the size 1577088 bytes?
>>
>> Markus
>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>


More information about the grass-user mailing list