1

How can I set the Grass Region in Python without already having a map in the Mapset? Basically I am looking for the equivalent to this window

enter image description here

Currently I am only able to extent an existing region, which leads in my case to very big regions.

asked Nov 14, 2013 at 0:43

1 Answer 1

5

How about this:

import grass.script as grass
grass.run_command('g.region', n=10, s=9, e=35, w=33, ewres=0.1, nsres=0.2, verbose=True, flags='p')
 projection: 3 (Latitude-Longitude)
 zone: 0
 datum: wgs84
 ellipsoid: wgs84
 north: 10N
 south: 9N
 west: 33E
 east: 35E
 nsres: 0:12
 ewres: 0:06
 rows: 5
 cols: 20
 cells: 100
answered Nov 14, 2013 at 12:08
2
  • g.region requires in my Grass (6.4.3) a parameter <map> (Raster map to change). What version are you on? What am I doing wrong? In the documentation I don't see this parameter either. Commented Nov 14, 2013 at 18:13
  • No, g.region works on the overall "computational region", and is not specific to one map. That's the same for all version. THere is a different command, r.region which changes the extent and resolution of a single raster. Is that what you meant? Commented Nov 16, 2013 at 11:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.