I've let the following script run for 3+ minutes before killing the
process. I don't understand why it's taking so long for only three points. I
must have an error here, despite following the man page and the example it
contains (except that I've not used the '-r' option).
cs2cs +proj=latlong +datum=NAD83
+to +proj=lcc +datum=NAD83 +ellps=GRS80
+lat_1=43.0 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=1312336 +y_0=0
+nadgrids=WO
<<EOF
45d19'19.49" 122d30'32.43"
45d18'52.45" 122d30'17.92"
45d18'47.16" 122d29'34.08"
EOF
Suggestions, pointers, clue sticks welcome.
Rich
On Wed, 2 Dec 2009, Rich Shepard wrote:
I've let the following script run for 3+ minutes before killing the
process.
Tripped again by the man page syntax summary ending in 'file(s)'. The tool
needs to run from the command line, and it needs the '-r' option to produce
output when the values are input as lat/long rather than long/lat.
Rich
On Wed, 2 Dec 2009, Rich Shepard wrote:
cs2cs +proj=latlong +datum=NAD83
+to +proj=lcc +datum=NAD83 +ellps=GRS80
+lat_1=43.0 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=1312336 +y_0=0
+nadgrids=WO
<<EOF
45d19'19.49" 122d30'32.43"
45d18'52.45" 122d30'17.92"
45d18'47.16" 122d29'34.08"
EOF
This does not produce correct values. When it runs the output is:
-5056134.11 5898037.45 -0.0
-5057005.89 5898228.79 -0.0
-5057306.14 5899149.81 -0.0
The window values in other maps in the LCC projection are these:
proj: 99
zone: 0
north: 414531.46530409
south: 349974.06580951
east: 1201003.03577829
west: 1126515.54469129
cols: 74487
rows: 64557
e-w resol: 1.00000659
n-s resol: 1.00000619
top: 0.5
bottom: -0.5
cols3: 74487
rows3: 64557
depths: 1
e-w resol3: 1.00000659
n-s resol3: 1.00000619
t-b resol: 1
What might I have done incorrectly to produce both negative x values and
values that are so different from that of other maps in the same region and
projection?
Rich
Rich Shepard wrote:
On Wed, 2 Dec 2009, Rich Shepard wrote:
> cs2cs +proj=latlong +datum=NAD83
> +to +proj=lcc +datum=NAD83 +ellps=GRS80
> +lat_1=43.0 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=1312336 +y_0=0
> +nadgrids=WO
> <<EOF
> 45d19'19.49" 122d30'32.43"
> 45d18'52.45" 122d30'17.92"
> 45d18'47.16" 122d29'34.08"
> EOF
1. The default input format has X (easting) followed by Y (northing).
You need to use the -r switch if the northing comes first.
2. In the absence of a trailing E or W, positive eastings are east of
the prime meridian. You need either a leading "-" or a trailing "W"
for eastings in the western hemisphere.
E.g.:
cs2cs -r +proj=latlong +datum=NAD83 \
+to +proj=lcc +datum=NAD83 +ellps=GRS80 \
+lat_1=43.0 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=1312336 +y_0=0 \
+nadgrids=WO \
<<EOF
45d19'19.49"N 122d30'32.43"W
45d18'52.45"N 122d30'17.92"W
45d18'47.16"N 122d29'34.08"W
EOF
gives:
1154847.51 398797.24 -0.00
1155143.02 397955.05 -0.00
1156093.62 397768.55 -0.00
--
Glynn Clements <glynn@gclements.plus.com>
On Thu, 3 Dec 2009, Glynn Clements wrote:
1. The default input format has X (easting) followed by Y (northing).
You need to use the -r switch if the northing comes first.
Glynn,
That's what I thought. I tried the '-r' switch, too, based on the example
in the man page. Originally I had the easting first but changed to match the
man page example. It is the explanation below that was the real source of my
issues with the tool.
2. In the absence of a trailing E or W, positive eastings are east of the
prime meridian. You need either a leading "-" or a trailing "W" for
eastings in the western hemisphere.
This is where I went off the tracks. I kept looking at the example in the
man page and saw the different formats. However, what I saw was that thowe
with a leading '-' or trailing 'W' were expressed in decimal degrees, not
degrees-minutes-seconds. Based on that I did not use either the prefix or
suffix since my values are in DMS.
Thank you very much for clarifying. The man page is ambiguous and when
used as a learning tool rather than a reference leads to invalid results.
Very much appreciated,
Rich
On Thu, 3 Dec 2009, Glynn Clements wrote:
1. The default input format has X (easting) followed by Y (northing).
You need to use the -r switch if the northing comes first.
2. In the absence of a trailing E or W, positive eastings are east of
the prime meridian. You need either a leading "-" or a trailing "W"
for eastings in the western hemisphere.
Glynn,
There's another discrepancy in the man page I should point out for
posterity: the syntax summary's last item. Notice:
SYNOPSIS
cs2cs [ -eEfIlrstvwW [ args ] ] [ +opts[=arg] ]
[ +to [+opts[=arg]] ] file[s]
This indicates that one can use the command in a file (a shell script).
But, that does not work; it just sits there with no response. Apparently,
the command runs only from the command line.
Thanks again for your clarifications,
Rich
On Thu, 3 Dec 2009, Rich Shepard wrote:
SYNOPSIS
cs2cs [ -eEfIlrstvwW [ args ] ] [ +opts[=arg] ]
[ +to [+opts[=arg]] ] file[s]
Or, that the data can be in a file but the command is entered on the CLI.
Rich
Rich Shepard wrote:
> 1. The default input format has X (easting) followed by Y (northing).
> You need to use the -r switch if the northing comes first.
>
> 2. In the absence of a trailing E or W, positive eastings are east of
> the prime meridian. You need either a leading "-" or a trailing "W"
> for eastings in the western hemisphere.
Glynn,
There's another discrepancy in the man page I should point out for
posterity: the syntax summary's last item. Notice:
SYNOPSIS
cs2cs [ -eEfIlrstvwW [ args ] ] [ +opts[=arg] ]
[ +to [+opts[=arg]] ] file[s]
This indicates that one can use the command in a file (a shell script).
But, that does not work; it just sits there with no response. Apparently,
the command runs only from the command line.
The "... file[s]" means that it you can specify the names of input
files as arguments.
There's no inherent reason why cs2cs won't work in a script, but the
cs2cs manpage won't explain any particular scripting language; those
have their own manpages.
In any case, cs2cs isn't part of GRASS, but of PROJ:
http://trac.osgeo.org/proj/
PROJ is required by GRASS, so most of the developers (and experienced
users) have some familiarity with it, but we aren't in a position to
make changes.
--
Glynn Clements <glynn@gclements.plus.com>