Re: World File problem (was Re: [GRASS-user] Re: GRASS-user] Help with reprojection (Hamish))

2009-01-05 Thread Markus Neteler
Richard,

On Mon, Jan 5, 2009 at 8:55 PM, Richard Chirgwin
 wrote:
...
>>> Grass-6.3.0 under Mac doesn't seem to be checking for the world file.

It does - see below:

>>> My test:
>>>
>>> 1) Export a raster using r.out.tiff with the "create world file" box checked
>>> 2) Check the output folder:
>>>
>>> test.tiff
>>> test.tfw
>>>
>>> 3) Import using r.in.gdal:
>>>
>>> r.in.gdal input=test.tiff output=test_2
>>>
>>> In mine, this produces a projection mismatch error - which seems to tell me
>>> that Grass isn't noticing the tfw file.

No, that's not the message :) See below:

...
> Here's a sample gdalinfo output:
>
>> Driver: GTiff/GeoTIFF
>> Files: Tiff_Test.tif
>> Size is 4838, 3781
>> Coordinate System is `'

-> the Coordinate System is (naturally) missing. Why? Because
in the .tfw file it is not stored. It might be an additional .prj file
(not sure if GDAL would recognize that, maybe yes).

...
> The world file:
>>0.0278000
>>0.000
>>0.000
>>   -0.0278000
>>  150.34587082996
>>  -33.59935661001
> This file and the world file are the only items in the folder, and were
> created by r.out.tiff from a raster in  a working location.

Right.

>> ERROR: Projection of dataset does not appear to match current location.

Correct message because GRASS/GDAL cannot guess the projection
of the TIFF (since it is not specified).

>>Location PROJ_INFO is:
>>name: Lat/Lon
>>proj: ll
>>datum: wgs84
>>ellps: wgs84
>>no_defs: defined
>>
>>Import dataset PROJ_INFO is:
>>cellhd.proj = 0 (unreferenced/unknown)

GRASS is right: the  PROJ_INFO is undefined. Just a human will recognize
that it may be LatLong.

Solution: use r.in.gdal -o to disable the test and import into a location
with correct projection. Then the map will be placed correctly.

Cheers
Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


World File problem (was Re: [GRASS-user] Re: GRASS-user] Help with reprojection (Hamish))

2009-01-05 Thread Richard Chirgwin
Markus Neteler wrote:
> On Mon, Jan 5, 2009 at 6:37 AM, rchirg...@ozemail.com.au
>  wrote:
>   
>>> Date: Sat, 3 Jan 2009 13:25:31 -0800 (PST)
>>> From: Hamish 
>>>
>>> Hamish wrote:
>>>   
> - create a simple xy location
> (lat/lon location will not allow north > 90, and your image while
>  still not geo-referenced will go to 8100)
> - run r.region to set n,s,e,w bounds to 90,-90,180,-180
> - run g.setproj to rejig the location into a lat/lon one.
>   
>>> umm, that might not work -- r.info will still know the map is XY even
>>> if the location is changed to lat/lon.
>>>
>>>   
> - check resolution is correct (nicely "0:01:20") with r.info.
> - zoom to area of interest. you probably do not want to reproject
>   entire planet. after zooming check resolution is preserved,
>   (g.region -p, maybe with "g.region res=0:01:20 -a" after zoom to fix)
>   and run "r.mapcalc cropmap=fullmap" to perform the crop.
>
> then from the lambert location run r.proj to pull the
> cropped image across.
>
> there are some examples of this process in the GRASS wiki,
> look at the "Global datasets" page.
>   
>>> the above issue should be covered there; also check the mailing list
>>> archives.
>>>
>>> so your "easiest" solution is to create a "world file". see the GDAL
>>> JPG or GeoTiff format import page, or do a web search for instructions.
>>>   
>> Grass-6.3.0 under Mac doesn't seem to be checking for the world file.
>>
>> My test:
>>
>> 1) Export a raster using r.out.tiff with the "create world file" box checked
>>
>> 2) Check the output folder:
>>
>> test.tiff
>> test.tfw
>> 
>
>   
>> 3) Import using r.in.gdal:
>>
>> r.in.gdal input=test.tiff output=test_2
>>
>> In mine, this produces a projection mismatch error - which seems to tell me
>> that Grass isn't noticing the tfw file.
>> 
>
> We would need more details to better understand the problem.
> What does gdalinfo report on the file? (GRASS calls GDAL to read
> the files).
>
> Markus
>
>   
Markus,

Here's a sample gdalinfo output:

> Driver: GTiff/GeoTIFF
> Files: Tiff_Test.tif
> Size is 4838, 3781
> Coordinate System is `'
> Origin = (150.34586944001,-33.59935522000)
> Pixel Size = (0.0278000,-0.0278000)
> Image Structure Metadata:
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  ( 150.3458694, -33.5993552)
> Lower Left  ( 150.3458694, -33.6098664)
> Upper Right ( 150.3593191, -33.5993552)
> Lower Right ( 150.3593191, -33.6098664)
> Center  ( 150.3525943, -33.6046108)
> Band 1 Block=4838x1 Type=Byte, ColorInterp=Red
> Band 2 Block=4838x1 Type=Byte, ColorInterp=Green
> Band 3 Block=4838x1 Type=Byte, ColorInterp=Blue
The world file:
>0.0278000
>0.000
>0.000
>   -0.0278000
>  150.34587082996
>  -33.59935661001 
This file and the world file are the only items in the folder, and were
created by r.out.tiff from a raster in  a working location.

