Re: [GRASS-user] r.viewshed Python Script OSError
Hi Markus, Thank you for the link, that is very helpful. I would prefer to use SEXTANTE over GRASS since it also gives access to other tools as well, but so far I have had more luck with GRASS. I will post an update once one of these approaches works. I've compiled and installed GRASS 6.4.3RC3 from source, but now I'm having trouble installing the r.viewshed extension. I'm getting the following error: make: *** No rule to make target `/usr/local/grass-6.4.3RC3/ lib/libgrass_iostream.6.4.3RC3.a', needed by `/home/mlacayo/grass/newLocation/PERMANENT/.tmp/ncp- cloos/10168.0/r.viewshed/bin/r.viewshed'. Stop. ERROR: Compilation failed, sorry. Please check above error messages. (Wed May 29 11:53:36 2013) Command finished (7 sec) As a test I tried installing g.md5sum and r.area, which installed without problems. Any suggestions? -Martin On Tue, May 28, 2013 at 11:20 AM, Markus Metz markus.metz.gisw...@gmail.com wrote: On Tue, May 28, 2013 at 7:09 PM, Martin Lacayo mlac...@stanford.edu wrote: Hi Markus, I did install r.viewshed (it is located in ~/.grass6/addons/), and the full path does appear in $PATH. I am executing the Python script from outside of GRASS. Is this normal? I am hoping for some advice on this. You need to execute the Python script from within GRASS, or set some environment variables first, see [1]. Within your script, you could also first use a dummy location, for example the GRASS demolocation, then create a new location with the projection information in the raster map to be used as input for r.viewshed, change to that location, import the raster map, run r.viewshed, export the result. This is essentially what the SEXTANTE plugin in QGIS is doing. The intent is to liberate some software (naturalcapitalproject.org) from ArcGIS for users on Windows. Nice! When I start GRASS (in text mode) it says Welcome to GRASS 6.4.2 (2012). If possible, update to GRASS 6.4.3. HTH, Markus M [1] http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly Thank you, Martin On Sun, May 26, 2013 at 1:27 PM, Markus Metz markus.metz.gisw...@gmail.com wrote: On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo mlac...@stanford.edu wrote: Hello, I am using GRASS 6.4 on Debian. I am trying to make a call to r.viewshed from Python, but it fails with the following exception: OSError: [Errno 2] No such file or directory Any suggestions? Did you install r.viewshed? Where is the r.viewshed binary? Is the location of r.viewshed in the PATH (within GRASS, test with echo $PATH)? Did you execute the python script from within GRASS? Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn. Markus M ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] r.viewshed Python Script OSError
Hi Markus, I did install r.viewshed (it is located in ~/.grass6/addons/), and the full path does appear in $PATH. I am executing the Python script from outside of GRASS. Is this normal? I am hoping for some advice on this. The intent is to liberate some software (naturalcapitalproject.org) from ArcGIS for users on Windows. When I start GRASS (in text mode) it says Welcome to GRASS 6.4.2 (2012). Thank you, Martin On Sun, May 26, 2013 at 1:27 PM, Markus Metz markus.metz.gisw...@gmail.com wrote: On Fri, May 24, 2013 at 11:32 PM, Martin Lacayo mlac...@stanford.edu wrote: Hello, I am using GRASS 6.4 on Debian. I am trying to make a call to r.viewshed from Python, but it fails with the following exception: OSError: [Errno 2] No such file or directory Any suggestions? Did you install r.viewshed? Where is the r.viewshed binary? Is the location of r.viewshed in the PATH (within GRASS, test with echo $PATH)? Did you execute the python script from within GRASS? Which GRASS 6.4 version are you using? Recommended is 6.4.3.svn. Markus M ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Getting Started with GRASS Python Scripts
Hello Paolo, Yes, my initial thought was to just use GRASS via SEXTANTE. I tired to do this, but did not have any luck. I posted previously on 14/5/2013 to qgis-users with the subject How to run SEXTANTE algorithms outside of QGIS Python console? but did not get a solution to the problem I encountered, which I thought was related to creating a QGIS instance so that I could make calls to SEXTANTE. If you have any suggestions that would be much appreciated. Thank you, Martin On Fri, May 24, 2013 at 12:37 AM, Paolo Cavallini cavall...@faunalia.it wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 23/05/2013 22:49, Martin Lacayo ha scritto: My ultimate goal is to decrease our development time for our open source ecosystem service tools: http://invest-natcap.googlecode.com, but more specifically at the moment I am trying to use r.viewshed so I do not have to write my own. Why not using GRASS through SEXTANTE for this? In this case you have nothing to do, just call whatever module you need. All the best. - -- Paolo Cavallini - Faunalia www.faunalia.eu Full contact details at www.faunalia.eu/pc Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlGfGNUACgkQ/NedwLUzIr5QQQCcCyEDZmgSjTO2gnRC+Jk5jGRf 1esAmwSA0nx2cNbrRNNBkPtcotrdZvHt =NNfh -END PGP SIGNATURE- ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] r.viewshed Python Script OSError
Hello, I am using GRASS 6.4 on Debian. I am trying to make a call to r.viewshed from Python, but it fails with the following exception: OSError: [Errno 2] No such file or directory Any suggestions? Thank you, Martin ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Getting Started with GRASS Python Scripts
Hello, I am having trouble getting started with GRASS Python scripts. I am using GRASS 6.4 on Debian. Could some provide a basic example of a Python script that imports a raster and exports the same raster? In particular I am interested in seeing the entire setup of a database (locally on disk), location, and mapset from start to finish. Every example I have found starts with an existing database, location, and mapset. I have been able to get past this part by using the GUI, but I need to be able to script their creation. Have I understood correctly that a database can only contain one projection, which is set when it is first created, and that besides importing and exporting data all processing has to happen with data that is in the database? My ultimate goal is to decrease our development time for our open source ecosystem service tools: http://invest-natcap.googlecode.com, but more specifically at the moment I am trying to use r.viewshed so I do not have to write my own. Is it possible to script the creation of a database (locally on disk), location, and mapset? And how would you remove them afterwards? Any help or references would be very appreciated. Thank you, Martin ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Getting Started with GRASS Python Scripts
Rich, Thank you. Yes, that does help. I hadn't realized that in this case database was essentially synonymous with user directory. Several things have now clicked into place. -Martin On Thu, May 23, 2013 at 2:06 PM, Rich Shepard rshep...@appl-ecosys.com wrote: On Thu, 23 May 2013, Martin Lacayo wrote: Have I understood correctly that a database can only contain one projection, which is set when it is first created, and that besides importing and exporting data all processing has to happen with data that is in the database? Martin, You seem to confuse database, location, and mapset. There is only one database (here, it's in /home/rshepard/grassdata/) where everything is stored. The database can contain multiple locations, each one with a specific projection. For example, I have a number of projects in Washington state so I have (among others) Washington-Counties/, Washington-HUC/, Washington-Hydro/, Washington-LL/, Washington-NED/, and Washington-NHD/. Notice that Washington-LL is in long/lat; others might be in SPCS, UTM, or whatever other projection is used by the data source. I also have project-specific locations. Each of these has a basic PERMANENT/ map se and multiple other map sets that might have different boundaries, themes, and so on. HTH, Rich -- Richard B. Shepard, Ph.D. | Have knowledge, will travel. Applied Ecosystem Services, Inc. | http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Getting Started with GRASS Python Scripts
I think I have now figured out most of the answers to my question, but I am still wondering about some file management. Is the following command a normal way to make a location with a projection from a georeferenced file: g.proj -c georef=/home/user/raster.tif location=example Is there a command to delete a location? I found g.mremove, but that seems to remove data, not locations. Thank you, Martin On Thu, May 23, 2013 at 3:02 PM, Rich Shepard rshep...@appl-ecosys.com wrote: On Thu, 23 May 2013, Martin Lacayo wrote: Thank you. Yes, that does help. I hadn't realized that in this case database was essentially synonymous with user directory. Several things have now clicked into place. Martin, Yeah, it ain't intuitive. :-) Took me a while to get my head around the GRASS structure, but that was with 4.0. It's sunk in over the years since then. Rich -- Richard B. Shepard, Ph.D. | Have knowledge, will travel. Applied Ecosystem Services, Inc. | http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user