Hot answers tagged

33 votes

Changing feature draw order in QGIS

QGIS >= 2.14 has built in support for specifying the rendering order. It's on the bottom of the "styles" tab under your layer properties.
ndawson's user avatar
  • 27.6k
32 votes
Accepted

Listing all polygon vertices coordinates using GeoPandas

Not sure if one line method exists, but the following ways could work. (Solutions are for the first feature's geometry, and they are just for Polygon, not for MultiPolygon) Solution 1: boundary ...
Kadir Şahbaz's user avatar
18 votes

Changing fields order in QGIS

Open the attribute table. Right-click the column headings in the attribute table. Select "Organize columns" in the drop-down menu. Then, just drag the heading to the position you want it to ...
Angela P's user avatar
  • 361
16 votes

Changing feature draw order in QGIS

You could also change the Symbol levels of your shapefile to give each symbol layer higher priorities than others. You can access this from: Layer Properties > Style > Advanced > Symbol levels
Joseph's user avatar
  • 75.6k
15 votes
Accepted

Changing fields order in QGIS

Open the Fields tab from the Layer properties. From there, select the Drag and drop designer option and drag to the right the fields you want to edit. You can also change the field order. You can then ...
JGH's user avatar
  • 41.6k
15 votes
Accepted

Rendering polygons ordered by size in QGIS

Most data providers do not guarantee any order in the way they deliver features. While an apparently stable order is often a side effect of the order in which features are stored in files, one shouldn'...
Matthias Kuhn's user avatar
13 votes
Accepted

Changing drawing priority for selected feature in QGIS

You can change drawing order for the selected features using Symbology tab in Layer Properties. Open Symbology tab in Layer Properties or Layer Styling (F7). Check Control feature rendering order. ...
Kadir Şahbaz's user avatar
12 votes
Accepted

Getting ordered list of IDs of selected features using PyQGIS

Use this script: selection = [] def selection_changed(selected, deselected, clearAndSelect): global selection # If the user deselects feature(s), remove ID's from list if deselected: ...
Kadir Şahbaz's user avatar
12 votes
Accepted

Sorting/ordering selected features by attribute in QgsVectorLayer using PyQGIS

You can also use addOrderBy method of QgsFeatureRequest in this way: request = QgsFeatureRequest().addOrderBy("City") for f in vLayer.getSelectedFeatures(request): print(f["City&...
Kadir Şahbaz's user avatar
11 votes

Listing all polygon vertices coordinates using GeoPandas

One way might be to convert to JSON then read back to dictionary: import json import numpy as np import geopandas as gpd df = gpd.read_file('/home/bera/geodata/Rectangle_with_hole.shp') g = json....
Ben's user avatar
  • 727
11 votes

Changing feature draw order in QGIS

Just tried to do something like this in Qgis 3.44, as expected the design has changed. Select Layer, Properties, ->Symbology On this dialog on the left hand side lurking about the Help and Style ...
Dave's user avatar
  • 329
10 votes

Changing fields order in QGIS

If I understand your question, you may use the "Refactor fields" algorithm from the Processing Toolbox (Ctrl+Alt+T): it allows manipulating the order of your fields stored in the Attribute ...
mgri's user avatar
  • 16.1k
10 votes

Sorting/ordering selected features by attribute in QgsVectorLayer using PyQGIS

Try the snippet below. You can store selected features and an associated attribute as key, value pairs into a dictionary, then sort by the field value. After that, you can access the feature object ...
Ben W's user avatar
  • 21.2k
9 votes
Accepted

Sort data in an ascending order based on the geometry of an sf object in R (Sort by Lat/Long)

Never mutate your data with temporary values. Create new objects with temporary values. Here's a solution that does not mutate the original data in any way apart from the ordering, and also only uses ...
Spacedman's user avatar
  • 63.4k
9 votes

Sorting/ordering selected features by attribute in QgsVectorLayer using PyQGIS

This also works: sorted_list = sorted(vLayer.selectedFeatures(), key=lambda el: el['City']) for feature in sorted_list: print(feature['City'])
Emma's user avatar
  • 422
9 votes

Joining point data in chronological order using timestamp in QGIS

Welcome to QGIS @Eleanor. Try the algorithm Vector Creation -> Points to Path in the processing toolbox. Then specify your timestamp and uniqueID fields as the "order" and "group&...
Andre Geo's user avatar
  • 538
8 votes

Rendering polygons ordered by size in QGIS

You need to use Union Tool from Vector -> Geoprocessing tools -> Union. This should give you the correct topology. Or, you can use difference tool repeatedly to get the difference between big ...
ahmadhanb's user avatar
  • 40.7k
8 votes

Find order of points along polyline

If your route (polyline) layer's name is Route1 which has an id field (fid), and the point layer is Bears like below example. Open the attribute table of the Bears (point) layer and start the Field ...
Kazuhito's user avatar
  • 30.7k
8 votes

Sorting/ordering selected features by attribute in QgsVectorLayer using PyQGIS

@Ben W, thank you so much, I have marked your answer as correct. Even so I have found a solution to solve it in one operation. It is a combination of your answer and the instructions on this website ...
RBenet's user avatar
  • 770
8 votes
Accepted

Sorting layer order in QGIS based on mixed string/numerical layer names

One option is to use pyqgis: List the layers, Sort the list (using a lambda function if needed), Add the layers, they will be added in the sorted order. import os gpkg_folder = r'C:\GIS\data\testdata\...
BERA's user avatar
  • 71.4k
8 votes
Accepted

Saving and applying layout of columns in QGIS Attribute Table

I can suggest a PyQGIS approach to (1) adjust, (2) export, (3) downgrade and (4) finally import configurations applied to the attribute table of a layer. It is mainly based on the ...
Taras's user avatar
  • 32.8k
7 votes
Accepted

Setting (above/under) priority order of layer in leaflet

You can work with layer.bringToFront(), bringToBack() or setZIndex() to reorder your layers. If you want one layer to always be below all others you can listen for the layer's add event and then ...
chrki's user avatar
  • 2,655
7 votes
Accepted

Moving widgets fields to the top in QGIS

QGIS2web uses fields() method of QgsVectorLayer class to get the fields, and that method uses fields order of the data provider. I mean, it retrieves the fields as in the data source. Therefore, ...
Kadir Şahbaz's user avatar
7 votes

Exporting points in specific order along a pathline using QGIS

As long as your route segments were drawn in the desired order, you can use the tool Extract vertices on the line layer. The vertex_index field of the resulting point layer is the order in which they ...
Matt's user avatar
  • 16.3k
7 votes

Saving and applying layout of columns in QGIS Attribute Table

You export the layer as a layer definition file and then just add this file to QGIS to load the layer. For more control and in-place replacement, you can export the table component of the layer style. ...
JGH's user avatar
  • 41.6k
6 votes
Accepted

Changing vertex order for polygons in QGIS?

The vertex tool is what you are looking for. Select the polygon layer you like to change and go into edit mode. Then choose the vertex tool and click on the vertex you like to edit. You can either ...
gHupf's user avatar
  • 1,153
6 votes

Dissolving features according to the ordering field in QGIS

You can use "Control feature rendering order" option under "Layer Rendering" in "Layer Style" panel. Open Define Order window by clicking AZ button. Add field name (Type ...
Kadir Şahbaz's user avatar
6 votes
Accepted

Creating individual polygons based on sequentially numbered points in QGIS

I think you're almost there. You just have to add the section field as group field in the points to path dialog window. See my screenshot, where I have points in a similar order as yours, labeled with ...
Babel's user avatar
  • 70.6k
6 votes

Ordering polygons from north to south in QGIS

You can create a new field with this expression : array_find( -- find the current feature id in the list array_reverse( -- reverse the order of the list, so greastest Y coordinate (= Northest) is ...
J. Monticolo's user avatar
  • 15.7k
6 votes
Accepted

Numbering row based on date field in QGIS

Use this expression in Field Calculator: array_find( array_agg($id, order_by:="Fecha"), $id ) + 1
Babel's user avatar
  • 70.6k

Only top scored, non community-wiki answers of a minimum length are eligible