Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
10 votes
2 answers
7k views

Creating memory layer and populate fields using PyQGIS

Seems like a basic operation using PyQGIS but can't see what I am missing. I want to create a memory layer with the exact same features and attributes from a shapefile. I have looked several posts ...
Joseph's user avatar
  • 76.3k
8 votes
1 answer
9k views

Is it possible to increase Output Field Name length beyond 10 characters?

When creating a new Column, the default value for the length of the name is 10. Using the Field Calculator via the Model Builder, I want to include the names of regional areas into the columns which ...
Joseph's user avatar
  • 76.3k
7 votes
4 answers
4k views

Fill with @row_number based on group field in QGIS 3

Is there a way to fill the table with a row number so that count will restart as new group (identified by a separate column) starts? As a result, "row number" column will restart the count ...
Ruslan's user avatar
  • 695
7 votes
3 answers
3k views

Summing values in one field using PyQGIS

In QGIS 2.18 there is a shapefile with three fields accordingly id Type Value 1 a 5 2 b NULL 3 c 1 4 d 6 5 e NULL I want to get the total sum of all values in the field "Value". How ...
Taras's user avatar
  • 34k
7 votes
3 answers
896 views

Is it possible to have the attributes fields already filled from the previous object?

I need to create a lot of points with lots of attributes, but most of the fields are the same, so I don't want to edit all the fields all the time. Is there a "remember previous fields" function ...
Pietro's user avatar
  • 71
6 votes
2 answers
3k views

Choosing Shapefile attribute data type to use?

I am trying to figure out when to use (in the Data Type of SHAPEFILE PROPERTIES) - TEXT - SHORT-INTEG - LONG-INTEG - FLOAT AND DOUBLE. I am using ArcView 9.3 and I know when it is all text or use ...
Zoran's user avatar
  • 1,601
6 votes
3 answers
2k views

Creating QgsFeature with default attributes using PyQGIS

I have a polygon layer loaded from PostGIS database. This layer has a default value for the first column. I can create a new feature set that attribute to some predefined value with: newFeature = ...
okorkut's user avatar
  • 268
5 votes
2 answers
5k views

Select by attributes within the fiona Python module

Is it possible to select polygons from a shapefile based upon their attributes using the Fiona Python module? I can't seem to find anything in the docs, but it seems like a strange thing not to be ...
robintw's user avatar
  • 4,014
5 votes
1 answer
388 views

Creating new layer with all attributes inherited from original layer using PyQGIS

Let's assume there is a polygon layer called 'test2' with its attribute table, see the image below. With the code below I am creating a new layer as centroids of original features layer = iface....
Taras's user avatar
  • 34k
4 votes
3 answers
4k views

Copy geometry from one layer onto attributes of another?

I have two polygon layers, A and B, that have the same features but totally different attributes. I want to use the attributes from layer A, but I want them to have the more accurate geometry from ...
Nathan's user avatar
  • 1,314
3 votes
3 answers
5k views

Adding many columns (to many layers) using QGIS?

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'...
gisnside's user avatar
  • 7,888
3 votes
2 answers
4k views

Updating polygon areas in QGIS?

I'm using QGIS 2.6 and regularly update a shapefile layer to indicate felling progress. However, if I edit the nodes of a polygon, save the layer out then look at the Attributes table the area shown ...
Edward's user avatar
  • 199
3 votes
1 answer
5k views

When aggregating points by polygons with sp::over function, how do I include attribute data from both the points and polygons? [duplicate]

Data: Zipped ea.ml1 shapefile can be found here, and the country outline can be downloaded here at the GADM site. I've been using the Ethiopia ESRI shapefile. Branch locations are here. I have a ...
Lauren's user avatar
  • 1,912
2 votes
1 answer
3k views

Adding attribute list to combobox in QGIS plugin?

I am developing a simple plugin at the moment which contains 3 combo boxes: comboBox_1 comboBox_2 comboBox_3 Combobox 1 & 2 lists the vector layers available, however I would like the 3rd ...
Joseph's user avatar
  • 76.3k
2 votes
3 answers
6k views

Changing field type with ArcPy?

What I need to do is change data type of a field of a table or feature class. If there are some data, then I need to transfer it, if its possible, if not possible then just set null for that data. I ...
Emi's user avatar
  • 2,425
1 vote
2 answers
570 views

Getting attribute data from one dataset to another

In the image below you can see two shapefiles: NYC building footprints (outlined), and underneath a PLUTO shapefile rendered with a categorized blue gradient using the "Floor Number" column. The ...
Horia Popa's user avatar
1 vote
1 answer
16k views

Changing field formats in ArcGIS geodatabase? [duplicate]