> ERROR: Projection of dataset does not appear to match current location.
>
>Location PROJ_INFO is:
>name: Lat/Lon
>proj: ll
>datum: wgs84
>ellps: wgs84
>no_defs: defined
>
>Import dataset PROJ_INFO is:
>cellhd.proj = 0 (unreferenced/unknown)
Cheers,
Richard


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: Re: [GRASS-user] Re: GRASS-user] Help with reprojection (Hamish)

2009-01-05 Thread Michael Barton



On Jan 5, 2009, at 10:00 AM,  wrote:


Date: Mon, 5 Jan 2009 11:46:54 +0100
From: "Markus Neteler" 
Subject: Re: [GRASS-user] Re: GRASS-user] Help with reprojection
(Hamish)
To: "Alex Bernstein" 
Cc: GRASS user list ,
rchirg...@ozemail.com.au
Message-ID:
<86782b610901050246w125f196u440c04a12635d...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Jan 5, 2009 at 11:11 AM, Alex Bernstein   
wrote:

Thanks everyone for trying to help. A few hours ago, I've finally
accomplished what I needed by using gdalwarp directly. I had some
trouble with it as well, because it couldn't handle the reprojection
of a global image.


There is a ticket open for that:
http://trac.osgeo.org/gdal/ticket/2305

To communicate interest, please add yourself in CC to the ticket.


But once I limited it to the region of interest, it worked,


Good to know.

Independently, import and reprojection (r.proj which differs from  
gdalwarp)

should work.

Markus


Echoing Markus, gdalwarp georegisters the map. This works fine  
obviously. You could also use the GRASS georegister module.


Michael

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: GRASS-user] Help with reprojection (Hamish)

2009-01-05 Thread Markus Neteler
On Mon, Jan 5, 2009 at 11:11 AM, Alex Bernstein  wrote:
> Thanks everyone for trying to help. A few hours ago, I've finally
> accomplished what I needed by using gdalwarp directly. I had some
> trouble with it as well, because it couldn't handle the reprojection
> of a global image.

There is a ticket open for that:
http://trac.osgeo.org/gdal/ticket/2305

To communicate interest, please add yourself in CC to the ticket.

> But once I limited it to the region of interest, it worked,

Good to know.

Independently, import and reprojection (r.proj which differs from gdalwarp)
should work.

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: GRASS-user] Help with reprojection (Hamish)

2009-01-05 Thread Alex Bernstein
Thanks everyone for trying to help. A few hours ago, I've finally
accomplished what I needed by using gdalwarp directly. I had some
trouble with it as well, because it couldn't handle the reprojection
of a global image. But once I limited it to the region of interest, it
worked,

