[GRASS-user] Re: Get current location projection in a Python Script

Glynn Clements glynn at gclements.plus.com
Thu May 27 15:47:11 EDT 2010


Kim Besson wrote:

> regarding the use of regiondict = grass.region() , Does this
> retrieves Projection EPSG code?

No. You can get projection information as a Python dictionary with
e.g.:

    s = grass.read_command("g.proj", flags='j')
    kv = grass.parse_key_val(s)

In 7.0, use:

	fgrep g.proj $GISBASE/scripts/*.py

for examples.

However: I don't know whether the EPSG code is actually stored in the
PROJ_INFO file, or whether it just stores the parameters. If it's the
latter, then there's no way to retrieve an EPSG code. And that's
assuming that the location was created using an EPSG code in the first
place, which isn't guaranteed.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list