[GRASS-user] xy to lat long

Markus Neteler neteler at osgeo.org
Tue Sep 27 12:19:01 EDT 2011


On Tue, Sep 27, 2011 at 2:27 AM, Hamish <hamish_b at yahoo.com> wrote:
> Raphael wrote:
>> > i have imported the etopo dem (geotifff) into grass.
...
> I think the "import into XY, crop outer edge & recenter" before
> converting the XY location into a lat/lon loc'n hack was written
> before the 'r.in.gdal -l' flag + fix with r.region came to be
> (perhaps because of?), and since these datasets need r.in.bin
> you'd need to compose a gdal .vrt file describing the byte order
> etc to use r.in.gdal?

Being curious, I tried to import it with the
-l   Force Lat/Lon maps to fit into geographic coordinates (90N,S; 180E,W)

flag due to unfortunate boundaries which are outside Earth:

gdalinfo ETOPO2v2g_f4_LSB.flt
...
Corner Coordinates:
Upper Left  (-180.0166667,  90.0166666)
Lower Left  (-180.0166667, -90.0166667)
Upper Right ( 180.0166666,  90.0166666)
Lower Right ( 180.0166666, -90.0166667)
Center      (  -0.0000000,  -0.0000000)
Band 1 Block=10801x1 Type=Float32, ColorInterp=Undefined
  NoData Value=999999

Hence:

r.in.gdal ETOPO2v2g_f4_LSB.flt out=etopo2v2g -o -l
r.colors etopo2v2g color=etopo2

g.region rast=etopo2v2g -p
projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      90N
south:      90S
west:       180W
east:       179:59:00.00013W  <- ! ouch
nsres:      0:01:59.977782
ewres:      0:00:00.005555
rows:       5401
cols:       10801
cells:      58336201

It fails unfortunately on this file. Maybe more rounding magic is needed?

Markus


More information about the grass-user mailing list