[GRASSLIST:2364] v.proj help

Hello,

I've been struggling with a somewhat trivial problem where I seems to miss a step to give me a proper result. I'd very much appreciate a hint.

I've downloaded a dcw in .e00 format from http://www.maproom.psu.edu/dcw/ (europe, denma

I've imported using m.in.e00 -s input=ponet location=global mapset=dk Using d.vect shows the LatLong data fine.

Then I've tried to project the data to mercator projection, into a new handmade location. Here I cant display the projected data ! The projection was done by inserting the following PROJ_INFO into the new location/PERMANENT:

name: Mercator
proj: merc
ellps: clark66
lat_0: 57.0
lon_0:11.0
zone: -1

To get the WIND and DEFAULT_WIND files, I did a g.region on the imported file and changed the projection to 99
The WIND file looks like:

proj: 99
zone:0
north: 57:54:28N
south: 54:24:11N
east: 15:33:24E
west: 7:38:57E
cols: 99
rows: 44
e-w resol: 0:04:47.54
n-s resol: 0:04:46.75

I think the
THen v.proj -s input=ponet location=global mapset=dk

The output is somewhat big numbers:
north: 7911408
south: 7211788
east 502391
west 364972

nothing is snapped.

d.vect does not show anything. I'm using 5.0.2

Hopefully somebody can provide me the correct way of rendering the mercator projected data.

Regards Christian G. Tveen

Hello, again,

I've just recognized that v.digit renders the data, also it looks like the data is projected, so maybe its d.vect that has a problem ?

Regards Christian

Christian G. Tveen wrote:

Hello,

I've been struggling with a somewhat trivial problem where I seems to miss a step to give me a proper result. I'd very much appreciate a hint.

I've downloaded a dcw in .e00 format from http://www.maproom.psu.edu/dcw/ (europe, denma

I've imported using m.in.e00 -s input=ponet location=global mapset=dk Using d.vect shows the LatLong data fine.

Then I've tried to project the data to mercator projection, into a new handmade location. Here I cant display the projected data ! The projection was done by inserting the following PROJ_INFO into the new location/PERMANENT:

name: Mercator
proj: merc
ellps: clark66
lat_0: 57.0
lon_0:11.0
zone: -1

To get the WIND and DEFAULT_WIND files, I did a g.region on the imported file and changed the projection to 99
The WIND file looks like:

proj: 99
zone:0
north: 57:54:28N
south: 54:24:11N
east: 15:33:24E
west: 7:38:57E
cols: 99
rows: 44
e-w resol: 0:04:47.54
n-s resol: 0:04:46.75

I think the
THen v.proj -s input=ponet location=global mapset=dk

The output is somewhat big numbers:
north: 7911408
south: 7211788
east 502391
west 364972

nothing is snapped.

d.vect does not show anything. I'm using 5.0.2

Hopefully somebody can provide me the correct way of rendering the mercator projected data.

Regards Christian G. Tveen

Christian G. Tveen wrote:

Then I've tried to project the data to mercator projection, into a new
handmade location. Here I cant display the projected data ! The
projection was done by inserting the following PROJ_INFO into the new
location/PERMANENT:

name: Mercator
proj: merc
ellps: clark66
lat_0: 57.0
lon_0:11.0
zone: -1

lat_0 isn't a valid parameter for that projection.

To get the WIND and DEFAULT_WIND files, I did a g.region on the imported
file and changed the projection to 99
The WIND file looks like:

proj: 99
zone:0
north: 57:54:28N
south: 54:24:11N
east: 15:33:24E
west: 7:38:57E
cols: 99
rows: 44
e-w resol: 0:04:47.54
n-s resol: 0:04:46.75

This isn't valid. The region boundaries and resolution have to be
specified in the map's coordinate system (i.e. feet/metres, not
degrees).

I think the
THen v.proj -s input=ponet location=global mapset=dk

The output is somewhat big numbers:
north: 7911408
south: 7211788
east 502391
west 364972

If I project your lat/lon region into the location:

  name: Mercator
  proj: merc
  ellps: clark66
  lat_ts: 0.0000000000
  lon_0: 11.0000000000
  k_0: 1.0000000000

I end up with:

  north: 7904761.9047619
  south: 7206349.20634921
  west: -369444.44444444
  east: 504166.66666667

Which isn't that far off, except for the Western boundary. Maybe
something doesn't like the negative coordinate; most map projections
choose their parameters so that coordinates are always positive (e.g.
by adding a false Easting or Northing).

--
Glynn Clements <glynn.clements@virgin.net>

Thanks a lot!!!

I had't really realized that units had to be meters (I'm very much used to only use lat/lng even in projected maps.)

