The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [select-by-attribute]

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

Filter by
Sorted by
Tagged with
34
votes
12answers
61k views

Exporting feature class into multiple feature classes based on field values using ArcGIS Desktop?

I have a feature class with over 2,000 features, and I need to make them all individual feature classes based on a field. Is there a way to do this?
47
votes
7answers
94k views

Getting list of coordinates for points in layer using QGIS?

I've got a layer in QGIS that is comprised of points. Its attribute table doesn't have (show) the corresponding x and y coordinates for each point. Is there a way for me to extract a list of ...
11
votes
2answers
27k views

Extracting by Attribute Using ModelBuilder with User Input?

Using ModelBuilder, I want to create a tool that will let a user choose the value or values that will be used to extract a shapefile. I have a parcel layer with a "Parcel_Type" field. I want the user ...
6
votes
1answer
5k views

Select By Atribute using python script on .Shp file getting error 000840 value is not raster layer

I have a script that calculating vertices angles on Polyline layer and the selecting features in that layer at a specified angle. at the end of the script i'm using select by attribute and getting ...
13
votes
3answers
15k views

Selecting features by attribute if in Python list?

I am trying to complete a select by attribute in Python but based on the query of whether an attribute is present in a list. Such a query at its simplest should be something like this: qry = " \"...
17
votes
1answer
10k views

Selecting features by attributes using ogr2ogr?

I am writing a shapefile after some processing; however, in the final step I need to do some selection by attributes from the the shapefile. I am using the command in a shell with the aim of using it ...
21
votes
3answers
59k views

Assign multiple colors to features within a single vector layer

I want to give multiple colors to different features within a shapefile based on attribute values , is this possible in QGIS ? If yes what is the procedure ? Is there a way to provide color by means ...
11
votes
3answers
14k views

How to select features using an expression with pyqgis?

How can I select features with pyqgis using an expression? I tried to use an QgsExpression but the select method doesn't take it: exp = QgsExpression("'ogc_fid' = 482") cLayer = canvas.currentLayer()...
12
votes
1answer
6k views

SELECT TOP query in ArcGIS Desktop?

Is there a way to use a SELECT TOP (n) within ArcGIS desktop? Is appears that since the ArcGIS query builder is effectively building the SQL statement after the WHERE clause, that this may not be ...
12
votes
7answers
17k views

Selecting by month in date/time field using ArcGIS Desktop?

I would like to select by a specific month from my date/time field in ArcGIS, and just can't seem to find a statement that will work. I have multiple years and multiple days, but want to filter those ...
7
votes
3answers
39k views

Using String Functions (LEFT, RIGHT, MID) in Select By Attributes against a File Geodatabase using ArcMap 10

I finally (albeit reluctantly) made the switch from a personal geodatabase (pGDB) to a file geodatabse (fGDB) not too long ago. The main reason it took so long to switch has to do with how Select by ...
7
votes
2answers
2k views

Select by Attribute within a specific area (using Select by Location?)

I have a map with four layers. Two of these layers cover an entire state, and the other two focus on the area I'm actually interested in within the state. I'm trying to Select by Attribute with one ...
4
votes
1answer
427 views

Is it possible to save frequently used expressions in QGIS?

Is there any way to save frequently used expressions in the selection or field calculator dialogs? Obviously I can cut and paste them into a file where I might save them, but I mean within the context ...
17
votes
5answers
25k views

Selecting contours which heights are integers?

I have a Contours Featureclass, with an interval of 0.2 meters. I wish to select only those Contours, which are at 1 m interval? I have tried using the following syntax in the 'Select by Attribute' ...
9
votes
2answers
60k views

Selecting multiple values with Select by Attributes in ArcGIS Desktop?

Can anyone help me with selecting multiple values from the attribute table? I tried "Classes"='14'AND'07' but it doesn't work.
8
votes
1answer
7k views

Deleting selected features using PyQGIS?

I have a shapefile with only one field DN. I would like to delete all features which does not have specific value of the field. Let's say the DN can be 1,2 or 3. So far I was able to find out how to ...
7
votes
2answers
2k views

selecting by attribute and specific value replace

