New answers tagged

-1

One way to get there is to open the .dbf (d-base file) and the .csv as a data frame in R, then merge the tables and overwrite the original .dbf with the joined data. #dependency install.packages("foreign") library(foreign) #read in d-base table df.1 <- read.dbf('**pathtotable1.dbf**') #read in .csv file df.2 <- read.csv('**pathtotable2.csv**') #...


4

Normally the widgets configuration are saved in the project file. If you want to save certain widget properties to the geopackage layer, go to its layer properties, click the Style button at the bottom, select Save as Default and then save it to Datasource Database.


1

If you only want to use tools which are present in QGIS (so no scripting) you can have a look at the Random points inside a polygonplug-in. Which can be found in Vector --> Research Tools. You need the boundaries for each city as a polygon layer.


1

If I understand correctly, you are asking two questions: You have multiple csv records for a given property, but the join only recognizes one csv record for that property: This is because joins will connect only one record from the related table (typically the first related record the software comes across). This is the nature of joins, regardless of the ...


1

You could use something like the following to change the values from your specified fields: layer = iface.activeLayer() layer.startEditing() attrs = {28: 60.5, 29: 70.5} feat = layer.getFeature(0) layer.dataProvider().changeAttributeValues({feat.id(): attrs}) layer.commitChanges()


1

After converting the LAS Dataset to a point feature class, then add x, y and z coordinates to the TOC with Add Geometry Attributes tool: Adds new attribute fields to the input features representing the spatial or geometric characteristics and location of each feature, such as length or area and x-, y-, z-, and m-coordinates. Another option is to use the ...


4

join attributes by location actually offers exactly this functionality: You can choose which attributes to join (leaving the field blank joins all columns)


2

You can create a virtual layer with the desired column(s). The layer just points to the original layer, so it can be dismissed when you are done with it. go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the query SELECT myfield, geometry FROM myLayer


0

QgsAttributeTableView doesn't receive an object of type QgsVectorLayer I add a small Snippet to get what you want, it is more complex than it seems. layer = iface.activeLayer() canvas = iface.mapCanvas() vector_layer_cache = QgsVectorLayerCache(layer, 10000) attribute_table_model = QgsAttributeTableModel(vector_layer_cache) attribute_table_model.loadLayer(...


1

From the address file, do a Join by Attribute on PIN field to the PIN table, keeping all records. The addresses that do not have a matching PIN will have null values in all the PIN table part of the record (the last fields). To be safe, Select by Attribute on the PIN table's ObjectID/OID field is null. (This ensures that there really is no match because ...


2

As I understand your issue, Another way of stating your problem is : "for each polygon i look for the smallest one that contains him". Edit : As said by J. Monticolo, this will work only if your polygon overlaps. Otherwise, you still can work with the St_ExteriorRing of your polygons (must be polygons not MultiGeometry) and apply the same traitment, not ...


1

There is no need for the AND in the CASE-WHEN-... construct. Since the first matching result is returned, you can simply make an ascending order of the values you would like to test for: CASE WHEN "Size ha" <= 1 THEN 'Prio 3' WHEN "Size ha" < 10 THEN 'Prio 2' ELSE 'Prio 1' END Note also, that there is no explicit test needed for "Size ha" >= ...


2

If you are just copying an attribute value from one selected feature and inserting it into a field of a selected feature in another layer, might I suggest a simpler approach to access and store those attribute fields & values which doesn't involve traversing multiple, nested dictionaries? If know both your field names you can do this using the ...


0

Apparently the z function available in the Geometry section of the field calculator works well with points. I was able to find a solution to a similar problem of that asked by the OP by using z(start_point($geometry)) in the field calculator.


1

In QGIS 3, you could make use of the QgsFeature.setAttribute() method where you just need to provide the field index of the field you're interested in and the new value you wish to assign: #Replaces structure's tc value with gps point's tc value with edit(struc_layer): for feature in struc_layer.getFeatures(): feature.setAttribute(feature....


3

Try the following using an Update Cursor. This assumes 1) your input and output fields are text fields and 2) you have created a new field new_field in which you will write your results. import arcpy fc = r'C:\path\to\your\geodatabase.gdb\featureclass' with arcpy.da.UpdateCursor(fc, ("dup_field", "new_field")) as cursor: for row in cursor: # Iterate ...


0

Have you tried to reclassify? If you use the reclassify fields, you could input your lands layer, select the field you would like to edit (typically class name or ID), and assign new values. I've included a picture below from a previous project I've done. In this case I changed all of my fields besides Crops & pastures to be No data. But in your case, ...


Top 50 recent answers are included