[GRASS-dev] GsoC2012: High level map interaction with python
soerengebbert at googlemail.com
Wed Apr 4 08:14:06 EDT 2012
2012/4/4 Pietro <peter.zamb at gmail.com>:
> Hi Sören,
> 2012/4/4 Sören Gebbert <soerengebbert at googlemail.com>:
>> Hi Pietro,
>> this is an interesting and very useful submission. A numpy matrix
>> interface would be a valuable addition, but as Markus Metz said, we
>> need also direct row access without reading the whole raster or vector
>> map into the memory.
> Exactly, I'm not interesting to the numpy interface, I'm interested to
> use the grass data library in a more pythonic way, similar to numpy
> but using all the smart things that GRASS have.
>> Actually with the vtk-grass-bridge there is already an object
>> orientated interface to the grass raster, vector and voxel libraries
>> providing convenient high level access classes and methods for C++,
>> Java and Python. You may orient on this interface when designing
>> the Python GRASS classes?
>>  http://code.google.com/p/vtk-grass-bridge
> Thank you for the link, I didn't know this interface. It seem quite
> far from a python style: the PEP 8 style guide (Python) says
> methodnames should be lowercase and that sometimes method_names may
> have embedded underscores ...
The VTK GRASS bridge uses the VTK style. This assures the same
convincing coding style in
C++, Java and Python. Therefore it is not Python specific but it
integrates itself into the VTK
pipeline framework to use the more than 500 existing algorithms of VTK
for image, voxel and vector processing.
For example the Delaunay triangulation is now as simple as it can be:
# Init grass variables
init = vtkGRASSInit()
# Build the VTK pipeline
# This reader does not need topology information
reader = vtkGRASSVectorPolyDataReader()
# The Delaunay triangulation
delaunay = vtkDelaunay2D()
# Start the processing (udpate) and write the resulting
# grass vector map into the grass database
writer = vtkGRASSVectorPolyDataWriter()
The idea why i am pointing you to this interface is not use use its
coding style, but to get an idea what
classes are needed and how they should be designed to access the low
level GRASS library functions.
You will have to think about this aspect too, since these access
methods are needed to implement
more complex and massive data processing ready algorithms. So maybe
the vtk-grass-bridge will give you
some interesting insights how the C-level of GRASS works?
I included developer list in CC to get this discussion back to the list
More information about the grass-dev