I have the following attribute table and I wish to show the total area in hectares seperate to my attribute table on the print setup. I currently have to add these values manually. Is there a way to get QGIS to calculate this automatically?
47554
I'm working with population data, and I have an issue when it comes to knowing the sum of a population inside the attribute table.  In my attribute table, I'd like to add all the numbers in the red box, i.e. all the numbers together from the column &quot;UN_2015_E&quot;. Is there a way to do so?
77803
I have a vector layer, populated with points, and I want to programmatically add to this layer.  The part related to the geometry works just out of the box, but I was having trouble with adding attribute values to the new features.  The problem is, when I add a new feature to the layer, I do not manage to specify fields. The feature would complain on exceptions.KeyError.          featureList = []         ## now add the computed points to the layer         for p in [p for p in points.values() if p['computed']]:             x, y = p['coordinates']             feature = QgsFeature()             layerPoint = transf.transform(QgsPoint(x, y))             feature.setGeometry(QgsGeometry.fromPoint(layerPoint))             feature['id'] = p['id']             featureList.append(feature)          layer.dataProvider().addFeatures(featureList)         layer.commitChanges()   And before you ask, obviously I'm sure it's the feature['id'] which is giving trouble, not the p['id'].  So the short version of the question was "how do I specify fields of a feature before it was ever part of a layer?"
69720
The label toolbar uses fields in the attribute table of vector layers to fine tune labeling (Data defined labeling). That's the main reason i'm looking for that, but it may have more applications.  I'd like to automatically add some format columns instead of adding them manually every time.   Do you know a plugin or a way to do this manipulation automatically on multiples layers ?  I tried to get the QGIS tool "Add a field to attribute table" into a quick model which works properly, but it creates a new memory layer. And I'd like just new fields.  ##Add_ETIKT_Field=name ##myvlayer=vector ##myvlayer=output vector outputs_QGISADDFIELDTOATTRIBUTESTABLE_2=processing.runalg('qgis:addfieldtoattributestable', myvlayer,'ETIKT_Y',1,15.0,4.0,None) outputs_QGISADDFIELDTOATTRIBUTESTABLE_1=processing.runalg('qgis:addfieldtoattributestable', outputs_QGISADDFIELDTOATTRIBUTESTABLE_2['OUTPUT_LAYER'],'ETIKT_X',1,15.0,5.0,myvlayer)   What I'm looking to automate is :   Open the attribute table Edit button Field Calculator button Add Column + Type + length + Precision   It seems there's some ideas in , but I'd love to avoid coding anything, or at least at minimum go through the modeler.     Adding and Removing Fields       To add fields (attributes), you need to   specify a list of field definitions. For deletion of fields just   provide a list of field indexes.   if caps &amp; QgsVectorDataProvider.AddAttributes:     res = layer.dataProvider().addAttributes([QgsField("mytext", QVariant.String), QgsField("myint", QVariant.Int)])  if caps &amp; QgsVectorDataProvider.DeleteAttributes:     res = layer.dataProvider().deleteAttributes([0])
41713
I have two layers, one (A) has point features and the other (B) has polygons.  How do I produce a new table with some (the ID) or all the fields from the A table and some (the area code) or all from the B table where the B polygon contains the A point?  I am using QGIS.
64222
I would like to plot the following per zone (30 zones total) data on a printable/non interactive map:   Average age Average household income Number of households Population density Number of people Number of workers   How would you display the above 6 layers effectively on one map?
19295
I'm having trouble adding a field to a PostGIS table using PyQGIS. Here's my code:  from PyQt4.QtCore import QVariant from qgis.core import *  inLayer = iface.activeLayer() provider = inLayer.dataProvider()  # add field field = QgsField('test_field', QVariant.String) inLayer.startEditing() provider.addAttributes([field]) inLayer.updateFields()  # commit inLayer.commitChanges()   The commit fails and the PostGIS log shows an error:     2015-10-27T08:13:28    1   Erroneous query: ALTER TABLE "received"."env" ADD COLUMN "test_field"  returned 7 [ERROR:  syntax error at end of input      LINE 1: ALTER TABLE "received"."env" ADD COLUMN "test_field"    Seems the call to PostGIS fails to include the column type. Is this a bug, or am I going about this the wrong way?
1516
I wish to know if there's a tool on QGIS equivalent to the Excel's "SUMIF".    I have a shapefile of a land use and cover that's classified by the attribute with the name of the classes, for example: "vegetation", "urban centers" and "pastures". My goal is to calculate the area of each class, but since it's composed by various polygons, I need to add up all the areas from all polygons that were put in the same class.  Like I mentioned in the beginning of the question, I know that Excel has a function that can do such thing for me, but it turns out that the sum made by excel doesn't match the area's total given by QGIS.  English is not my first language, so if the explanation isn't clear enough, I'll be glad to rephrase it.
57758
Being new with python so far, I got inspired by this answer:   to dive into it a bit.  When creating features in a new target layer from an existing source layer, all "solutions" I found so far to create that new layer, were to either   prepare the new target layer manually in QGIS beforehand, adding all fields (with field types, lengths etc). Hard-code the field settings into the python script when creating that new target layer.    It seems a bit odd to me that there should be no programmatic way to clone the attribute scheme of a layer, and create a new (memory) layer with this scheme, so you wont have to change your script for each new layer, or fumble things together manually.  I'm focused on the creation of memory-layers, cause I want to have the opportunity to decide by myself if the outcome is satisfactory and save it manually when it fits my needs.
114514
I have a shapefile which renders a map.  I want to calculate and preferably store length of each feature in the shapefile  either using QGis or through programmatic means.  What is the best way to get this task done?
75829
If I have an attribute table with columns A B C D, is it possible to move the columns to different positions, say, B C A D? When making a new column with the field calculator it would be useful to put it somewhere other than last position or to be able to move key columns close to it.
41511
How do I easily calculate the lat/long of points using the QGIS Field Calculator? I saw a previous related question (), but it deals with a more advanced approach. In ArcGIS Desktop this is similar to the Calculate Geometry function; I just can't find where do this in QGIS.
94598
I have an attribute table in ArcGIS 10 (it's large - around 300,000 elements). I've selected some rows of the table using 'Select by attributes' and I want to set the value of a field for all of those rows.   How should I go about doing this? I'm hoping there will be a nice, easy, GUI-based way - as I'm teaching someone with very little GIS experience.
24326
I want to give multiple colors to different features within a shapefile based on attribute values , is this possible in QGIS ?  If yes what is the procedure ?  Is there a way to provide color by means of hexadecimal codes ?
42443
I am currently self teaching myself on qgis whilst volenteering on a project on a river catchment and your help is hugely appreciated!  I need to be able to work out the percentage of land cover or sqft/m coverage. I have all the land uses on as a vector layer over my river catchment.   Many thanks and let me know what other info i need to give as a newbie!
20212
In this project, I have three polygons, see the image below  'Polygons_From', includes input attributes, i.g. &quot;Value_1&quot;, &quot;Value_2&quot;, &quot;Value_3&quot;, and $area for each quadrate (on the image there are two types of them). 'Polygons_To' polygons for which new values &quot;Value_1_new&quot;, &quot;Value_2_new&quot;, &quot;Value_3_new&quot; need to be defined 'Border' defines an area where the calculation should be done.   My task is to transfer values from 'Polygons_From' into 'Polygons_To' based on a certain aspect/ratio. Of course, I can simply achieve it with the 'Union' function as was suggested in . It uses $area-factor, but perhaps there are better approaches that will lead me to a much more efficient output? So, I am asking for a recommendation regarding the technique/workflow that can be applied in QGIS 2.18. Shall I consider only $area or there are some other criteria? Moreover, I looking forward to finding some papers that may improve my general understanding of the methodology.  References:
56805
I work on QGIS 2.2, and I am unable to edit my attribute table to change the field type from string to double.  I have gone through several tutorials. - I can not run the table manager plugin, probably because its latest version is for qgis 2.0, (well it appears broken on my plugin manager UI).   I am unable to edit my layer so that I can use the field calculator (as several tutorials stipulated). I am not versed with python to use the python console
113820
I'm trying to demonstrate to my company that we can begin using QGIS in conjunction with (and sometimes even instead of) ArcGIS and MapInfo.  I've started setting up some layout templates but have run into a.  In Print Composer, is there a way to add the current project path?  In ArcGIS, the dynamic text is:  &lt;dyn type="document" property="path"/&gt;   I'd prefer not to have to copy/paste the document path every time I make a map.    EDIT:   To address answer and comments by artwork21 and Nathan W:  I'm using QGIS 2.0.1.  I would also like this path to appear to anyone who may need to open the project for editing without modifying their startup.py file.