I have two further questions: From where did you obtain the precise values for the boundaries ? (I saw my rounded values written by v.proj)

A more general question is how to obtain the initial WIND/DEFAULT_WIND file. When starting out, I only have the LL boundaries. Do I manually calculate the Mercator boundaries for those files, or is there a clever way ? (g.region initially requires a DEFAULT_WIND file, so somehow I need a boot-strap)

Best regards
Christian

Glynn Clements wrote:

Christian G. Tveen wrote:

Then I've tried to project the data to mercator projection, into a new handmade location. Here I cant display the projected data ! The projection was done by inserting the following PROJ_INFO into the new location/PERMANENT:

name: Mercator
proj: merc
ellps: clark66
lat_0: 57.0
lon_0:11.0
zone: -1
   
lat_0 isn't a valid parameter for that projection.

To get the WIND and DEFAULT_WIND files, I did a g.region on the imported file and changed the projection to 99
The WIND file looks like:

proj: 99
zone:0
north: 57:54:28N
south: 54:24:11N
east: 15:33:24E
west: 7:38:57E
cols: 99
rows: 44
e-w resol: 0:04:47.54
n-s resol: 0:04:46.75
   
This isn't valid. The region boundaries and resolution have to be
specified in the map's coordinate system (i.e. feet/metres, not
degrees).

I think the
THen v.proj -s input=ponet location=global mapset=dk

The output is somewhat big numbers:
north: 7911408
south: 7211788
east 502391
west 364972
   
If I project your lat/lon region into the location:

name: Mercator
proj: merc
ellps: clark66
lat_ts: 0.0000000000
lon_0: 11.0000000000
k_0: 1.0000000000

I end up with:

north: 7904761.9047619
south: 7206349.20634921
west: -369444.44444444
east: 504166.66666667

Which isn't that far off, except for the Western boundary. Maybe
something doesn't like the negative coordinate; most map projections
choose their parameters so that coordinates are always positive (e.g.
by adding a false Easting or Northing).

Forgot to mention that fixing the WIND to use meters instead of lat-lng, the d.vect works fine.

Regards.

Christian G. Tveen wrote:

Thanks a lot!!!
I had't really realized that units had to be meters (I'm very much used to only use lat/lng even in projected maps.)

I have two further questions: From where did you obtain the precise values for the boundaries ? (I saw my rounded values written by v.proj)

A more general question is how to obtain the initial WIND/DEFAULT_WIND file. When starting out, I only have the LL boundaries. Do I manually calculate the Mercator boundaries for those files, or is there a clever way ? (g.region initially requires a DEFAULT_WIND file, so somehow I need a boot-strap)

Best regards
Christian

Glynn Clements wrote:

Christian G. Tveen wrote:

Then I've tried to project the data to mercator projection, into a new handmade location. Here I cant display the projected data ! The projection was done by inserting the following PROJ_INFO into the new location/PERMANENT:

name: Mercator
proj: merc
ellps: clark66
lat_0: 57.0
lon_0:11.0
zone: -1
  
lat_0 isn't a valid parameter for that projection.

To get the WIND and DEFAULT_WIND files, I did a g.region on the imported file and changed the projection to 99
The WIND file looks like:

proj: 99
zone:0
north: 57:54:28N
south: 54:24:11N
east: 15:33:24E
west: 7:38:57E
cols: 99
rows: 44
e-w resol: 0:04:47.54
n-s resol: 0:04:46.75
  
This isn't valid. The region boundaries and resolution have to be
specified in the map's coordinate system (i.e. feet/metres, not
degrees).

I think the
THen v.proj -s input=ponet location=global mapset=dk

The output is somewhat big numbers:
north: 7911408
south: 7211788
east 502391
west 364972
  
If I project your lat/lon region into the location:

    name: Mercator
    proj: merc
    ellps: clark66
    lat_ts: 0.0000000000
    lon_0: 11.0000000000
    k_0: 1.0000000000

I end up with:

    north: 7904761.9047619
    south: 7206349.20634921
    west: -369444.44444444
    east: 504166.66666667

Which isn't that far off, except for the Western boundary. Maybe
something doesn't like the negative coordinate; most map projections
choose their parameters so that coordinates are always positive (e.g.
by adding a false Easting or Northing).

Christian G. Tveen wrote:

I had't really realized that units had to be meters (I'm very much used
to only use lat/lng even in projected maps.)

I have two further questions: From where did you obtain the precise
values for the boundaries ? (I saw my rounded values written by v.proj)