Thanks again,
--Alex
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: GRASS-user] Help with reprojection (Hamish)

2009-01-04 Thread Markus Neteler
On Mon, Jan 5, 2009 at 6:37 AM, rchirg...@ozemail.com.au
 wrote:
>> Date: Sat, 3 Jan 2009 13:25:31 -0800 (PST)
>> From: Hamish 
>>
>> Hamish wrote:
>>> > - create a simple xy location
>>> > (lat/lon location will not allow north > 90, and your image while
>>> >  still not geo-referenced will go to 8100)
>>> > - run r.region to set n,s,e,w bounds to 90,-90,180,-180
>>> > - run g.setproj to rejig the location into a lat/lon one.
>>
>> umm, that might not work -- r.info will still know the map is XY even
>> if the location is changed to lat/lon.
>>
>>> > - check resolution is correct (nicely "0:01:20") with r.info.
>>> > - zoom to area of interest. you probably do not want to reproject
>>> >   entire planet. after zooming check resolution is preserved,
>>> >   (g.region -p, maybe with "g.region res=0:01:20 -a" after zoom to fix)
>>> >   and run "r.mapcalc cropmap=fullmap" to perform the crop.
>>> >
>>> > then from the lambert location run r.proj to pull the
>>> > cropped image across.
>>> >
>>> > there are some examples of this process in the GRASS wiki,
>>> > look at the "Global datasets" page.
>>
>> the above issue should be covered there; also check the mailing list
>> archives.
>>
>> so your "easiest" solution is to create a "world file". see the GDAL
>> JPG or GeoTiff format import page, or do a web search for instructions.
>
> Grass-6.3.0 under Mac doesn't seem to be checking for the world file.
>
> My test:
>
> 1) Export a raster using r.out.tiff with the "create world file" box checked
>
> 2) Check the output folder:
>
> test.tiff
> test.tfw

> 3) Import using r.in.gdal:
>
> r.in.gdal input=test.tiff output=test_2
>
> In mine, this produces a projection mismatch error - which seems to tell me
> that Grass isn't noticing the tfw file.

We would need more details to better understand the problem.
What does gdalinfo report on the file? (GRASS calls GDAL to read
the files).

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Re: GRASS-user] Help with reprojection (Hamish)

2009-01-04 Thread rchirg...@ozemail.com.au


>
> Message: 4
> Date: Sat, 3 Jan 2009 13:25:31 -0800 (PST)
> From: Hamish 
> Subject: Re: [GRASS-user] Re: GRASS-user] Help with reprojection
> To: grass-user@lists.osgeo.org
> Message-ID: <62626.56685...@web110014.mail.gq1.yahoo.com>
> Content-Type: text/plain; charset=us-ascii
>
> Hamish wrote:
>   
>> > - create a simple xy location
>> > (lat/lon location will not allow north > 90, and your image while
>> >  still not geo-referenced will go to 8100)
>> > - run r.region to set n,s,e,w bounds to 90,-90,180,-180
>> > - run g.setproj to rejig the location into a lat/lon one.
>> 
>
> umm, that might not work -- r.info will still know the map is XY even
> if the location is changed to lat/lon.
>
>   
>> > - check resolution is correct (nicely "0:01:20") with r.info.
>> > - zoom to area of interest. you probably do not want to reproject
>> >   entire planet. after zooming check resolution is preserved,
>> >   (g.region -p, maybe with "g.region res=0:01:20 -a" after zoom to fix)
>> >   and run "r.mapcalc cropmap=fullmap" to perform the crop.
>> > 
>> > then from the lambert location run r.proj to pull the
>> > cropped image across.
>> > 
>> > there are some examples of this process in the GRASS wiki,
>> > look at the "Global datasets" page.
>> 
>
> the above issue should be covered there; also check the mailing list
> archives.
>
> so your "easiest" solution is to create a "world file". see the GDAL
> JPG or GeoTiff format import page, or do a web search for instructions.
>
>
> Hamish
>   
Hamish,

