[GRASS-dev] Re: [GRASS GIS] #1424: Profile tool always casts to integers (incl. csv output)

GRASS GIS trac at osgeo.org
Sat Aug 20 09:16:48 EDT 2011


#1424: Profile tool always casts to integers (incl. csv output)
-------------------------------------+--------------------------------------
 Reporter:  hamish                   |       Owner:  grass-dev@…              
     Type:  defect                   |      Status:  new                      
 Priority:  major                    |   Milestone:  6.4.2                    
Component:  wxGUI                    |     Version:  svn-releasebranch64      
 Keywords:  profile tool, precision  |    Platform:  All                      
      Cpu:  All                      |  
-------------------------------------+--------------------------------------

Comment(by hamish):

 Replying to [comment:3 glynn]:
 > That will give the wrong answer for all locations; Python follows C and
 > uses `^` for the bitwise exclusive-or operator. Exponentiation uses `**`
 > (which should be preferred over math.pow()), i.e. sqrt(a**2 + b**2).

 oh, I was just pseudo-coding. The actual python code uses math.pow(,2)


 > However, Python's math module also has a hypot() function, which
 > is probably the optimal approach here.

 but not if the map units are in degrees, which is why I'm looking for a
 python front-end to G_distance(), or failing that a pipe_command() to the
 m.measure module.


 finishing a patch for the `%d` problem,
 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/1424#comment:4>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list