New answers tagged

2

You can solve it quite simple: Just add a double quotation " to fields having a whitespace in its title: Plot Order --> "Plot Order". Then it recognizes the field correctly and sorts your attribute table correctly.


0

Some python will help you combine the rows into a single value, you just then need to write that out to a new table. import arcpy tbl = r"C:\Scratch\fGDB_Scratch.gdb\tbl" mylist = list() with arcpy.da.SearchCursor(tbl,["stuff"]) as cursor: for row in cursor: val = row[0] if val.isnumeric(): part1 = val ...


5

Extending on @Kazuhito preparation step, you can achieve such sort directly. Open the attribute table, right click on a field column name, choose sort Then enter the following code, replacing the column name by your own. Change the 10 with the max number of digits / letters. Basically, this code extracts the number, adds 0s before so every number is exactly ...


1

Firstly, we must remember that each row in the attribute table is associated with a feature on the map, and symbology is a layer property that is followed only until the layer is in the contents pane in ArcGIS Pro. What you can try is using the "show count" property while applying symbology Your aim is to get it as a table showing the count, use ...


7

you could try creating a new decimal column in field calculator with a precision of 2 and use the following if statement in the expression window: if (upper("yourTextField")= lower("yourTextField"),"yourTextField", regexp_substr("yourTextField",'(\\d+)')+(strpos( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', upper(right("...


6

I recommend Sort and Number plugin, which can take multiple fields as sorting criteria. (1) Preparation To allow the plugin to recognize the number part and the character part of your textcolumn, create two separate columns by expressions in the Field Calculator. num_part (integer): regexp_substr("textcolumn", '(\\d+)') char_part (text): ...


0

Eventually I found what works. Just no need to convert a value to string, and Output field type should be Decimal number (real): from qgis.core import * from qgis.gui import * @qgsfunction(args='auto', group='Custom') def fd_sci(value1, feature, parent): a = "{:.2e}".format(value1) return a


0

Also a solutions without programming. Let's assume there is a polyline layer "line"(blue) with its attribute table accordingly, see image below. Deploy the "Refactor fields" geoalgorithm. Unfortunately it has a disadvantage, filling the 'Source expression' with a Conditional Function is still necessary, i.e. if(condition,result_when_true,...


0

Another alternative using PyQGIS for all attributes that exist in the Attribute table. Let's assume there is a polyline layer "line"(blue) with its attribute table accordingly, see image below. Proceed with Plugins > Python Console > Show Editor and paste the script below # accessing a layer with polyline features by its name lines_null = ...


1

Duplicate your layer via RMC > Duplicate Layer. When applying a change to the original layer also the duplicated one will be updated


0

This should work with text and numeric fields. Backup your data first.. layer = QgsProject.instance().mapLayersByName('replacenulls_backup')[0] fs = lyr.fields() d = {e:0 if f.isNumeric() else '0' for e,f in enumerate(fs)} with edit(layer): for row in layer.getFeatures(): data = row.attributes() for i, val in enumerate(data): ...


1

My professor got in touch with a colleague who suggested that the issue was with the datatype. I changed the assignment code to this, and it solved the problem: attr_vals = np.array([[*coords, QVariant(randint(1, 5))] for coords in self._defined_points]) # set output field values for i in range(attr_vals.shape[0]): # if you're concerned, the order here does ...


1

I believe corvus is correct, by setting the attributes after you have added the feature you are updating the variable feat not the copy of that which was added to the sink I would try something like: feat = QgsFeature() feat.setGeometry(... feat.setAttributes(... self._sink.addFeature(feat)


0

I would suggest using a Virtual Layer in conjunction with st_union(). Given a layer of polygons s with attribute r, click New Virtual Layer. On the dialog that appears, click Import to bring in the layer s. Under Query, enter the following query: SELECT r, st_union(geometry) FROM s GROUP BY r The result will appear as a separate layer in the ...


7

It seems you are working with a shapefile which has field name limited to 10 characters. You can refer to this link from Esri which clearly identified this limitation. You need to shorten the name to be less than or equal 10 characters, if you want to continue to use shapefiles, or use another vector format such as geopackage if you want to create field name ...


3

The labels displayed in your map, and the labels displayed in the text of your question are different. The labels in the map shows B3- 24F DP & \PSP2, and the labels in the text of your question shows B3-24F DP&\PSP2. The former text contains more spaces compared with the latter text. Anyway whatever the case, you need to use Wrap lines to and ...


0

I have come across this issue. The easiest way worked with me is check if you have primary key in your data. If not, add one and reload the feature and try editing. But because shapefile does not have a primary key concept, you can use field calculator to create a column that utilizes row or record number as its value.


3

Your expression does exactly what it is supposed to be doing. I guess you mixed up the terms "split" and "wrap". Go to your label properties and navigate to "formatting". Then fill "wrap on character" with -: Also check out the other options available there ;)


0

Illustrating a solution to have multiple lines for the value in text field of attribute table:


3

Right-click the database connection - Edit Connection - check "Also list tables with no geometry":


2

While a SQL approach with DB Manager and Virtual layers inside QGIS worked with small samples, it would run for hours or crash agains the entire datates. As suggested by @DSSPatial, I loaded the data into PostGIS and it worked really well, and fast. Here is the final query: INSERT INTO main_buildings SELECT t2.* FROM ( SELECT t0."...


2

You are on the right track with count_distinct. First make sure Editing is disabled for the layer. Then we'll add a filter to the entire layer by doing the following: right click layer > Properties > Source > Query Builder (bottom right) For the expression write "tonnage" > 1200 Click OK and close the filter then open the Statistics ...


2

There is an How To: Display coded value domains and subtype codes instead of descriptions from Esri that describes showing the codes in the attribute table instead of the domain text descriptions. becomes Try: Customize > ArcMap Options > Tables Then, uncheck the 'Display coded value domain and subtype descriptions' option.


2

When you open the attribute table there is an option button at the top left of the table, in the "display" option (not sure it's named exactly like that) you should find a tick box to choose to display code or description of domain.


Top 50 recent answers are included