[GRASS-user] exporting raster asc to qgis, axis flipped E to W?

Hi,

I'm exporting some data from Grass 6.4 to QGis as .asc files. The source
location has the projection:

g.proj -p
-PROJ_INFO-------------------------------------------------
name : Lat/Lon
proj : ll
datum : wgs84
ellps : wgs84
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : degree
units : degrees
meters : 1.0

I generated the asc file with:

r.out.ascii input=tri_median@PERMANENT output=tri_median.asc

When I import this into QGis, the layer is flipped east to west - the
atlantic coast of NA appears on the west, rather than the east!

The header appears correct:

tws:~$ head -6 tri_mean.asc
north: 46:53:04.633938N
south: 34:44:13.536462N
east: 68:50:28.1616W
west: 94:51:40.938811W
rows: 1458
cols: 3122

But gdal mis-reads it:

tws:~$ gdalinfo tri_mean.asc
Driver: GRASSASCIIGrid/GRASS ASCII Grid
Files: tri_mean.asc
Size is 3122, 1458
Coordinate System is `'
Origin = (94.000000000000000,46.000000000000000)
Pixel Size = (-0.008327994875080,-0.008230452674897)
Corner Coordinates:
Upper Left ( 94.0000000, 46.0000000)
Lower Left ( 94.0000000, 34.0000000)
Upper Right ( 68.0000000, 46.0000000)
Lower Right ( 68.0000000, 34.0000000)
Center ( 81.0000000, 40.0000000)
Band 1 Block=3122x1 Type=Float32, ColorInterp=Undefined

I can correct this by manually replacing the east and west values with
negative numbers, dropping the "W".

Have I done something wrong somewhere, or is there a problem with the
Grass 6.4 export or QGis/gdal import?

Thanks!

--
  Tyler Smith
  plantarum.ca

Tyler Smith:

Hi,

I'm exporting some data from Grass 6.4 to QGis as .asc files. The source
location has the projection:

g.proj -p
-PROJ_INFO-------------------------------------------------
name : Lat/Lon
proj : ll
datum : wgs84
ellps : wgs84
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : degree
units : degrees
meters : 1.0

What does `g.region -p` say about?

I generated the asc file with:

r.out.ascii input=tri_median@PERMANENT output=tri_median.asc

When I import this into QGis, the layer is flipped east to west - the
atlantic coast of NA appears on the west, rather than the east!

The header appears correct:

tws:~$ head -6 tri_mean.asc
north: 46:53:04.633938N
south: 34:44:13.536462N
east: 68:50:28.1616W
west: 94:51:40.938811W
rows: 1458
cols: 3122

Shouldn't it be:

east: 94:51:40.938811W
west: 68:50:28.1616W

( east > west )

?

Nikos

But gdal mis-reads it:

tws:~$ gdalinfo tri_mean.asc
Driver: GRASSASCIIGrid/GRASS ASCII Grid
Files: tri_mean.asc
Size is 3122, 1458
Coordinate System is `'
Origin = (94.000000000000000,46.000000000000000)
Pixel Size = (-0.008327994875080,-0.008230452674897)
Corner Coordinates:
Upper Left ( 94.0000000, 46.0000000)
Lower Left ( 94.0000000, 34.0000000)
Upper Right ( 68.0000000, 46.0000000)
Lower Right ( 68.0000000, 34.0000000)
Center ( 81.0000000, 40.0000000)
Band 1 Block=3122x1 Type=Float32, ColorInterp=Undefined

I can correct this by manually replacing the east and west values with
negative numbers, dropping the "W".

Have I done something wrong somewhere, or is there a problem with the
Grass 6.4 export or QGis/gdal import?

Thanks!

On Fri, May 8, 2015, at 02:23 PM, Nikos Alexandris wrote:

What does `g.region -p` say about?

g.region -p rast=tri_median@PERMANENT
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 46:53:04.633938N
south: 34:44:13.536462N
west: 94:51:40.938811W
east: 68:50:28.1616W
nsres: 0:00:29.993894
ewres: 0:00:30.004093
rows: 1458
cols: 3122
cells: 4551876

Shouldn't it be:

east: 94:51:40.938811W
west: 68:50:28.1616W

( east > west )

Not in this case - note that the east boundary is 68 degrees WEST, which
is further east than the west boundary at 94 degrees WEST.

Also, my crude fix of replacing 94:51:40.93W with -94:51:40.93 in the
asc header didn't really fix the problem - the projection still doesn't
quite match up with the destination in QGis.

Thanks,

Tyler

* Tyler Smith <tyler@plantarum.ca> [2015-05-08 14:34:41 -0400]:

On Fri, May 8, 2015, at 02:23 PM, Nikos Alexandris wrote:
>
> What does `g.region -p` say about?

g.region -p rast=tri_median@PERMANENT
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 46:53:04.633938N
south: 34:44:13.536462N
west: 94:51:40.938811W
east: 68:50:28.1616W
nsres: 0:00:29.993894
ewres: 0:00:30.004093
rows: 1458
cols: 3122
cells: 4551876

>
> Shouldn't it be:
>
> east: 94:51:40.938811W
> west: 68:50:28.1616W
>
> ( east > west )
>

Not in this case - note that the east boundary is 68 degrees WEST, which
is further east than the west boundary at 94 degrees WEST.

I see. Then it is correct :-). I am trying to do some test with your
region settings (with res=30). The exported file (just some random cells set to 100)
begins with:

north: 46:53:30N
south: 34:44N
east: 68:50W
west: 94:52W
rows: 1459
cols: 3124

which is correct and gdalinfo reports:

Driver: GRASSASCIIGrid/GRASS ASCII Grid
Files: test_random_points
Size is 3124, 1459
Coordinate System is `'
Origin = (94.000000000000000,46.000000000000000)
Pixel Size = (-0.008322663252241,-0.008224811514736)
Corner Coordinates:
Upper Left ( 94.0000000, 46.0000000)
Lower Left ( 94.0000000, 34.0000000)
Upper Right ( 68.0000000, 46.0000000)
Lower Right ( 68.0000000, 34.0000000)
Center ( 81.0000000, 40.0000000)
Band 1 Block=3124x1 Type=Int32, ColorInterp=Undefined

So the same. Maybe ask in gdal-dev?

Nikos

Also, my crude fix of replacing 94:51:40.93W with -94:51:40.93 in the
asc header didn't really fix the problem - the projection still doesn't
quite match up with the destination in QGis.

Thanks,

Tyler