[GRASS-dev] r.digit

Vaclav Petras wenzeslaus at gmail.com
Mon Dec 17 02:46:19 PST 2012


On 17 December 2012 10:58, Mohammed Rashad <mohammedrashadkm at gmail.com> wrote:
> All,
>
> What I am thinking of is a python version of r.in.poly which can create
> area, line, circle from a list of (x,y) coordinates captured from wxGUI Map
> display
>
> r.in.poly reads from file or stdin. Using pyGRASS/ grass ctypes api we can
> create objects in raster file.
>
But keep in mind that GUI should not call grass C libraries directly
but should call modules if possible. Digitizer is now one of the
exceptions. But we should avoid adding more exceptions, I think.

(Calling library functions from GUI is often needed for better
flexibility (or performance issues?) and, as you probably know, we are
still reconsidering current approaches but still there is no final
solution to this problem.)
>
>
>
> On Mon, Dec 17, 2012 at 2:30 PM, Pietro <peter.zamb at gmail.com> wrote:
>>
>> Hi Hamish,
>>
>> On Mon, Dec 17, 2012 at 4:36 AM, Hamish <hamish_b at yahoo.com> wrote:
>> > for my 2c it's quite nice to have a dedicated raster digitizing
>> > option, instead of needing an extra v.in.ascii -> v.to.rast
>> > step in your workflow. That doesn't rule out a wrapper script
>> > to hide the vector part of it, but a dedicated r.in.poly mode
>> > would both be more efficient and perhaps less prone to loss in
>> > fidelity.
>>
>> I think that should be possible to use the geometry feature of the
>> vector api of pygrass,
>>
>> >>> from grass import pygrass
>> >>> from pygrass.vector.geometry import Point, Line
>> >>> pnt = Point(10, 100)
>> >>> line = Line([(0, 0), (1, 1), (2, 0), (1, -1)])
>> >>> line.c_points  # return the ctypes pointer to the line_points struct
>> <grass.lib.ctypes_preamble.LP_struct_line_pnts object at 0x2aa1440>
>>
>> even if is not deeply tested...
>>
>> get more example from here:
>>
>>
>> http://www.ing.unitn.it/~zambelli/projects/pygrass/vector.html#vector-features
>>
>>
>> Pietro
>
>
>
>
> --
> Regards,
>    Rashad
>


More information about the grass-dev mailing list