Hot answers tagged

11

The field calculator always calculates on a row-by-row basis. So you can use: CASE WHEN "column_1" IS NULL THEN "column_5" ELSE "column_1" END


10

Agree with @JochenSchwarze that it makes sense to have it (and thanks for making it a feature request). Saying that, it is possible to do it with a bit of Python. Make sure the Open attribute table in a dock window setting is enabled from the menubar: Settings > Options > Data Sources > Feature attributes and table > Open attribute... ...


6

This will need you to modify values based on your GRIDCODE as I can only see 4 and 16 in your table, but to do this in the Field Calculator is fairly straightforward. In the Field Calculator window, select Python parser, and select Show Codeblock. Enter the following into the Pre-Logic Script Code textbox: def updateName(gCode): if gCode == 4: ...


6

You can also use coalesce to replace NULL values from column_1 by column_5. coalesce("column_1", "column_5")


5

Seems impossible at the moment. But I strongly agree that it makes sense. I have just started a feature request in the QGIS issue tracker https://hub.qgis.org/issues/14941


4

You need to connect the parts with AND or OR. ( "highway" ILIKE '%primary%' OR "highway" ILIKE '%secondary%' OR "highway" ILIKE '%tertiary%' OR "highway" ILIKE '%trunk%' ) AND "highway" NOT ILIKE '%trunk_link%'


4

If you already have the Name field, as your images shows, then right-click on the field header and select "Field Calculator...". In the field calculator window, enter an expression in either VB Script or Python which checks the value of GRIDCODE and returns the appropriate name for each of the four possible values. To calculate the total area for each ...


3

You could create a Custom function in the Function Editor to use the python ORD() function to get the ASCII value of a character (A being 65): http://www.qgistutorials.com/en/docs/custom_python_functions.html The function might look like this: from qgis.core import * from qgis.gui import * @qgsfunction(args=0, group='Custom') def ord_place(value1, ...


3

Right-click on your layer in the Layers Panel and then click on Open the Attribute table. Click on Open field calculator (CTRL+I). There, create a new (virtual) field with the following expression: CASE WHEN col1 = 'A' THEN 1 WHEN col1 = 'B' THEN 2 WHEN col1 = 'C' THEN 3 ELSE 0 END Edit: you can also use strpos to return the position of ...


3

To elaborate on FelixIP comment, the ordering of your fields in the attribute table is determined by the order set out in the pop up configuration.


3

There are a couple of issues at play here. The first is that ArcMap has traditionally used 2000 records as their standard cache amount from a table. When you load in a table, and this used to apply to shapefiles as well, it would do a first read of the table. If there were more than 2000 records, it would load the first 2k, and show 0 of *2000 Selected at ...


2

Open the attribute table and make it editable. Select by expression "column_1" isnull Along the top of the attribute table you an select in a drop down a column of your choice. Select "column_1" In the text box available write "column_5" Click "Update Selected"


2

It would be helpful if you posted your code. There is now a special merge function that is called for sp class objects that addresses the sorting issues with base merge breaking the slot relationships. You can bring up help for the sp version of merge using ?sp::merge. The slot id should be the same as the rownames in the @data slot. As such, you can use ...


2

If you want to delete all brackets in the column you go for: replace("your_column",'[','') It searches for all the brackets and replaces them by nothing. If it needs to be a special position where the brackets are you need to find them: For example by position with left, right or substr functions when the position is always the same in each line. If ...


2

Depending on what attributes you have in your states you can join them based on location using QGIS. The tool can be found at "Vector"-"Data Management"-"Join attributes based on location". Your target will be your shp1. It then should bring you all attributes from your states.


1

To continue with your code sample: import arcpy mxd = arcpy.mapping.MapDocument("Current") fc = r"W:\\GIS_Projects\\Impervious_Surfaces_Tables\\TOTAL" field1 = "SURFACE_TYPE" field2 = "SUM_SQ_FT" value = "" with arcpy.da.SearchCursor(fc, [field1, field2]) as cursor: for row in cursor: if row[0] == "BUILDING": value = str(row[1])...


1

If you use a spatial join you can append the attributes of one dataset to the other. If you are trying to fill a particular field you can then just copy it across using the field calulator


1

In your Field Calculator interface, go to the Function Editor tab, create a new file and input the following code: from qgis.utils import qgsfunction from qgis.core import QgsExpression, QgsMapLayerRegistry @qgsfunction(args="auto", group='Custom') def stringtoNum(field, feature, parent): val = dict(zip(string.letters,[ord(c)%32 for c in string.letters]...


1

You can select-scroll (scroll-select?) through records of an attribute table with Ctrl + Enter, which will also highlight the feature on the map. If you only want to scroll through a selection of features, you can create a layer from your selection first, and then scroll through that attribute table. I was looking for this today, so I found your question ...


1

One way is to create a new field containing your year, so you can count on it, and keep the full date for a later use. Use the function 'right' to fill your new field with the last four characters of your date field (only the year) : right( "dateField" , 4 ) This works with QGIS, but equivalent functions exists in other softwares.


1

Try Zonal Statistics or Zonal Statistics as Table Tool. The first I mentioned works with input raster dataset that you want to calculate statistics from and raster dataset or feature class that defines the zones. Only one statistics a ta time is supported here and you can select it from the drop-down menu. Result is raster dataset I think with the ...


1

In the bottom right-hand corner of the 'select by expression' window, there is the 'select' button: pull the drop-down to reveal the 'remove from selection', 'add to selection', etc. That should do it.


1

You could try simply exporting it. Any time I have this issue (whether adding a table or joining a table to a feature class), an export will solve the issue and your table will show all values. That's why when you imported the table into your geodatabase it worked. I'm not sure why but for some reason whenever I add a table to ArcMap it does what you're ...



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