Send grass-windows mailing list submissions to
        grass-windows@lists.osgeo.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.osgeo.org/mailman/listinfo/grass-windows
or, via email, send a message with subject or body 'help' to
        grass-windows-requ...@lists.osgeo.org

You can reach the person managing the list at
        grass-windows-ow...@lists.osgeo.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of grass-windows digest..."


Today's Topics:

   1. Integrated viewshed analysis (Brian Sanjeewa Rupasinghe)
   2. Still cannot get GRASS to work with Python 2.6
      (Natalie Suzanne Robinson)


----------------------------------------------------------------------

Message: 1
Date: Sat, 5 Jan 2013 21:09:38 +0530
From: Brian Sanjeewa Rupasinghe <jink...@gmail.com>
To: grass-windows@lists.osgeo.org
Subject: [GRASS-windows] Integrated viewshed analysis
Message-ID:
        <CAEMA-4hU1u5T-BJW8gru9=rpjae62m4dtyzoceazyjp3hvk...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I need to do integrated viewshed analysis of a target with several observer
locations. I am going to use r.viewshed analysis function in GRASS. With
this function, it is possible to perform analysis based on single observer
location. My aim is to add output of each single observer location into
integrated viewshed output. Each output, i am going to flag with -b where o
denotes non-visible while 1 denotes visible. Through a loop of observer
locations, output of viewshed of each location can be integrated with
r.mapcalc function. After integration, values = 0 in the rater map dentoes
non-visible areas and value >= 1 denotes visible areas. Under the loop of
observer locations I just used r.mapcalc function with each viewshed
adding. After getting the integrated viewshed raster, i need to extract its
boundary depicting visible area in vector format. How to do that in GRASS?


Using IterateFile method, i read observer locations and with
GenerateViewshed method, i calculate each single viewshed of a particular
location. Then with r.mapcalc, i integrated all viewsheds. I want to find
if r.mapcalc python code i have used is correct. If it is correct, how to
extract the boundary of the visible area in vector format?


def IterateFile(infile):

    i=0

    for line in fileinput.input(infile):

        values = string.split(line,",")

        pid = values[0]

        print pid

        e = values[2]

        print e

        n = values[1]

        print n

        z = values[3]

        print z

        GenerateViewshed(e,n,1.5,25,i)

        i = i + 1



def GenerateViewshed(x,y,oelv,th,i):

    standard_DEM = options['standardDEM']

    output = options['outputmap']

    grass.run_command('r.viewshed', input=standard_DEM,
output='viewshed',coordinate=[x,y], obs_elev=oelv,

tgt_elev=th,memory=4098,b=True,overwrite=True,quiet=True)

    if i==0:

        grass.mapcalc('output = viewshed + 0')

    if i>=1:

        grass.mapcalc('output = viewshed + output')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.osgeo.org/pipermail/grass-windows/attachments/20130105/7553eeca/attachment-0001.html>

------------------------------

Message: 2
Date: Sat, 5 Jan 2013 12:06:25 -0700
From: Natalie Suzanne Robinson <n.robin...@colorado.edu>
To: <grass-windows@lists.osgeo.org>
Subject: [GRASS-windows] Still cannot get GRASS to work with Python
        2.6
Message-ID: <000001cdeb77$c31f33d0$495d9b70$@robin...@colorado.edu>
Content-Type: text/plain;       charset="iso-8859-1"

Hello all,

    I am new to this list, but have read many, many posts!  I am having a
frequently encountered issue- namely configuring GRASS to work with Python
2.6 (an external version, as opposed to the bundled version). Many apologies
if this has been solved somewhere, but after about a week of searching I
have not found a solution that works for me.

    Here is the info on what my computer runs, what I have done, and what I
am encountering. Any help would be MUCH appreciated, I am at my wits end and
about to throw my computer through a window (and send some hate mail to
Microsoft).

?? System: 
     ? Windows 7, 64-bit (but I use 32-bit versions of Python, GRASS, etc.
due to ArcGIS)
     ? Installed: ArcGIS 10.0, Python 2.6 (with wxPython, PyWin32,
distribute, 
                  setuptools, NumPy, iPython), GRASS 6.4.2. All
instillations 
                  are compatible (all= 32-bit, compatible with Python 2.6,
etc.) 
                  *I have also tried to install GRASS 6.4.3RC2-1, with the
same 
                  Problem as described below*

???What I?ve done: 
      1) As recommended at:
http://osgeo-org.1560.n6.nabble.com/GRASS-ArcGIS-and-Python-incompatibilties
-td4984692.html, I have done the following-
 
           In Windows Environmental Variables: Set ?GRASS_PYTHON? to
C:\Python26\python.exe
                                               Added %GISBASE%\etc\python to
?PYTHONPATH?
           In Init.bat: Removed %PYTHONPATH% from ?PYTHONPATH? setting 
                          (line now reads
?PYTHONPATH=%GISBASE%\etc\python;%GISBASE%\etc\wxpython?)
           In env.bat: Unset PYTHONHOME
                          (line now reads: set PYTHONHOME=""
                                           if "x%GRASS_PYTHON%" == "x" set
GRASS_PYTHON=python)
        
       2) Removed the Python27 folder from the GRASS installation 


???What I am experiencing:
       1) Python26 starts from command line, and seems to work correctly
(imports 
              modules like numpy, arcpy, wx)
       2) iPython also starts from command line, and seems to run correctly
       3) GRASS fails completely, with the following specifications:
             A) The old TclTk GUI starts OK, but I don?t want to use this
             B) When I start from GRASS 6.4.2 GUI with MSYS I get:

                Starting GRASS ...
                    'import site' failed; use -v for traceback
                    ERROR: wxGUI requires wxPython. No module named wx
                    Error in GUI startup. If necessary, please
                           report this error to the GRASS developers.
                    Switching to text mode now.
                    Hit RETURN to continue...
   
             *Whereupon hitting RETURN or typing <-v> RETURN both result in
the 
                 program failing to launch (just shuts down)*

             C) When I start the command line, the same complete failure to
launch occurs 
                  (a box flashes for about 1 millisecond, so I can?t even
see what is wrong).


    This makes me think that the root of the problem is that GRASS is not
finding the outside version of Python (otherwise why would it fail to find
wx when that module imports correctly in Python??)

    Thank-you SO much in advance for any assistance.

    Cheers,

Natalie Robinson
Department of Ecology and Evolutionary Biology
University of Colorado
(303) 492-5175
n.robin...@colorado.edu




------------------------------

_______________________________________________
grass-windows mailing list
grass-windows@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-windows


End of grass-windows Digest, Vol 69, Issue 3
********************************************

Reply via email to