[GRASS5] [bug #3876] (grass) g.proj: proj4= fails, wkt= works partialy

BTW this issue with creating projection from EPSG code, which is OK now, I
re-tested all the g.proj stuff which I complained about in my original bug
report. Looks all works fine, however I have one question about differences in
units names in case when wkt or proj4 option is used.

# When I override current projection using a wkt file, the projection units
# are in small letters:

$ g.proj -c wkt=puwg1965_I.prj
$ g.proj -p
-PROJ_INFO-------------------------------------------------
name : sterea
proj : sterea
a : 6378245
es : 0.006693421622965943
lat_0 : 50.625
lon_0 : 21.08333333333333
k : 0.999800
x_0 : 4637000
y_0 : 5467000
towgs84 : 33.4297,-146.5746,-76.2865,-0.35867,-0.05283,0.84354,-0.84077
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : metre
units : metres
meters : 1

# But when I specify the same projection in proj4 syntax unit and units names
# start with a capital letter:

$ g.proj -c proj4="+proj=sterea +lat_0=50.625 +lon_0=21.08333333333333
+k=0.999800 +x_0=4637000 +y_0=5647000 +ellps=krass
+towgs84=33.4297,-146.5746,-76.2865,-0.35867,-0.05283,0.84354,-0.84077 +units=m"

$ g.proj -p
-PROJ_INFO-------------------------------------------------
name : sterea
proj : sterea
a : 6378245
es : 0.006693421622965943
lat_0 : 50.625
lon_0 : 21.08333333333333
k : 0.999800
x_0 : 4637000
y_0 : 5647000
towgs84 : 33.4297,-146.5746,-76.2865,-0.35867,-0.05283,0.84354,-0.84077
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : Meter
units : Meters
meters : 1

Why the difference? Any problems possible due to this? Even if not, could the
naming convention be unified?

Maciek

-------------------------------------------- Managed by Request Tracker

Hello Maciek

On Fri, 10 Feb 2006, Maciek Sieczka via RT wrote:

BTW this issue with creating projection from EPSG code, which is OK now, I
re-tested all the g.proj stuff which I complained about in my original bug
report. Looks all works fine,

That's good to hear :slight_smile: I'm sure there'll still be many more issues though.

however I have one question about differences in
units names in case when wkt or proj4 option is used.

# When I override current projection using a wkt file, the projection units
# are in small letters:

Does the WKT file specifically specify the units? If so then the value for "unit" will be taken from there. The WKT format doesn't have a way to specify a separate word for the plural like GRASS does so the letter 's' is simply added to the end for that. You can edit the PROJ_UNITS file later if you want.

I think that the unit names in PROJ_UNITS are only used for display purposes, e.g. in some d.* modules.

# But when I specify the same projection in proj4 syntax unit and units names
# start with a capital letter:

And also, American spelling. Well the PROJ-style string doesn't contain a word for the unit name, so presumably some default is coming from somewhere within GDAL/OGR. (I think I said this before but just to be clear, PROJ.4 isn't involved at all in parsing this string; it is all done in GDAL/OGR, which "interprets" the string.)

Why the difference? Any problems possible due to this? Even if not, could the
naming convention be unified?

The unit names are not coming from within GRASS so I don't think this is possible. I also don't see it as a big problem. You can also manually edit the PROJ_UNITS file if you really want to fix it. It is designed to be easily human-readable and editable.

It is just a by-product of the convenience of creating GRASS-native projection files from other sources, which don't always have as much information as the GRASS files do so "reasonable defaults" have to be filled in, and these can vary, as you have seen.

Paul