Tag Info

New answers tagged

1

Here is a bare-bones example (borrowing from both Jim and Richard's answers): import arcpy fc = r'C:\junk\FILE_GDB.gdb\Export_output_gdb' # input feature class field1, field2 = 'Distance', 'Type' # fields to sort, and group fcOut = r'in_memory\blah' # output feature class # set up counters bankcount = 0 churchcount = 0 ...


2

modulo is quite convenient for this. you can go to the properties of your layer, definition queries, and set MOD("FID"+4)%8=0 if you want to create a subset, you can also use this to select by attribute and export the layer in a new layer, but it is not necessary. As a remark, your display should go faster with a file geodatabase. Also, shapefile ...


0

The SearchCursor syntax in the previous comments and posts is outdated and 10 times slower than a data access cursor if you have Desktop 10.1 or later. Only use DA cursors. Here is my script, assuming your categories of banks and churches are in the same field in the feature class, this script will get the top ten items for all categories or only specified ...


1

I think we can handle this using an arcpy.SearchCursor (I still use the Old School SearchCursor) and usage of the arcpy.Select_analysis() tool. The following is probably inefficient but I hope it helps. This assumes the Banks and Churches layer is held in a File Geodatbase (.gdb): import arcpy BanksAndChurches = r'Path\To\BanksAndChurches\FeatureClass' ...


1

The where clause is currently evaluating stepos literally as the value stepos, not the variable value 22. Move the stepos variable outside the where clause string, casting the numeric value to a string, like: arcpy.UpdateCursor(stefile, ' "POSITION" = ' + str(stepos))


3

lyr files aren't data, they're just symbology, and that one in particular uses a service rather than local data. It was helpful to search out the data behind the service for the asker. Did some google searching for you: I am assuming you used this online tool http://www.raleighnc.gov/home/content/Police/Articles/OnlineCrimeMapping.html This is the ...


0

You already have your where clause, so if you make a copy of your layer in your MXD (either using ArcMap or programmatically), and style it differently, then you can apply that same where clause as a Definition Query to the copy of the layer. That way only the "selected" features will be displayed in the copy of the layer.


0

I think you need to set the mxd object to the current open mxd like this: mxd = arcpy.mapping.MapDocument('current') Otherwise, it is opening a second map behind the scenes when you have a path hard coded in like you do in your script. By using the current mxd, you should see any selections that occur on the layers in the TOC.


0

Note that you don't need to delete the feature in your case. Just make sure that you use a SQL statement together with your "Make FEature Layer" in order to only select the feature that you want to use for processing. You can also use "select layer by attribute" with the "switch" selection if you have a selection. If you really want to delete, you can use ...


1

If you only want to select rows (leaving the geometry intact): From your table I understand that "the row above" means an identical line in the reverse direction. One solution is to create two views on the data each of alternate rows, do a join of name_x2_y2 on name_x1_y1 and select where myLayer_copy_length_km = length_km. First, if you ordered your table ...


2

One method would be to enter the criteria of your selections as SQL statements into the Definition Query tab of the properties for each layer. If the selections are complex, it may be simpler to make your selections, then right-click the layer and choose Selection > Create Layer from Selected Features which will create a whole new layer of just those ...


0

In ArcGIS the simplest tool to use would be Con (Conditional), which is specifically used for raster analysis. While selecting by attributes is not incorrect, attribute selection is more commonly applied to vector analysis where the tables tend to be more complex.


1

I actually found it! Extract by Attribute (Spatial Analysis). Drag raster layer to input, and tell the "Where Clause" "Count" = 1 then click OK. Easy Peasy Lemon Squeezy! BTW, I typed in Select Raster in the search bar. Hope this helps others!!


0

If the black 'water' attribute is the value "2" as it seems to be, you could reclassify the raster changing all other values (apart from 2) to null. This would leave you with only the black raster. What do you intend to do with the raster selection?



Top 50 recent answers are included