I am working with data in an ArcGIS 10.1 geodatabase. I wanted to complete the simple task of taking a ten-digit ID field that is currently in String/Text format and create an identical field in Long/...
mikeLdub's user avatar
  • 1,235
23 votes
8 answers
54k views

Deleting fields using QGIS

When is the option to delete field in an attribute table enabled in QGIS? I'm in editing mode and still am not able to delete a field.
vascobnunes's user avatar
  • 5,618
17 votes
3 answers
20k views

Changing position of columns in QGIS Attribute table

If I have an attribute table with columns A, B, C, and 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 ...
HealthMaps's user avatar
  • 1,015
17 votes
3 answers
906 views

Sorting attribute table by hidden column in QGIS Print Composer

In a QGIS 2.18.20 attribute table I have some values with random numbers, but at the print composer I want to show them with order (clockwise). So I made a new integer column, and added numbers with ...
Pitheas's user avatar
  • 741
17 votes
5 answers
15k views

Converting string field into date field in QGIS

In QGIS I have a layer with points which represent the fatal road accidents and the field "dates_14_D" contains their date but its type is string. I would like to convert this string field ...
Ilias Machairas's user avatar
16 votes
3 answers
13k views

Exporting only certain columns to CSV file in ArcGIS for Desktop?

I've written a python script using arcpy which outputs a polygon feature class into a File Geodatabase. I have added a function to export the attributes to a separate CSV file. I am using the code ...
Fezter's user avatar
  • 22k
15 votes
7 answers
32k views

Changing field length using QGIS

I have a shapefile I made in QGIS 1.7.4. One of the fields is a String of length 80. I'd like to make the field accept longer stings, but I can't figure out how to change its length. How do I do this?
Evan's user avatar
  • 1,123
14 votes
1 answer
10k views

How to change attributes with QGIS Python?

I have this piece of code which I would like to use for inserting values into a column. It does not throw an error, the changes are not written to the source (shapefile). from qgis.utils import iface ...
Michal Zimmermann's user avatar
13 votes
2 answers
10k views

AttributeError: 'QgsVectorLayer' object has no attribute 'fieldNameIndex'

When I try to calculate a new field with: idx = layer.fieldNameIndex(attributeName) I receive the following error: AttributeError: 'QgsVectorLayer' object has no attribute 'fieldNameIndex' What´s ...
Marco's user avatar
  • 446
13 votes
3 answers
4k views

Setting default value in QGIS field

I would like to add in a layer's field a default value. I mean, every time a new feature is created, that field would be automatically filled with the default value. In my case the default value would ...
Egidi's user avatar
  • 3,768
12 votes
2 answers
21k views

Updating text column of selected features in QGIS

Let's say I have a bunch of postcodes. After making a selection and having the records highlighted in the attribute table, how to update all of them and give them the same category? In ArcGIS, after ...
Luffydude's user avatar
  • 2,350
11 votes
1 answer
10k views

Applying Field Calculator with PyQGIS

I would like to use Field Calculator in PyQGIS to update the existing column based on certain conditions. How can I do this?
Pugazh's user avatar
  • 607
11 votes
1 answer
914 views

Setting all the values in attribute field to the same value with PyQGIS

When I use "Update existing fields" in the Field Calculator in QGIS 3.16.0-Hannover, it takes only a second to change all the values in a attribute field to the same value. However when I ...
meteergen's user avatar
  • 375
9 votes
2 answers
4k views

Displaying multiple attributes in QGIS Composer legend

I have a polygon layer which has a number attribute and a text attribute. When I make a legend in the composer, it automatically chooses the number to display while I would like to have both the ...
Gin's user avatar
  • 470
9 votes
3 answers
4k views

Renaming field in attribute table via PyQGIS

How can I rename a field in PyQGIS? I tried: for field in layer.pendingFields(): if field.name() == 'old': layer.startEditing() oldname = field.name() field.setName('new')...
Peter Frank's user avatar
9 votes
3 answers
14k views

How to group by attributes and give unique categories in QGIS?

I have features and each of them has an attribute about what it is. In my case, I have points representing trees and each tree has its species name as an attribute. I would like to group them by ...
Skye's user avatar
  • 1,053
8 votes
4 answers
2k views

Adding unique ID for groups of items using Field calculator in QGIS

I have a set of string values in a shapefile's attribute column and want to assign a number to them in a way that each unique string gets an integer number, like this: How do I do this using the ...
Elise's user avatar
  • 125
8 votes
2 answers
3k views

Change default field properties for number format in ArcMap?

Anyone who has worked with numbers that have more than 14 digits has run into ArcMap's wonderful habit of converting any number of such length to e-notation. While changing this is a simple matter of ...
Nathanus's user avatar
  • 4,318
