[GRASS-dev] Proj4 string not shown in loc wiz when creating new location from file

Hi,

greetings from the amazing FOSS4G-CEE here in Bucharest
http://2013.foss4g-cee.org/program/schedule

Preparing my slides I remembered an issue that the proj4 string is not
shown in case of generating a new location from a GeoTIFF (attached)
or SHP.

When using EPSG code as base for the new location this works fine.

I can of course open a ticket but perhaps it is just an "easy"
omission in the code.
Maybe Hamish who looked into this code part recently has an idea?

thanks
Markus

(attachments)

eu_elevation.tif (2.36 KB)
loc_wiz_bug_proj4_string_not_shown.png

MarkusN wrote:

greetings from the amazing FOSS4G-CEE here in Bucharest
http://2013.foss4g-cee.org/program/schedule

and greetings back to all you meet there, :slight_smile:
will your history of geoFOSS slides go online?

Preparing my slides I remembered an issue that the proj4 string is not
shown in case of generating a new location from a GeoTIFF (attached)
or SHP.

hmmm, I tested that a couple weeks ago and it was working, but now it doesn't
work for me using either your sample tiff or some I have locally. WKT & .prj
creation method similarly has no output in the summary page, same with .shp.
The locations are created ok though except I don't get prompted for datum
transform terms.

When using EPSG code as base for the new location this works fine.

I can of course open a ticket but perhaps it is just an "easy"
omission in the code.

Some tests:

gdalinfo shows:
{{{
PROJCS["Lambert Azimuthal Equal Area",
GEOGCS["GCS Name = grs80|Ellipsoid = Geodetic_Reference_System_1980|Primem = Greenwich|",
DATUM["European_Terrestrial_Reference_System_1989",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6258"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]],
PROJECTION["Lambert_Azimuthal_Equal_Area"],
PARAMETER["latitude_of_center",52],
PARAMETER["longitude_of_center",10],
PARAMETER["false_easting",4321000],
PARAMETER["false_northing",3210000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
}}}

here is a little shell script to create a .prj file from that:
{{{
GEOTIFF=eu_elevation.tif
TOP=`gdalinfo "$GEOTIFF" | grep -n -m 1 '^Coordinate System is:$' | cut -f1 -d:`
BOT=`gdalinfo "$GEOTIFF" | grep -n -m 1 '^Origin = ' | cut -f1 -d:`
BOT=`expr "$BOT" - 1`
LINES=`expr "$BOT" - "$TOP"`

gdalinfo "$GEOTIFF" | head -n "$BOT" | tail -n "$LINES" > `basename "$GEOTIFF" .tif`.prj
}}}

Is the first term of the above GEOGCS string legit or is it a r.out.gdal string error?
(it doesn't seem to be the problem though, with the other GeoTiff I had locally with
just "international" datum there, it still gave no +proj terms in the summary)

Using 'create new location from georef'd file' (latest 6.4.3svn) I end up with a
new location showing:

{{{
-PROJ_INFO-------------------------------------------------
name : Lambert Azimuthal Equal Area
proj : laea
datum : etrs89
ellps : grs80
lat_0 : 52
lon_0 : 10
x_0 : 4321000
y_0 : 3210000
no_defs : defined
-PROJ_UNITS------------------------------------------------
unit : metre
units : metres
meters : 1
}}}

which looks ok. I think the only data loss there is the Primem = Greenwich,
but that may just be left off as matching the default.

I'll have a look at the code... perhaps due to a glitch in the last commit there.

Hamish

Hamish:

hmmm, I tested that a couple weeks ago and it was working, but now it

doesn't work for me

nope, there is only code for generating the +proj4 terms in the Summary page
for epsg and custom +proj terms (incl. defined from the table).
(location_wizard.py line ~ 1659)

from geofile, wkt, and xy you get nothing for the summary.

I'm adding that now, but since it's just cosmetic and needs weeks of testing
I would not delay 6.4.3 for it. The more important side of that (which is
the main bit that needs testing) is detecting if it should ask you to set
datum transform terms.

Hamish

On Wed, Jun 19, 2013 at 6:42 AM, Hamish <hamish_b@yahoo.com> wrote:

MarkusN wrote:

greetings from the amazing FOSS4G-CEE here in Bucharest
http://2013.foss4g-cee.org/program/schedule

and greetings back to all you meet there, :slight_smile:
will your history of geoFOSS slides go online?

Sure:

http://www.slideshare.net/markusN/scaling-up-globally-30-years-of-foss4g-development-keynote-at-foss4gcee-2013-romania

...

Is the first term of the above GEOGCS string legit or is it a r.out.gdal string error?

Which string exactly? The file I generated like this:

- new GRASS location with EPSG:3035 from cmd line
- get into it, hence you are in a 1x2 current region
- r.mapcalc "eu_elevation = 1"
- r,out.gdal

Using Proj 4.8.0, 6 March 2012

Markus