[Gvsig_english] gvSIG 1.11: add consecutive numbers to selection?

Nacho Uve nachouve at gmail.com
Thu Mar 29 19:20:13 CEST 2012


Antonio, great trick!!

We have to do a manual "Jython for gvSIG" and also create a repo with such
scripts, functions and CodeSnippets. I think it will be a great success!

I've tried to do some tests from scripts Antonio on github. But I think
it's better to do something collaboratively ... What do think?

Regards,
Nacho V


2012/3/29 Francisco Puga <fpuga at cartolab.es>

> guou, it works like a charm. Thanks Antonio.
>
> I didn't remember about the "global" operator of python to allow set a
> counter for various rows. Very nice tip.
>
> El día 28 de marzo de 2012 14:36, Antonio Falciano
> <afalciano at yahoo.it> escribió:
> > Hi all,
> > field expression is based on the values of the same row, however field
> > calculator commands are Jython's functions. So it's possible to memorize
> > a variable during field calculations using the advanced tab, for
> > instance loading and evaluating the following script consecutiveN.py:
> >
> > #consecutiveN.py
> > from javax.swing import JOptionPane
> >
> > def consecutiveN():
> >   global index
> >   try:
> >     if rec() == 0:
> >       index = 0
> >     else:
> >       index = index + 1
> >   except:
> >       index = ''
> >   return index
> >
> > # Usage: consecutiveN()
> > JOptionPane.showMessageDialog(None, 'Usage: consecutiveN()',
> > "consecutiveN", JOptionPane.INFORMATION_MESSAGE)
> >
> > Its usage is very simple. If the first record is not selected, the index
> > will be 1-based and so consecutiveN() will do the trick, otherwise it
> > will start from 0 and so consecutiveN()+1 would be necessary.
> >
> > Cheers,
> > Antonio
> >
> > Il 27/03/2012 20.17, Francisco Puga ha scritto:
> >> Seems like a simple request but after think a bit more, i don't find a
> >> way to accomplish it. Field Expression is based on the values of the
> >> row actual being processing, it hasn't have memory, so the program
> >> doesn't know which is the next number to use.
> >>
> >> Sorry.
> >>
> >> El día 27 de marzo de 2012 19:07, spatialjoeescribió:
> >>> Hi Francisco,
> >>>
> >>> thanks for your advice. With sextante numbering individual selections
> of a
> >>> layer will result in new individual shapefiles which then can be
> merged back
> >>> into one. Not sure if I like this but that's the way it'll work.
> >>> Nonetheless pointing to sextante was useful anyway. I somehow got
> mentally
> >>> stuck  with rec()+1.
> >>> Thanks again!
> >>>
> >>> best,
> >>>
> >>> Johannes
> >>>
> >>> --
> >>> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/gvSIG-1-11-add-consecutive-numbers-to-selection-tp4661202p4661647.html
> >>> Sent from the gvSIG users mailing list archive at Nabble.com.
> >>> _______________________________________________
> >>> Gvsig_internacional mailing list
> >>> Gvsig_internacional at listserv.gva.es
> >>>
> >>> To see the archives, edit your preferences or unsubscribe from this
> mailing list, please access this url:
> >>>
> >>> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
> >>
> >>
> >>
> >
> > --
> > Antonio Falciano
> > http://www.linkedin.com/in/antoniofalciano
> > _______________________________________________
> > Gvsig_internacional mailing list
> > Gvsig_internacional at listserv.gva.es
> >
> > To see the archives, edit your preferences or unsubscribe from this
> mailing list, please access this url:
> >
> > http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
>
>
> --
> Francisco Puga
> Grupo de Desarrollo
> Cartolab - Laboratorio de Ingeniería Cartográfica.
> http://www.cartolab.es
>
> ETS Ingeniería de Caminos, Canales y Puertos
> Universidade da Coruña
> Campus de Elviña - 15071 A Coruña (España)
> (34)981167000 ext. 5493
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
>
> To see the archives, edit your preferences or unsubscribe from this
> mailing list, please access this url:
>
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>



-- 
Juan Ignacio Varela García
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20120329/f2512557/attachment.htm 


More information about the Gvsig_internacional mailing list