8 votes
2 answers
638 views

Clean up attributes

I want to clean up the attribute table of a road shapefile for all the entries in the fields. For example: As seen below I have a road feature with a "Name", Name From and Name To in the attribute ...
Dean van den Heever's user avatar
8 votes
2 answers
2k views

Finding the minimum value of different columns in QGIS

I'll try to calculate the minimum value of four different columns in my QGIS table like: The min. value would be 1,50286 in the first row. Is there any expression or tool to find the minimum value ...
Walther's user avatar
  • 183
7 votes
2 answers
622 views

Removing duplicates from field using ArcPy with ArcMap

I am using ArcPy with ArcMap. I need to remove duplicates from a field named "Intersecti" Here is my code. I used list..set. It's not removing any duplicates. import arcpy duplicates = &...
sys's user avatar
  • 145
7 votes
4 answers
4k views

Calculate polygon field based on neigboring polygon attribute

I have a vector shape with many different sized polygons each possessing an own class name (for instance "houses", "houses with offices", etc ...) I want to assign a new field to ...
Curlew's user avatar
  • 8,180
6 votes
5 answers
9k views

Adding point to existing attribute record, rather than editing attributes of existing point?

I'm using ArcGIS 10 to create point data. Normally I would start an edit session, select point as a construction tool, click where I want a point to be, and then go in and edit the attributes. Say I ...
Amy's user avatar
  • 61
6 votes
1 answer
2k views

Defining fields and adding features to the output layer in a processing algorithm in QGIS

I have two input vector layers (one point and one line layer). I loop through every feature in the input-line-layer and calculate some things (with the help of the point layer). What I am trying to do ...
applebrown's user avatar
6 votes
3 answers
1k views

Wrapping heading of column of attribute table within QGIS Print Composer

The "wrap text on" function seems not to work for the heading of the columns, only for the rows. I'm using QGIS 2.14.4
Martin's user avatar
  • 309
6 votes
3 answers
5k views

How to collect data via WFS and Popup

I have a map with a WFS-Layer and I am able to add Polygons to my data stored in a PostGIS-database, served with GeoServer (OpenLayers, GeoServer 2.1.4, PostGIS 2.0 for PostgreSQL 9.1).) How can I ...
Cat's user avatar
  • 329
5 votes
3 answers
734 views

Define a unique ID (serial number) based on values in a field

I'm trying to generate a unique serial number for a dataset I have, for example, something like this: As shown, I would like to have a serial field, called SERIAL in this case, that increments based ...
Rodrigo Suárez Castaño's user avatar
5 votes
1 answer
755 views

QGIS Symbology - Display more symbols for each point depending on attribute numeric value

I have a point feature layer with some attributes. The numeric value of each attribute stands for the number of items of that attribute related to each point. Is it possible in QGIS to display a ...
HyPhens's user avatar
  • 518
5 votes
1 answer
3k views

Dissolve (merge) polygons QGIS based on attribute values only when are adjacent

I am a fairly new user of QGIS having a question regarding dissolve functionality. I am working with the NUTS-2 shapefiles provided by EU, which I have imported in QGIS. I have created a new layer ...
Cord's user avatar
  • 71
5 votes
1 answer
3k views

QGIS Not Importing ExtendedData from Self-Exported KML?

I've been scouring the internet for the past few hours, and I just can't seem to figure it out! I am using QGIS 2.4.0-Chugiak. Here are my simple steps: 1) I create a new ShapeFile (Type: Polygon) ...
princelrc85's user avatar
5 votes
3 answers
459 views

Styling points based on letter in field in QGIS

I am trying to do different symbols for my data in QGIS the only different between my points is the letter 'W' or 'D'. I want that each point will get a different color or shape to vizualize that on ...
Imri 's user avatar
  • 59
5 votes
3 answers
744 views

Changing field types so graduated symbols are available

I can't seem to make graduated symbols work. When I try to click on my column it doesn't show any options. I think these is due to those columns being formatted as text and not number. Any ideas how ...
Martin Lemma's user avatar
5 votes
2 answers
4k views

How to delete empty fields from a Shapefile with QGIS or ogr2ogr?

I have a Shapefile with a lot of empty columns but many of them are empty. Using QGIS or ogr2ogr, how do I remove all attribute columns where everything is NULL?
maning's user avatar
  • 3,050
5 votes
3 answers
3k views

Deleting features with identical table attributes in QGIS

How do I delete features with identical table attributes in QGIS? Otherwise, is there a tool like the 'Delete Identical Tool' in ArcGIS? For example, if I had 4 rows, and 3 columns, where I wanted to ...
nittyjee's user avatar
  • 465

1
2
3 4 5
7