Grass-6.3.0 under Mac doesn't seem to be checking for the world file.

My test:

1) Export a raster using r.out.tiff with the "create world file" box checked
2) Check the output folder:
test.tiff
test.tfw

3) Import using r.in.gdal:
r.in.gdal input=test.tiff output=test_2

In mine, this produces a projection mismatch error - which seems to tell me that Grass isn't noticing the tfw file.

Richard

 
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: GRASS-user] Help with reprojection

2009-01-03 Thread Hamish
Hamish wrote:
> - create a simple xy location
> (lat/lon location will not allow north > 90, and your image while
>  still not geo-referenced will go to 8100)
> - run r.region to set n,s,e,w bounds to 90,-90,180,-180
> - run g.setproj to rejig the location into a lat/lon one.

umm, that might not work -- r.info will still know the map is XY even
if the location is changed to lat/lon.

> - check resolution is correct (nicely "0:01:20") with r.info.
> - zoom to area of interest. you probably do not want to reproject
>   entire planet. after zooming check resolution is preserved,
>   (g.region -p, maybe with "g.region res=0:01:20 -a" after zoom to fix)
>   and run "r.mapcalc cropmap=fullmap" to perform the crop.
> 
> then from the lambert location run r.proj to pull the
> cropped image across.
> 
> there are some examples of this process in the GRASS wiki,
> look at the "Global datasets" page.

the above issue should be covered there; also check the mailing list
archives.

so your "easiest" solution is to create a "world file". see the GDAL
JPG or GeoTiff format import page, or do a web search for instructions.


Hamish



  

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: GRASS-user] Help with reprojection

2009-01-03 Thread Hamish
Alex Bernstein:
> > The input data set is Natural Earth II map of the world
> >  16200x8100 JPG in plate
> > carrée projection. I need to reproject it into Lambert azimuthal
> > equal-area projection centered on N0 E15.

this data needs a lat/lon location.
perhaps with wgs84 datum or no datum with a spherical ellipsoid?
(at this scale maybe it doesn't matter much; for reprojection a datum
will be needed)

> > rows:   8100
> > cols:   16200

north-south:
 8100/(90+90) = 45 pixels per degree, ie a resultion of 1'20".

east-west gives the same answer. (180W to 180E is 360deg)

> > I then imported the JPG map, which got split into color channels and
> > composed the channels together into single map.

I think you will either need to make a "world file" for the .jpg before
importing with r.in.gdal into the lat/lon location, OR:

- create a simple xy location
(lat/lon location will not allow north > 90, and you image while
 still not geo-referenced will go to 8100)
- run r.region to set n,s,e,w bounds to 90,-90,180,-180
- run g.setproj to rejig the location into a lat/lon one.
- check resolution is correct (nicely "0:01:20") with r.info.
- zoom to area of interest. you probably do not want to reproject
  entire planet. after zooming check resolution is preserved,
  (g.region -p, maybe with "g.region res=0:01:20 -a" after zoom to fix)
  and run "r.mapcalc cropmap=fullmap" to perform the crop.

then from the lambert location run r.proj to pull the cropped image
across.

there are some examples of this process in the GRASS wiki, look at the
"Global datasets" page.


Michael:
> Looking at the jpg, it has no latlon or other geographic
> markers. This will make it difficult to georectify
> accurately.

with some guesswork you can figure it out: extent is full planet and
rows/cols of map are exact multiples of deg-min-sec.


happy new year,
Hamish

(now back to the beach ;)





___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Re: GRASS-user] Help with reprojection

2009-01-02 Thread Michael Barton

On Jan 2, 2009, at 4:38 PM,  wrote:


Message: 2
Date: Fri, 2 Jan 2009 21:04:44 +0200
From: "Alex Bernstein" 
Subject: [GRASS-user] Help with reprojection
To: grass-user@lists.osgeo.org
Message-ID:

Content-Type: text/plain; charset=ISO-8859-1

Hi,

