[GRASS-user] Parse error in g.setproj?
Glynn Clements
glynn at gclements.plus.com
Wed Jan 17 15:06:22 EST 2007
[CC'd to grass-dev]
Moskovitz, Bob wrote:
> I've been trying to correct a location using g.setproj and ran into
> a problem. As you can see below, I was setting the projection to
> NAD27 State Plane in California. When I listed the counties in
> California, only the first word was displayed. So, when I was trying
> to use the state plane associated with San Francisco, I was
> surprised to find 7 lines of the word "SAN".
> Specify County FIPS (numeric) code for state CA
> Enter 'list' for the list of counties in CA with corresponding FIPS codes
> Hit RETURN to cancel request
> >list
> .
> .
> .
> 69 -- SAN <-- Should be SAN BENITO
> 71 -- SAN <-- Should be SAN BERNARDINO
> 73 -- SAN <-- Should be SAN DIEGO
> 75 -- SAN <-- Should be SAN FRANCISCO
> 77 -- SAN <-- Should be SAN JOAQUIN
> 79 -- SAN <-- Should be SAN LUIS OBISPO
> 81 -- SAN <-- Should be SAN MATEO
> 83 -- SANTA <-- Should be SANTA BARBARA
Try the attached patch.
Question for developers: is the FIPS.code file supposed to have fixed
width columns? It looks as if it should have, but it has been
corrupted due to accidental re-formatting. Is there an "official"
source for this file?
--
Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
Index: general/g.setproj/get_stp.c
===================================================================
RCS file: /grassrepository/grass6/general/g.setproj/get_stp.c,v
retrieving revision 2.2
diff -u -r2.2 get_stp.c
--- general/g.setproj/get_stp.c 1 Oct 2006 21:18:05 -0000 2.2
+++ general/g.setproj/get_stp.c 17 Jan 2007 20:02:31 -0000
@@ -272,7 +272,8 @@
G_fatal_error(buff);
}
while (fgets(buff, 80, fp) != NULL) {
- sscanf(buff, "%d%d%s%s%d", &sfips, &cfips, STabbr, COname, &NUM_ZON);
+ sscanf(buff, "%d%d%s%[A-Z ]%d", &sfips, &cfips, STabbr, COname, &NUM_ZON);
+ G_strip(COname);
if (sfips == *s) {
fprintf(Tmp_fd1, "%4d -- %s\n", cfips, COname);
fprintf(Tmp_fd2, "%d:%s\n", cfips, COname);
More information about the grass-user
mailing list