Feature request #243

Add a feature to calculate field values in attribut tables

Added by Redmine Admin over 17 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:Gary Sherman
Category:Data Provider
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:10302

Description

Add a feature to calculate field values in attribut tables

Screenshot-2.png (29.2 KB) Giovanni Manghi, 2009-07-10 10:33 AM

History

#1 Updated by Gavin Macaulay - over 17 years ago

Can you provide some more details on what you mean?

#2 Updated by Redmine Admin over 17 years ago

Often I need to calculate new field values based on existing layer attribute table fields. For this issue it would be great if I do have a field calculator. Think about the following situation:
1. open layer attribute table.
2. start digitizing.
3. add a new field NEWFIELD to the opened attribute table if you don't like to overwrite existing table field values.
4. select the field you want to calculate values for. In our case NEWFIELD.
5. open the field calculator. (Opening the field calculator via button like the add field button).
6. select a math function to calculate the NEWFIELD value. p.e. NEWFIELD = sin(EXISTINGFIELD1) + cos(EXISTINGFIELD2)
7. stop digitizing.

Please let me know whether my details do explain my idea.

#3 Updated by Tim Sutton almost 17 years ago

Changed to minor under the following scheme:
  • blocker - bugs that should block the release. Since we are going to release pretty much 'come what may' I would like no bugs
  • allocated to this category without consultation with me and / or PSC
  • critical - bugs that cause the application to crash or corrupt data
  • major - application features that do not function at all
  • minor - features that function but imerfectly e.g. labels placing incorrectly
  • trivial - gui useability issues or small issues with the documentation, install notes etc.

#4 Updated by Paolo Cavallini about 16 years ago

Looks like you want to reimplement a spreadsheet within QGIS? This can be done eg in OOo, the issue could be how to recall a spreadsheet easily (single-click) from QGIS?

#5 Updated by Horst Düster about 16 years ago

Replying to [comment:5 pcav]:

Looks like you want to reimplement a spreadsheet within QGIS? This can be done eg in OOo, the issue could be how to recall a spreadsheet easily (single-click) from QGIS?

It's not the idea to reimplement a spreadsheet! But it is very helpful to calculate new column values. P.e. for Classification of objects. The first part of my request, add a new column, is realised (PostGIS Layer)

#6 Updated by cdavilam - almost 16 years ago

Replying to [comment:5 pcav]:

Looks like you want to reimplement a spreadsheet within QGIS? This can be done eg in OOo, the issue could be how to recall a spreadsheet easily (single-click) from QGIS?

Although it can be done in a spreadsheet, it would be very useful enabling it within QGIS. Otherwise it's necessary to remove the layer/close project->open dbf in OOo->edit and save->reload in QGIS/reopen project->rearrange simbology (if you don't have it saved), which is a very annoying process.

#7 Updated by Paolo Cavallini almost 16 years ago

Isn't this implemented as a python plugin? Should we close this?

#8 Updated by Horst Düster almost 16 years ago

Replying to [comment:9 pcav]:

Isn't this implemented as a python plugin? Should we close this?

Which plugin do you mean?

#9 Updated by Paolo Cavallini about 15 years ago

Table Manager, by Borys. Please check whether it has the functions you need.

#10 Updated by cdavilam - about 15 years ago

No, it has a Calculate button, but currently not functional (to be implemented...)

#11 Updated by Borys Jurgiel about 15 years ago

Exactly. It's on very hign position on my TODO list, but I haven't touch it yet. I'll do my best to implement it in February.

#12 Updated by Giovanni Manghi almost 15 years ago

I would like also to see this feature implemented, not only because I think is useful, but also because the missing of this tool is one of that things that (other software) users do notice when using for the first time QGis.

#13 Updated by Horst Düster almost 15 years ago

Replying to [comment:14 lutra]:

I would like also to see this feature implemented, not only because I think is useful, but also because the missing of this tool is one of that things that (other software) users do notice when using for the first time QGis.

+1

#14 Updated by Martin Dobias almost 15 years ago

What operations and functions should such field calculator support?

#15 Updated by Giovanni Manghi almost 15 years ago

Replying to [comment:16 wonder]:

What operations and functions should such field calculator support?

I know that make comparisons it is always bad, but (if you want to stay out of the arc* playground) I would suggest to have a look at the "field calculator" of gvSIG. It has many commands, every one has his own short description, so you may want to have a look to the program (I cannot find references of all the commands, not even in the manual, pag. 220 [ftp://downloads.gvsig.org/gva/descargas/manuales/gvSIG-1_1-man-v1-en.pdf here]).

See the attached image.

Among the others you can calculate areas, perimeters and lenghts without having to create a new shapefile like ftools requires.

Command list:

ABS 
ACOS
AREA
ASIN
ATAN
CEIL
COS
< >
/
E
==
EXP
<=
<
LOG
MAX
MIN
-
>=
>
PERIMETER
PI
+
POW
RANDOM
ROUND
SIN
SSQRT
TAN
*
TODEGREES
TONUMBER
TORADIANS
TOSTRING

#16 Updated by Marco Hugentobler almost 15 years ago

Note: a field calculator is on my (implementation) roadmap for this summer.

Marco

#17 Updated by Marco Hugentobler over 14 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed

A field calculator is available from
59a486bd (SVN r11736) on (more operators will follow)

Marco

Also available in: Atom PDF