Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [select-by-attribute]

To select data records according to logical criteria applied to their field values ("attributes")

-2
votes
0answers
20 views

Selecting particular feature in PyQGIS? [duplicate]

How to select a particular feature of one of Layer? This feature can have multiple attributes and wish to select using one of the unique attribute value. How can we achieve this using PyQGIS?
0
votes
1answer
28 views

Using keyword in SelectByAttribute expression?

I've used SearchCursor to return the single value of a record (8 digit number) for row in arcpy.da.SearchCursor(table, ['PID']): if row[0] is not None: ID = row[0] break Now I would like ...
1
vote
0answers
8 views

Select by attributes ModelBuilder - text string partial values for parameter

I have a feature class of suburbs that I want to do a select by attribute on the Locality (=suburb names) field, passing a user input string parameter to selection expression. I have the query ...
1
vote
1answer
103 views

Getting particular feature using expression in PyQGIS? [closed]

How to get a particular feature using an expression in PyQGIS? For example, there are 100 houses (with 100 entries in Attributes Table). I want to get only one house with field name ("name"=="John's ...
3
votes
1answer
16 views

Calculate a field using text from another field separated with comma

I have an address field containing the following text: "64,ramkoti,hyderabad,500070" I need to copy hyderabad to another field. What would be the code used in the field calculator tool to achieve ...
0
votes
1answer
29 views

Getting ERROR 000840 from arcpy.SelectLayerByAttribute_management?

I am trying to select layer by attribute and for that, I am using arcpy.SelectLayerByAttribute_management function . My command is as follows: arcpy.SelectLayerByAttribute_management(union, '...
0
votes
1answer
29 views

Selecting by attribute by specific characters fields

I have a field "HNR_S". It contains values like "124", "122", "1315", "1465", "15151", "124512642". How can I select more than three numbers?
0
votes
1answer
26 views

Filtering attribute table based on names in another table using QGIS?

I have a shapefile showing a list of district names. I have (currently in Excel) a long list of district names in a table. I would like to filter those districts that are in the other list. I think ...
0
votes
1answer
22 views

ArcPy - Select Layer by Attribute / Delete Selected Layer - SQL

I feel like I've tried so many iterations of this, can anyone assist with how to use ArcPy to selected layer by attribute then delete selected layer? I think my SQL query is incorrect? import arcpy ...
1
vote
1answer
22 views

Can't select by attribute for new attributes added by a join in ArcGIS Pro

I'm new to ArcGIS and am following some tutorials. I did a join to add some data to the attribute table of one of my layers. Now, when I go to select by attribute and look for those attributes they ...
1
vote
0answers
23 views

Automatically select a feature from another layer based on shared attribute in QGIS [duplicate]

I have two shapefiles, A (polygons) and B (points), and I need to select all features from shapefile B that have the same attribute (for example, "Name") as shapefile A, and I need to do this ...
1
vote
0answers
48 views

QGIS: Add attribute from polyline layer to point layer [closed]

I want to add an attribute from a vector line layer to a vector point layer. The vectorline is railwaynetwork. It has been divided into segments automatically. To process the data further I had to ...
2
votes
1answer
48 views

Select by attribute does not work on an indexed field

I came across an issue where I can no longer run a select by attribute on a field (In my example it is "Students_7") in a shapefile that previously worked. Even when I build the query using the wizard ...
0
votes
0answers
24 views

Selecting layer by attribute in Python Toolbox of ArcPy?

I have this code where te input parameters are a shapefile [param0] and a string list [param1]. The second parameter is a list because I want that user select it. class Tool(object): def __init__(...
1
vote
0answers
21 views

QGIS Atlas Feature for multiple polygons with same attribute [duplicate]

I have a shapefile of city blocks in a given city. Each polygon represents an individual lot, but the attribute table includes a column called "sector", that denotes the zone of the city that the lots ...
2
votes
1answer
41 views

How to use SQL queries in arcpy.SelectLayerByAttribute?

I'm trying to select features from a layer that I know exist. I'm using SelectLayerByAttribute_management in arcpy. I have a layer that is properly defined earlier in the code named "tourmaline". I'm ...
2
votes
1answer
44 views

How to extract records with a specific but shared attribute

My goal is to isolate the ID#s observed in Zone C and only Zone C (like IDs 2236 and 3007 in the attached table). There are records for which the same ID was observed in other zones besides Zone C, or ...
0
votes
1answer
26 views

Selection by attribute from list

I need to select a layer with all attributes while the selection comes from a table. With my code I get only empty feature classes and emtey Excel files. The tab_list Elements are the selection value. ...
0
votes
0answers
19 views

Selecting values with date-format by using SelectLayerByAttribute_management with input Parameter

I am working on a Tool which selects records depending on the input value. Works fine, till I want to select date-records. I used def buildWhereClause(self, table, field, value): # Add DBMS-...
2
votes
2answers
56 views

Selecting all values with <Null> by using SelectLayerByAttribute_management with input Parameter

I am trying to select all values with Null by using the SelectLayerByAttribute_management. But the Fieldname in the where-clause is alterable by using the input-parameter. That is what i tried: if ...
0
votes
1answer
32 views

Using input parameters to select layer by attribute

I am trying to create a Python-Toolbox with following Tool: inputFeature: A User has to load a Feature inputField: Then he has to to select a field from the Input Feature inputValue: At the end ...
1
vote
1answer
52 views

SelectLayerByAttribute_management searching with different datatypes

I am trying to use the SelectLayerByAttribute_management in a tool. The tool works like that: The User puts in the Feature which Layer should be selected by attribute -> "inputFeature". Then he ...
2
votes
1answer
33 views

Understanding backslash in arcpy.SelectLayerByAttribute syntax?

I copied this line from Python code, but I don't understand the \" \" around the word District. arcpy.SelectLayerByAttribute_management(Community_areaFC, "NEW_SELECTION", "\"District\" = ...
0
votes
1answer
26 views

Conditional join or query of two layers

I have two layers that I'm trying to conditionally join. One layer JUNCTIONS has junction IDs (NAME) and flooding volumes (Flood_cf) for each junction. I'm interested in identifying and symbolizing ...
1
vote
0answers
39 views

Select Feature Based on Iterate Row Value in ModelBuilder

I have a table showing commuting trips from home to work. home_id represents home and work_id represents work. Now I want to step through the trips table using Iterate Row Selection in ModelBuilder, ...
1
vote
2answers
47 views

In ARCGIS 10.5 mxd I need to put definition query for one layer as Current Year in Year fields , What i need to set the query

I have a feature class and related info in another table, the table having fields as Year, Year having values like - 2016,2017,2018,2019... Presently I Put the definition query for table Year = 2018 ...
1
vote
3answers
81 views

Searching for NULL values in feature class table

I am looking for a way which I can search whole my feature class in ArcMap to find if has any NULL values on it. I know how can I do this with "Select By Attribute", but I am looking for a faster way ...
0
votes
2answers
59 views

1000 features limit using CopyFeatures_management?

I wrote a script to select features from a sql server spatial database based on date, there are thousands and thousands of records. The script runs but when I used the CopyFeatures_management tool, ...
3
votes
0answers
40 views

Select by attributes returning wrong records

I'm trying to select by attributes on a parcel shapefile with 555k+ records using the apn field and the statement is returning records that have completely different values. My initial statement was "...
0
votes
2answers
47 views

Select by Attribute homework help

I am learning how to use ArcGIS and I am unsure how to assign appropriate buffer distance to each lake size classes for a homework assignment, please see the picture below. The goal is to place ...
1
vote
2answers
55 views

Where Clause in SelectLayerByAttribute function resulting in invalid expression

All of the attempts below result in ERROR 000358: Invalid expression Any ideas on what I am doing wrong? I am working within a File GDB and with polygons. Attempt 1: def SelectLayer(val): print ...
1
vote
1answer
30 views

Save Attribute Query

How to save attribute query on qgis 2.14? I have more than 20 queries. The recent queries save only 20 queries. If I can save them, it will be more effiecient.
2
votes
2answers
50 views

Copying only shapefiles which have specific field attribute in another folder using ArcPy?

I have 100 shapefiles that all have 2 fields in common called Type2017 and Type2018. The whole of the fields have only one number (1 or 2 or 3). fo example, Type2017 = 1 or Type2018 = 2 I would ...
5
votes
2answers
299 views

Selecting all features except one using QGIS?

Using QGIS 2.18. I have 346 polygons on a layer and I want to display all but one. In this instance I wish to run a query using field ONSCode but show all except 17UB. I have been trying to use NOT ...
0
votes
1answer
27 views

Select by attributes appears to not work correctly

This table: ca ca1 12333 123330 doing this query in Select_analysis: in the where parameter. ca = 'substring(ca1,1,5)' gives empty feature layer and this: ca <> 'substring(ca1,1,5)' ...
1
vote
1answer
29 views

QGIS assigning accumulating numbers to field records following order of selection using @rownum

I have selected points in QGIS and they have a field (towerno). This filed represents values in the range from 658 to 800 but I want to narrow it from 558 to 700.
0
votes
1answer
32 views

Cannot find results of MakeFeatureLayer, cannot use SelectFeatureByAttribute

I have a goal: take a feature class, select some of the records by attribute, and make a layer for further processing. Should be simple, but I am having multiple problems. Note: I am working in a ...
0
votes
1answer
62 views

Equivalent of 'Left' function in Select_analysis

I tried to find the equivalent of Left fuction because it doesn't work in ArcGis. I found a post that suggested the word substring: the query is: WHERE (IAS.C_A)<>Left([C_A1],5))); and I ...
4
votes
1answer
79 views

Display Multiple Symbols for a single point feature by field attribute vale

I want to create a point feature layer and add points. Around the point I'd like to add icons/symbols and labels based on data in fields of an attribute table.
0
votes
1answer
53 views

ExecuteError: Failed to execute. Parameters are not valid error when SelectLayerByAttribute run in Python 2.7

I am running a line of code in a Python 2.7 environment using arcpy.SelectLayerByAttribute_management: fl_haz_selects = arcpy.SelectLayerByAttribute_management(S_Fld_Haz_Ar, "NEW_SELECTION", "\"...
3
votes
1answer
47 views

Correct use of SelectLayerByAttribute_management in ArcPy?

What are displayed in the tableName are polygon features in a geodatabase. I would like for each row in a loop to take each row TableName and apply the sql query from the sqlstring field and make the ...
1
vote
2answers
133 views

Not Able to Pass Where Clause in SearchCursor in ArcPy

Can you please take a look at this snippet and let me know why I am not able to properly pass the Where Clause ('"[NAME_1]" = Ohio') in SearchCursor? import arcpy from arcpy import env def ...
1
vote
1answer
145 views

Using select by attributes then calculate field on selection in ArcPy?

ArcGIS Pro 2.3 I want to create a standalone script which runs outside of ArcGIS Pro (for automation purposes), which selects features (with blank attributes) in a feature class and runs calculate ...
2
votes
1answer
32 views

arcpy: Select layer by attribute with SWITCH_SELECTION seems not to work

I have a large feature classes, where a field named "gridcode" contains integers values from 6 to 17. I would like to get rid of features, where the gridcode = 6, 9 or 15. Therefore, I have created a ...
0
votes
1answer
33 views

Selecting multiple partial field contents using ArcGIS Select By Attribute?

I can't seem to get the hang of ArcGIS Select By Attributes SQL. I'm trying to "select all that contain Street and Road and etc." Working with polyline SHP. This works: "NAME" LIKE ('%Street%') ...
1
vote
0answers
16 views

QGis Python featurerequest with lists

I want to select some features and do some actions to this selected features. Something like if attribute in field a is = abc than do something. But the selection will not fit. As written in https://...
1
vote
1answer
96 views

Select by attribute how to only select numbers in a string field

Using a SQL experssion in the "Select by Attributes" table, how would I only select records 1, 4, 5, 8 and omit the rest (I only want to select values that are entirely numbers)? What I have right now ...
0
votes
2answers
79 views

NULL value not equal to empty value for attribute

I have a feature layer in a gdb. It has an attribute named uniqueid. Some of rows have a value for uniqueid and some do not. I am trying to select only the features that have a value (are not blank). ...
0
votes
2answers
37 views

Select by Attributes query ArcMap 10.5.1

I am trying to find capitals with a population between 200,000 and 300,000 and I do not know how to build the query correctly. Here is what I have, but it doesn't work:
2
votes
1answer
465 views

AttributeError:'QgsVectorLayer' object has no attribute 'setSelectedFeatures' PyQGIS 3.0

What is the new expression of setSelectedFeatures in PyQGIS 3.0 ? I wrote the following code: def verCode(layername): layer = QgsProject.instance().mapLayersByName(layername)[0] selection= ...