[GRASS-dev] port of v.points.cog to python

Hello,

Here is a rewrite of the v.points.cog module in python. I tried
translating code only, keeping the code organization, variables names as it
was previously to help those who would want to review the differences
with the shell script. I also did the few changes required for changes
in grass7, but there weren't that much since python function already
abstract some commands.

I did a svn copy of the grass6 module before doing the modifications.

I cannot (and don't want to...) claim any copyright on a code translation.

I didn't test thoroughly, but since it is code translation, I don't expect
big surprises.

--
Pat

(attachments)

v_points_cog_python_70.diff (11.5 KB)

Hello Patrice,

On Sun, Mar 1, 2015 at 5:01 PM, Patrice Dumas <pertusus@free.fr> wrote:

Hello,

Here is a rewrite of the v.points.cog module in python. I tried
translating code only, keeping the code organization, variables names as it
was previously to help those who would want to review the differences
with the shell script. I also did the few changes required for changes
in grass7, but there weren't that much since python function already
abstract some commands.

I did a svn copy of the grass6 module before doing the modifications.

I cannot (and don't want to...) claim any copyright on a code translation.

I didn't test thoroughly, but since it is code translation, I don't expect
big surprises.

Thanks for your efforts. What about you gaining access to the SVN
Addon repo for easier code management? It then would become available
for "g.extension" as well.

See for details:
http://grass.osgeo.org/get-involved/
--> Developing new Add-ons

best
Markus

On Sun, Mar 1, 2015 at 5:01 PM, Patrice Dumas <pertusus@free.fr> wrote:

Hello,

Here is a rewrite of the v.points.cog module in python.

I think v.points.cog is superseded by v.centerpoint which offers cog
as well as other kinds of centerpoints.

Markus M

I tried
translating code only, keeping the code organization, variables names as it
was previously to help those who would want to review the differences
with the shell script. I also did the few changes required for changes
in grass7, but there weren't that much since python function already
abstract some commands.

I did a svn copy of the grass6 module before doing the modifications.

I cannot (and don't want to...) claim any copyright on a code translation.

I didn't test thoroughly, but since it is code translation, I don't expect
big surprises.

--
Pat

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Sat, Mar 07, 2015 at 11:16:21AM +0100, Moritz Lennert wrote:

Am 07.03.2015 10:43 schrieb Markus Metz:
>On Sun, Mar 1, 2015 at 5:01 PM, Patrice Dumas <pertusus@free.fr> wrote:
>>Hello,
>>
>>Here is a rewrite of the v.points.cog module in python.
>
>I think v.points.cog is superseded by v.centerpoint which offers cog
>as well as other kinds of centerpoints.

AFAIR, v.points.cog offers the possibility to get cog for clusters
of points defined by an attribute. v.centerpoint does not offer
this. So, either it might be interesting to add this to
v.centerpoint, or to rewrite v.points.cog as a wrapper around
v.centerpoint.

I think that using v.centerpoint in v.points.cog would be the best, as
it would then be possible to add a pcenter= option to v.points.cog to be
able to use v.centerpoint other possibilities.

I can do that, but I think that it is best to first commit the
translation of v.points.cog as is and in a second step add the call to
v.centerpoints instead of duplicating in v.points.cog what
v.centerpoints does.

Is it ok?

--
Pat

On Sat, Mar 7, 2015 at 4:43 AM, Markus Metz <markus.metz.giswork@gmail.com>
wrote:

On Sun, Mar 1, 2015 at 5:01 PM, Patrice Dumas <pertusus@free.fr> wrote:
> Hello,
>
> Here is a rewrite of the v.points.cog module in python.

I think v.points.cog is superseded by v.centerpoint which offers cog
as well as other kinds of centerpoints.

BTW, is there any reason to keep v.centerpoint as addon? It seems to be

quite popular.

Anna

Markus M

> I tried
> translating code only, keeping the code organization, variables names as
it
> was previously to help those who would want to review the differences
> with the shell script. I also did the few changes required for changes
> in grass7, but there weren't that much since python function already
> abstract some commands.
>
> I did a svn copy of the grass6 module before doing the modifications.
>
> I cannot (and don't want to...) claim any copyright on a code
translation.
>
> I didn't test thoroughly, but since it is code translation, I don't
expect
> big surprises.
>
> --
> Pat
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Mar 7, 2015 2:07 PM, “Anna Petrášová” <kratochanna@gmail.com> wrote:

On Sat, Mar 7, 2015 at 4:43 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Sun, Mar 1, 2015 at 5:01 PM, Patrice Dumas <pertusus@free.fr> wrote:

Hello,

Here is a rewrite of the v.points.cog module in python.

I think v.points.cog is superseded by v.centerpoint which offers cog
as well as other kinds of centerpoints.

BTW, is there any reason to keep v.centerpoint as addon? It seems to be quite popular.

Right. Perhaps move to trunk along with a test case?

markusN

Anna

Markus M

I tried
translating code only, keeping the code organization, variables names as it
was previously to help those who would want to review the differences
with the shell script. I also did the few changes required for changes
in grass7, but there weren’t that much since python function already
abstract some commands.

I did a svn copy of the grass6 module before doing the modifications.

I cannot (and don’t want to…) claim any copyright on a code translation.

I didn’t test thoroughly, but since it is code translation, I don’t expect
big surprises.


Pat


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On 01/03/15 17:01, Patrice Dumas wrote:

Hello,

Here is a rewrite of the v.points.cog module in python. I tried
translating code only, keeping the code organization, variables names as it
was previously to help those who would want to review the differences
with the shell script. I also did the few changes required for changes
in grass7, but there weren't that much since python function already
abstract some commands.

I did a svn copy of the grass6 module before doing the modifications.

I cannot (and don't want to...) claim any copyright on a code translation.

I didn't test thoroughly, but since it is code translation, I don't expect
big surprises.

Coming back to this: MarkusM, how difficult would it be to integrate that functionality directly into v.centerpoint, i.e. something like this:

v.centerpoint ... use=attr column=
and
v.centerpoint ... use=cat

which would create one centerpoint for each collection of features with the same value for attr or cat ?

One use case I'm confronted with right now is that I use v.cluster and want to find the cluster centers to then get statistics about distance to cluster centers within each cluster. Currently, I have to loop through the cluster and run v.centerpoint on each.

Moritz