1 $ grass5 /opt/grass-data/global5/glynn
2 GRASS:~ > g.region n=57:54:28N s=54:24:11N w=7:38:57E e=15:33:24E
3 GRASS:~ > r.mapcalc one=1
4 GRASS:~ > exit
5 $ grass5 /opt/grass-data/merctest/glynn
6 GRASS:~ > g.region s=7000000 n=8000000 w=-500000 e=1000000
7 GRASS:~ > r.proj in=one location=global5
8 GRASS:~ > g.region rast=one
9 GRASS:~ > g.region -p

Line 6 took a bit of trial and error.

Note: I'm not suggesting this as a standard approach.. I was also
trying to figure out your projection parameters (I initially entered
lat_ts=57, which put your region somewhere around Spitzbergen), so I
was repeatedly projecting maps back and forth between locations.

A more general question is how to obtain the initial WIND/DEFAULT_WIND
file. When starting out, I only have the LL boundaries. Do I manually
calculate the Mercator boundaries for those files, or is there a clever
way ? (g.region initially requires a DEFAULT_WIND file, so somehow I
need a boot-strap)

Use m.proj2 to project some sample coordinates. For projections which
transform rectangles to rectangles (e.g. lat/lon -> Mercator),
projecting the opposing corners will suffice.

For projections which will distort the grid, you need to use knowledge
of the projection to select appropriate points; think about what the
projection will do to a rectangle.

E.g. when projecting lat/lon to a typical (northern hemisphere)
conical projection, a rectangle will be converted to a ring segment
(i.e. a "rectangle" in polar coordinates). The minimum projected Y
coordinate would be obtained by projecting the intersection of the
central meridian and the southern parallel; the maximum Y would come
from either the NE or NW corner, and the min/max X from the SE and SW
corners.

One mechanism to automate this is to create a sites list which samples
the source region boundary, convert those to the destination
projection with s.proj, then set the destination region with
"g.region sites=...". This will work for any likely projection (it
won't work in some extreme cases which "fold" the map, but those
aren't particularly common).

Note: there isn't a command to change the default region; you just
have to overwrite the DEFAULT_WIND file with a suitable WIND file.
FWIW, the default region doesn't have any significance beyond
"g.region -d".

--
Glynn Clements <glynn.clements@virgin.net>

Again thank you! very helpfull information!

Best regards Christian

Glynn Clements wrote:

Christian G. Tveen wrote:

I had't really realized that units had to be meters (I'm very much used to only use lat/lng even in projected maps.)

I have two further questions: From where did you obtain the precise values for the boundaries ? (I saw my rounded values written by v.proj)
   
1 $ grass5 /opt/grass-data/global5/glynn
2 GRASS:~ > g.region n=57:54:28N s=54:24:11N w=7:38:57E e=15:33:24E
3 GRASS:~ > r.mapcalc one=1
4 GRASS:~ > exit
5 $ grass5 /opt/grass-data/merctest/glynn
6 GRASS:~ > g.region s=7000000 n=8000000 w=-500000 e=1000000
7 GRASS:~ > r.proj in=one location=global5
8 GRASS:~ > g.region rast=one
9 GRASS:~ > g.region -p

Line 6 took a bit of trial and error.

Note: I'm not suggesting this as a standard approach.. I was also
trying to figure out your projection parameters (I initially entered
lat_ts=57, which put your region somewhere around Spitzbergen), so I
was repeatedly projecting maps back and forth between locations.

A more general question is how to obtain the initial WIND/DEFAULT_WIND file. When starting out, I only have the LL boundaries. Do I manually calculate the Mercator boundaries for those files, or is there a clever way ? (g.region initially requires a DEFAULT_WIND file, so somehow I need a boot-strap)
   
Use m.proj2 to project some sample coordinates. For projections which
transform rectangles to rectangles (e.g. lat/lon -> Mercator),
projecting the opposing corners will suffice.

For projections which will distort the grid, you need to use knowledge
of the projection to select appropriate points; think about what the
projection will do to a rectangle.

E.g. when projecting lat/lon to a typical (northern hemisphere)
conical projection, a rectangle will be converted to a ring segment
(i.e. a "rectangle" in polar coordinates). The minimum projected Y
coordinate would be obtained by projecting the intersection of the
central meridian and the southern parallel; the maximum Y would come
from either the NE or NW corner, and the min/max X from the SE and SW
corners.

One mechanism to automate this is to create a sites list which samples
the source region boundary, convert those to the destination
projection with s.proj, then set the destination region with
"g.region sites=...". This will work for any likely projection (it
won't work in some extreme cases which "fold" the map, but those
aren't particularly common).

Note: there isn't a command to change the default region; you just
have to overwrite the DEFAULT_WIND file with a suitable WIND file.
FWIW, the default region doesn't have any significance beyond
"g.region -d".