Hot answers tagged select-by-attribute
10
Yes Regular expressions are probably the best way to do this, and yes you can use regular expressions in the Calculate Field tool
First the regular expression
>>> import re
>>> val = 'National and Provincial capital'
>>> print re.sub('al$', 'X', val)
National and Provincial capitX
I'm subsituting "a" followed by "l" followed by ...
9
Depending on your version, you should be able to right-click on the layer you want to export, and select Save As... Choose "Comma Separated Value" from the dropdown list of the dialog box that appears. Then, in the "Layers" part of the "OGR creation options", type "GEOMETRY=AS_XY" or "GEOMETRY=AS_XYZ" depending on the dimensionality of your source data.
9
Use a Feature Selection iterator in ModelBuilder. You can specify the field you want the selection to be grouped by (your field containing the unique values). It will iterate over your entire feature class, creating a selection layer from each unique value. You can then add more tools for the rest of your workflow.
8
Without knowing what your data looks like, the general syntax you need to insert into the select by attributes window is:
[FIELD_1] IS NULL OR [FIELD_2] IS NULL OR [FIELD_3] IS NULL
and so on for as many fields as you have to work with. For reference the full query would be:
SELECT * FROM [TABLE_NAME] WHERE [FIELD_1] IS NULL OR [FIELD_2] IS NULL OR ...
8
You can change the styles of the shape file in the layer properties. Double click the layer and select style.
Select Categorized style and choose a field you want to visualize. Remember to classify your values before leaving the dialog.
7
Iterators would definitely help you here. Just in case you would need to export the feature classes on disk first, I attach the image I've created recently.
In case you don't want to bother with the model building, consider using Split by Attributes tool already compiled and available for use as a GP tool that does exactly the same thing as the model ...
6
As @Baltok alluded to, you are trying to have the Selection on a particular layer be treated in the same way as other layers are, with respect to drawing order. I think that by default, and design, ArcGIS makes the Selection override the symbology of anything that is underneath it, as a means of making it easy to find the selection.
Since you are selecting ...
4
If your underlying database supports sub queries, you can build a query with a TOP N that returns ObjectIds (or any other field) and use that in your definition query.
OBJECTID IN (*query here*)
For example, here's a SQL Server query for a TOP 20, random selection:
The above query will return 20 different rows each time the map or attribute table is ...
4
I am thinking you could do a spatial join of the points to your buffered polys which will join the attributes of both together, then you can select back the points that have matching ColumnX and ColumnY values.You can do just a Intersect or Identify as well, all three will give you a very similar result to append the attributed from the poly to the point ...
4
ArcMap has a built-in tool for that: Select Layer by Location (Data Management).
Just select all features from the Select Layer, then use Select by Location (Data Management) with the overlap type "Intersect" and the selection type "Remove_From_Selection." This will remove from the selection all those that intersect the other layer, and you'll be left with ...
4
Consider the following workflow:
Add Field to polygon feature class
Calculate field (See attached Code Block)
Dissolve based on your new reclassified field values (i.e. 1 or 2)
Hopefully this simplified approach, or a variation of it, will work for you.
4
This works for a "relate" (definded in an MXD). I'm not sure if it works for a "relationship class". Please try.
If you work with a relate you make a selection in table A and transfer this selection to tabe B (this works in both directions of a relate):
Make a selection in the "vegetation table".
Open the attribute table of "vegetation table"
Click the ...
4
SELECT s.name, s.type, ST_Distance(s.geom, p.geom) As distance, s.geom
FROM shops s, people p
WHERE p.name = 'tom' AND s.type = 'butcher'
AND ST_Intersects(s.geom, ST_Buffer(p.geom, 500))
ORDER BY distance;
One note, this assumes that both layers are in the same projection, and that projection can't just be lat/long or you'll need to use ST_Transform ...
3
You may like this for the added detail which is gathered
For QGIS 1.7 on Win7
I open the attribute table for the layer, use the buttons to;
invert selection to select all rows,
copy to clipboard
and paste into Excel. The first column contains Well Known Text information which maybe more useful to you.
Edit
I now use the plugin mmqgis to export geometry ...
3
Your queries should follow the SQL format discussed here. For what you're looking for, you can use something like this:
"Some_Field" LIKE 'A%'
The % is a wild card, so this would return records that have values in "Some_Field" that start with 'A'.
3
Python Addins: Can I Select a polygon feature in ArcMap and pass that Selection into a python Addin?
Whenever you run Python tools from within ArcMap and reference layers from the Table Of Contents as an input to a geoprocessing tool, it honors current selections, and will ignore unselected features. So your script should only select points that intersect currently selected polygons.
Note that this functionality will not work when executing Python scripts ...
3
Here is what you could do since you only have ArcEditor license:
ET Geowizard Split by Attribute tool
Create new text field called split in your point layer
Concatenate your year and month fields together to the new split field
Use the ET Geowizard Split by Attribute tool to generate all your shapefiles based on your split field
Another option ...
3
if I understood you right this great tutorial should answer your question:
http://woostuff.wordpress.com/2011/06/06/one-of-my-favorite-features-of-qgis/
p.s. from the same author there is alos a follow-up:
http://woostuff.wordpress.com/2012/01/25/improvements-to-the-qgis-rule-based-rendering/
3
I think it works as designed. each time you select a new field (even in the same session) the previous query is cleared. best bet is to keep a notepad with favorite queries, and paste those in as you neeed them. there is no need to do anything but paste it into the window and apply.
not much but that is my workaround :-)
3
Use the Summary Statistics tool with the following parameters:
Input Table: your point feature class
Statistics Field: the address value field. Select MIN as the statistic type from the dropdown list.
Case Field: the parcel address field.
This will group records according to the Case Field, select the minimum address value and write this value to the new ...
2
You are likely to see faster results by adding appropriate attribute indexes to your shapefile as outlined at Modifying indexes in shapefiles by indexing an attribute, or moving your data to a FileGDB and adding indexes there.
Any performance benefits of using an opensource option are likely to be outweighed by having to then integrate the results of the ...
2
For something like this, your best bet is to start learning Python and let ModelBuilder generate the heart of your Python code for you. Then just add the components that you need to accomplish your task.
1) Start by creating a model in ArcGIS like this:
2) Export it to a Python Script with Model-->Export-->to Script-->Python which will give you the ...
2
From the help topic 'Using geoprocessing to develop applications':
The following are some misstatements about geoprocessing:
Misstatement—Geoprocessing tools only take datasets on disk as input and only write datasets to disks. Another way this has been stated is that geoprocessing is "pathname to pathname" only. Only pathnames to datasets can be ...
2
The Attribute Assistant allows you to take field values from intersecting or nearby features and put them in specified fields of the created feature. It can be configured to populate fields when a feature is created, or on a selected set of features, and when you update a feature's attributes or position.
There is a tutorial here, and a blog post on how I ...
2
So we 100% sure good old search & replace won't cut the mustard?
Is the main issue, you also have values like:
'toast is Hot H and burnt'
And these kinds of attributes you want to ignore, but the search and replace can't be tweaked to exclude these attributes?
2
I am not aware of a non-programming way to do this, but you can use the Save and Load buttons at the bottom of the Select by Attributes window to save queries. I use this functionality for big queries that take some thought to build, but that I do not use very often, and therefore might forget before I need them again. If it is something that I need to do ...
2
If you are using ArcServer 10.1 you could create a Geoprocessing service which references either a model or script that you built to do this.
The link above gives step by step instructions on how to create the model, then create the services and finally consume it in your app.
Alternatively, there is this sample that uses a query to select records, you ...
2
This type of operation almost always involves writing a WHERE Clause so I think using at least a little bit of Python is in order.
Also while this is possible to do with ModelBuilder, IMO, creating a Python script tool with custom validation and more control over parameter settings could provide a better user experience -- for example, by making the Field ...
2
If you have a identifier that the duplicate points share, you've got it made with a simple SQL query. Just write a sql statement that groups by duplicate point identifier. You could pull your shapefile into a personal geodatabase (*.mdb) with ArcCatalog, then open it with MS Access. Or pull it into PostgreSQL.
FID | Duplicate_ID | Surname | Created
...
2
Good question!
Dmahr is right, it's quicker to simply just select the layer instead of creating a feature layer. I would also add the rest of the variables, even though they are optional.
arcpy.SelectLayerByLocation_management ("project_lyr", "INTERSECT", "Grid", "#", "NEW_SELECTION")
Another thing I find, is that running things in the python window of ...
Only top voted, non community-wiki answers of a minimum length are eligible