I want to select all of the features by attribute where the attribue in myattrib is like... Selection "criteria H". That is not a problem. However then I need to replace (myattrib," H", "") except ...
3
votes
2answers
236 views

Select rows where column values don't match the domain

In ArcGIS Desktop, I can use the Validate Features option in the Editor Toolbar menu to validate feature class columns against their respective domains. More info here in the Validating Features ...
7
votes
2answers
3k views

How to select and zoom in features from a QGIS Python Plugin

I'm very new to Python. I'm trying to find a way to select and zoom to the features from a QGIS layer. I've created a plugin and built a custom form. I have 3 values from the form which I need to ...
5
votes
1answer
2k views

Selection by attribute string with wildcard as part of name in ArcGIS Desktop?

I have an attribute field in my file geodatabase (GDB) where I'm trying to select all records that contain an underbar in the string field. The issue is that the underbar is considered a SQL wildcard ...
0
votes
2answers
8k views

What causes ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute) on shapefile? [duplicate]

My script runs perfectly for feature classes, but not shapefiles. It crashes at the point of selection, provided there is a query. gp.Workspace = "C:/someworkspace" fc = "featureclass.shp" query = "[...
4
votes
1answer
1k views

Is there a way to select what to import from planet-latest.osm.bz2 to database?

Is there a way to select what to import from planet-latest.osm.bz2 to database? I want to do something like : osm2pgsql ... --place='city' --admin_level='2' My goal is to use only cities and ...
3
votes
1answer
459 views

QGIS modeler: select by attribute wrong results

I am new to QGIS modeler and trying to write a script in which certain attributes are selected and written to a shapefile. See the attached image for the script and the select by attributes box. In ...
2
votes
4answers
1k views

Making multiple separate selections from attributes [duplicate]

I am using ArcGIS 10 with ArcEditor license. I have a 10 year composite of month-to-month temperature values for 17 weather stations. That makes 120 months. I have to select each and every month ...
1
vote
1answer
1k views

Debugging Select By Attribute tool within loop giving ERROR 000358: Invalid expression Cannot acquire a lock?

I have seen several similar posts related to this technique but I am still having issues. The following script is intended to select all points from one shapefile that are within the boundaries of a ...
31
votes
3answers
3k views

Is there a “Select by Attributes” plugin/widget for ArcGIS Server JS API?

I'm hoping to find some existing code which emulates the "Select by Attributes" dialog in ArcMap, within the ArcGIS Server JavaScript API. Writing a hard-coded QueryTask is easy - I'm looking for ...
7
votes
2answers
489 views

Breaking apart a polygon layer by unique values, creating many new layers

I have a large dataset of habitat information that I need to calculate distances from animal locations to the closest polygon of each habitat type. The way to do this, that I understand, would be to ...
3
votes
4answers
762 views

Select polygons one by one and export them using arcpy

I have a shapefile that contains 200+ metropolitan cities. In each city, there are some tract polygons. The dbf table looks like: tract city xvar 1 0040 20 2 0040 12 3 0040 ...
2
votes
2answers
6k views

Making mass/bulk update by attribute value in ArcGIS Desktop?

I have feature class with 70,000+ records (file geodatabase). I want to make in bulk update on an attribute where the value is NULL. Select by attribute shows that I have 5,000 records like that. ...
6
votes
2answers
2k views

subquery in select by attribute in Arcgis

I have a table with several fields. field A contains the same kind of values as does field B. I tried to select all points where the value in field A does not exist in anywhere field B using query ...
5
votes
2answers
5k views

Field Calculator does not notice selection? [closed]

I have a problem with the Field Calculator in ArcGIS 10. I selected specific points of a Shapefile I want to calculate, but FC is always calculating all fields. Unfortunately there is no checkbox in ...
4
votes
1answer
338 views

Selecting and updating attribute values using Python console in QGIS?

I am working with Landusefc and Class columns (ref table). What I want is: Selecting all water from "Class" and giving a value say '8' in the "Landusefc" column for these selected features. Table ...
4
votes
2answers
4k views

Selection subquery using another table in database ArcGIS