I'm new to GRASS, and am having trouble with reprojection. I've spent
two days trying to figure this out, and I feel that I'm close, but
reprojection is still failing. Could anyone clue me in what I'm
missing?

The input data set is Natural Earth II map of the world
 16200x8100 JPG in plate
carrée projection. I need to reproject it into Lambert azimuthal
equal-area projection centered on N0 E15. I'm using WinGRASS 6.3.0.

First, I've created GRASS location "geographic" with following region
and projection:


g.region -p

projection: 99 (Equidistant Cylindrical (Plate Caree))
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  8100
south:  0
west:   0
east:   16200
nsres:  1
ewres:  1
rows:   8100
cols:   16200
cells:  13122


g.proj -p datumtrans=0

PROJ_INFO-
name   : Equidistant Cylindrical (Plate Caree)
datum  : wgs84
towgs84: 0.000,0.000,0.000
proj   : eqc
ellps  : wgs84
a  : 6378137.00
es : 0.0066943800
f  : 298.2572235630
lat_0  : 0.00
lat_ts : 0.00
lon_0  : 0.00
-PROJ_UNITS
unit   : meter
units  : meters
meters : 1.0

I then imported the JPG map, which got split into color channels and
composed the channels together into single map.

After, I created a new location "lambert":

g.region -p

projection: 99 (Lambert Azimuthal Equal Area)
zone:   0
datum:  wgs84
ellipsoid:  wgs84
north:  8100
south:  0
west:   0
east:   16200
nsres:  1
ewres:  1
rows:   8100
cols:   16200
cells:  13122


g.proj -p datumtrans=0

-PROJ_INFO-
name   : Lambert Azimuthal Equal Area
datum  : wgs84
towgs84: 0.000,0.000,0.000
proj   : laea
ellps  : wgs84
a  : 6378137.00
es : 0.0066943800
f  : 298.2572235630
lat_0  : 0.00
lon_0  : 15.00
x_0: 0.00
y_0: 0.00
-PROJ_UNITS
unit   : meter
units  : meters
meters : 1.0

Finally, when I try reprojection I get "Input raster map is outside
current region" error:

r.proj input=NE2 location=geographic mapset=PERMANENT method=cubic

Input Projection Parameters:  +proj=eqc +lat_0=0.00
+lat_ts=0.00 +lon_0=0.00 +a=6378137 +rf=298.257223563
+no_defs +towgs84=0.000,0.000,0.000
Input Unit Factor: 1
Output Projection Parameters:  +proj=laea +lat_0=0.00
+lon_0=15.00 +x_0=0.00 +y_0=0.00 +a=6378137
+rf=298.257223563 +no_defs +towgs84=0.000,0.000,0.000
Output Unit Factor: 1
Input raster map is outside current region

How can I make this work?


Your problem is that this map is an image, not a GIS map. It is in  
what is called an xy "projection" in GRASS. That is, it is in no  
projection at all. The coordinates of each cell are simply the xy  
coordinates from the corner, not their position in the world.


In a 'real' GIS map, each cell would have some kind of real-world  
geographic coordinates (latlon, UTM, etc).


To get from a graphic image like this to geospatial data, you need to  
georectify the map. It would be a good idea for you to get an intro  
GIS book so that you can understand what is going on with this if it  
is unfamiliar to you.


The steps you need to follow in GRASS are...

1) create an xy location
2) import your jpg map into the xy location
3) open GRASS in your Lambert location
4) start the georectifier and georectify the map from the xy to  
Lambert location.


Looking at the jpg, it has no latlon or other geographic markers. This  
will make it difficult to georectify accurately. If you are looking  
for nice geospatial data of world topography, it might be better for  
you to download some data rather than trying to georectify a jpg  
image. GTOPO30 or similar scale (1km or larger) topography can be  
downloaded from a variety of places. Check the GRASS site to links to  
geospatial data. Also check out the GLCF . For global-scale imagery, try MODIS satellite data. The good thing  
about these data sets is that they are already georectified and can be  
imported directly into GRASS as GIS data. You can then easily  
reproject to something else.


Michael


___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user