[GRASS-dev] [bug #5454] (grass) ps.map scaling not correct when
projection units are feet
Glynn Clements
glynn at gclements.plus.com
Tue Jan 30 06:52:47 EST 2007
Hamish wrote:
> > this bug's URL: http://intevation.de/rt/webrt?serial_num=5454
> > ---------------------------------------------------------------------
> >
> > Subject: ps.map scaling not correct when projection units are feet
>
> fixed in 6.3-CVS and 6.2 release branch. Also fixes bug #3096.
>
>
> outstanding issue, due to :
>
> > > > and a PROJ_UNITS file of:
> > > > unit: US survey foot
> > > > units: US survey foots
> Hamish:
> > > foots? ^^^^^^^
I know that "US English" tends to prefer simply tacking an "s" on the
end to using irregular plurals (e.g. "datums" rather than "data"), but
that's taking it a bit far ;)
> Tom:
> > That's what it picked on its own. I think the function that chooses
> > the plural just tacks an "s" on the end except under very specific
> > conditions.
>
> lib/gis/proj2.c, proj3.c have some pluralizing magic, but in this case
> that's the way it's stored in the PROJ_UNITS file created from EPSG code
> #2258.
>
>
> G63> g.proj -p
> -PROJ_INFO-------------------------------------------------
> name : Transverse Mercator
> proj : tmerc
> datum : nad83
> ellps : grs80
> lat_0 : 31
> lon_0 : -106.25
> k : 0.999900
> x_0 : 500000.0001016001
> y_0 : 0
> no_defs : defined
> -PROJ_UNITS------------------------------------------------
> unit : US survey foot
> units : US survey foots
> meters : 0.3048006096012192
>
>
> the only place I see "US survey foot" in the code is one line in
> lib/proj/unit_of_measure.csv.
>
> Create new locn from EPSG code is in general/g.proj/output.c,
> but I don't really follow it.
AFAICT, the problem is with GPJ_osr_to_grass(); lib/proj/convert.c:
592 dfToMeters = OSRGetLinearUnits( hSRS, &pszUnitsName );
593
594 /* Workaround for the most obvious case when unit name is unknown */
595 if( (strcasecmp(pszUnitsName, "unknown") == 0) && (dfToMeters == 1.) )
596 G_asprintf( &pszUnitsName, "meter" );
597
598 G_set_key_value( "unit", pszUnitsName, *projunits );
599 sprintf( szFormatBuf, "%ss", pszUnitsName );
600 G_set_key_value( "units", szFormatBuf, *projunits );
AFAICT, the OGR API doesn't provide a mechanism to get the plural
name, so the code will need to handle it as a special case, e.g.:
if (G_strcasecmp(pszUnitsName, "foot") == 0)
strcpy( szFormatBuf, "feet" );
else
sprintf( szFormatBuf, "%ss", pszUnitsName );
[Do we also need to handle "inchs"? ;) ]
Alternatively, it could use general/g.setproj/proj-units.table, which
has the singular and plural forms for all of the likely units (and
some rather unlikely ones, e.g. decinanometers).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list