I need to 'extract' a list of variables based on the IDs from another table. Using a subquery seems to be the best method. I have a large list of variables and have outside calculated a second list. ...
3
votes
3answers
2k views

How to use the SQL in select by attribute to select the entries for each values in certain field?

I am trying to use select by attribute for the table in ArcGIS, which is similar to the following picture (lets say): I want to select those entries for each A and B, which have maximum count. I ...
3
votes
1answer
416 views

Slider for non time attributes in QGIS

How to filter data on attributes with a slider? By example, i would like to filter weights (CHARGE in my layer) attribute for polygons without to change the filter formula. The feature is available ...
3
votes
1answer
3k views

Finding points near points using PostgreSQL?

I'm going to have a database with a 'people' table and a 'shops' table. I'd like to find all people within 500m of a shop, and details from both tables. I'm used to working with mySQL, but I'm ...
2
votes
3answers
14k views

Python Script for Select by Attributes taking user input

I am trying to write a python script and create a script tool in ArcGIS that will let a user choose the value or values that will be used to extract a shapefile. These selected value(s) will then need ...
1
vote
1answer
1k views

Invalid Expression ERROR 000358: Select by Attribute

I'm attempting to select a certain point in a feature layer so I can perform buffer analysis on it. The code seems fine, but I am getting an invalid expression error: File "C:\Program Files (x86)\...
1
vote
1answer
2k views

Subquery a list in select layer by attribute management using python

I am new to python and having trouble with my script. I want only the records from the COMTRS field (of the pur_dbf_view) that match values from the ComtrsList to be selected; however, I am getting ...
5
votes
2answers
2k views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", '...
4
votes
2answers
26k views

QGIS select features from attribute table using the “LIKE” operator

I created an expression with the help of the GUI in the QGIS attribute table of a vector (shapefile) layer of Native American ("Indian") reservations in the USA state of New Mexico. "NAME" LIKE '...
4
votes
1answer
2k views

OGR: How to save layer from AttributeFilter to a shapefile?

I select a subset of features from my shapefile like so: node_lyr = nodes.GetLayer() q_str = "%s = %i" % (field, value) node_lyr.SetAttributeFilter(q_str) What is the best way to make a shapefile ...
3
votes
1answer
165 views

Select overlapped feature

I have points that are not equal but the distance between them is so small that it can't be seen even at scale 200k:1. I calculated the distance between these points and add it as attribute. Now I ...
3
votes
1answer
1k views

Selecting features in attribute table using maximum aggregate function

I have a table containing distances from one ID (an address) to another ID (bus stops). There table contains distances from all addresses to all different bus stops. Now I want to select the feature ...
3
votes
1answer
3k views

QGIS Filter layer by expression [closed]

Can I make the filter by the value that is obtained by the function? for feature in iter: name_dot = feature['name'] print name_dot expr = QgsExpression("\"name\"=name_dot") selection= layer....
3
votes
4answers
417 views

Selecting Maximum value for each unique ID

So i have a table (linked below) and for each unique PropertyID, i need to find the highest percentage value and extract that to a different table. I need to retain all the other attribute information ...
3
votes
2answers
3k views

Dissolving line segments in QGIS if they touch and fall within same class?

I have line segments that have the following 3 attributes (Class, start_point, end_point). I would like to merge/dissolve line segments that fall within the same class if they intersect (touch). i.e. ...
3
votes
1answer
602 views

ArcPy inconsistently accepts SQL queries for MakeFeatureLayer or SelectLayerByAttribute

I need to buffer a subset of features in a particular feature class. To do this, I am first creating a feature layer (using a SQL query to select only what I want), and then running Buffer. So my ...
3
votes
1answer
147 views

Selecting new records using values inside previous selected rows in QGIS?

I am trying to create a selection. First, I select records which have Null value in "Status" column ("Status" is NULL"). Then it starts to be a bit tricky. I want to select all the records which have ...
2
votes
2answers
1k views

Model builder: select feature based on attribute, iterator?

This is the data I have: shapefile with polygons shapefile with line features What I eventually want: line features attributes joined to the polygons that they fall in. I need to clip each polygon ...