[GRASS-dev] r.digit

Mohammed Rashad mohammedrashadkm at gmail.com
Mon Dec 17 03:34:50 PST 2012


On Mon, Dec 17, 2012 at 4:16 PM, Vaclav Petras <wenzeslaus at gmail.com> wrote:

> 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.
>

graster.Rast_open_c_new() is allowed?

if not can you provide an example?


>
> (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
> >
>



-- 
Regards,
   Rashad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20121217/cf4a98cb/attachment-0001.html>


More information about the grass-dev mailing list