<div dir="ltr"><div dir="ltr"><br><br>On Thu, Mar 28, 2019 at 9:02 AM Maris Nartiss <<a href="mailto:maris.gis@gmail.com">maris.gis@gmail.com</a>> wrote:<br>><br>> Hello Facundo,<br>> the easiest way would be moving functions of v.generalize into a<br>> library (e.g. grass_generalize) and thus make available for calling<br>> via ctypes.<br>> In the past I have had a good success manipulating GRASS vectors via<br>> ctypes. It takes more skill than a plain Python implementation but it<br>> is easier than a full blown C code and faster than pure Python one.<br>><br>> Māris.<br>><br>> ceturtd., 2019. g. 28. marts, plkst. 03:13 — lietotājs Facundo Ferrin<br>> (<<a href="mailto:facundo.ferrin@gmail.com">facundo.ferrin@gmail.com</a>>) rakstīja:<br>> ><br>> > Hi Luca!<br>> ><br>> > Thanks for replying! In my job, there were things we had to do programmatically. For example, to manipulate geometries that reach the backend from a GeoJSON we use tools like these:<br>> ><br>> > <a href="https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html#create-geometry-from-wkt">https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html#create-geometry-from-wkt</a><br>> ><br>> > However, polygon simplification does not work very well because it does not take topology into account. My idea was to port part of the GRASS algorithms to be able to use them without needing the graphical interface or command line, but only importing a library in a Python script.<br><div><br></div><div>In this particular case, the core of the corresponding python script would be three lines (import, simplify, export):</div><div><br></div><div>--><br></div><div>import grass.script as grass</div><div><br></div><div>grass.run_command('v.in.ogr', ...)</div><div><div>grass.run_command('v.generalize', ...)</div><div><div>grass.run_command('v.out.ogr', ...)</div><div><--<br></div><div><br></div><div>The import step with v.in.ogr is needed because the vector to be simplified must be a native GRASS vector with topology.</div><div><br></div><div>How does your proposal differ from the QGIS-GRASS interface?<br></div><div><br></div><div>Markus M<br></div></div></div><div>> ></div>> > Is it something that you have in mind to do or that might be useful to you?<br>> ><br>> ><br>> > El jue., 28 de mar. de 2019 a la(s) 00:32, Luca Delucchi (<a href="mailto:lucadeluge@gmail.com">lucadeluge@gmail.com</a>) escribió:<br>> >><br>> >> On Tue, 26 Mar 2019 at 03:11, Facundo Ferrin <<a href="mailto:facundo.ferrin@gmail.com">facundo.ferrin@gmail.com</a>> wrote:<br>> >> ><br>> >> > Hi there!<br>> >><br>> >> Hi Facundo,<br>> >> ><br>> >> ><br>> >> > My name is Facundo Ferrin. I am a nuclear engineer who is taking a master in Computer Vision in Barcelona, and finally I found my opportunity to contribute to OSGeo by applying two things that I really like: Python and Backend development . I do not know exactly what I should write in this first email, so I'll start by listing the projects I'm interested in.<br>> >> ><br>> >> > I'm working in a company that is developing a platform for precision agriculture called Auravant (<a href="https://www.auravant.com/">https://www.auravant.com/</a>). I work as a backend developer and data analyst and I use daily almost every tool that you post in the ideas: GeoServer, PostGIS, QGis. I'm also porting a tool for polygon simplification called topoJSON (<a href="https://github.com/fferrin/topojson">https://github.com/fferrin/topojson</a>).<br>> >> ><br>> >> > ---<br>> >> > MY MAIN IDEA is to start porting GRASS tools into a python package that can be used in other projects (beyond the client to use by command line). I don't know if it's something you have in mind but for offline and automated analysis it would be very useful. I particularly had problems when I tried to simplify geometries since the geometry of polygons was not taken into account.<br>> >> > ---<br>> >><br>> >> Your idea is not clear to me, there are already two Python library to<br>> >> work with GRASS. you can find some ideas in the proposal page<br>> >> <a href="https://trac.osgeo.org/grass/wiki/GSoC/2019">https://trac.osgeo.org/grass/wiki/GSoC/2019</a> (for example<br>> >> Neweasy-to-useCLIandAPIforGRASSGIS) and<br>> >> <a href="https://trac.osgeo.org/grass/wiki/GSoC/2018">https://trac.osgeo.org/grass/wiki/GSoC/2018</a> (Improve GRASS integration<br>> >> in QGIS 3)<br>> >><br>> >> > Hope to hear from you soon!<br>> >> ><br>> >><br>> >> --<br>> >> ciao<br>> >> Luca<br>> >><br>> >> <a href="http://www.lucadelu.org">www.lucadelu.org</a><br>> ><br>> > _______________________________________________<br>> > grass-dev mailing list<br>> > <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> > <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a></div></div>