|
POST
|
Hello all, I currently quite new to ArcMap/ArcGIS and am still figuring out the details to the program. I have an ArcMap I'm working on. I'm trying to figure out a particular layer (Specifically, habitats for different creatures)with lots of different categories that overlap/cover up each other. I want to have the capability to have only one habitat-type visible at a time, however, these habitat-types are polygons, and when I affect one of them (once I separate all the different categories out) I affect ALL of them. Does anyone know how to only manipulate one portion or field of a layer at a time? Not sure about the end goal, but normally I would create a definition query on the layer to filter just one habitat type. Right click on the layer and choose Properties. Press the Definition Query tab. Build an SQL statement to select a single habitat. You can use the Query builder to choose the field name containing the habitat names, and then press the show all values button under the list box to the left to see all of the habitat names. So if your field name was HABITAT and your species was 'LEAST BELLS VIREO" you would end up with: "HABITAT" = 'LEAST BELLS VIREO' Once filtered (after pressing the OK or APPLY buttons) the List All Values list box will only show the filtered value. To see all values again clear the definition query and press the APPLY button, then get the list. You can make as many layers for the Habitat feature class as you want, so you can set up one layer for each Habitat if you like. If you plan on editing in one of the layers you should permit NULL values to appear or set the edit template for the layer to prepopulate the Habitat name with the value you want to work on. To see null values the Definition Query would be: "HABITAT" = 'LEAST BELLS VIREO' OR "HABITAT" IS NULL
... View more
08-12-2013
04:18 PM
|
0
|
1
|
3278
|
|
POST
|
I don't use python if there is a geoprocessing way of doing things. Debug time is too much with Python for me. Keeps my life simpler and I would bet Append is faster.
... View more
08-12-2013
08:57 AM
|
0
|
0
|
6440
|
|
POST
|
Did you complete this assignment? The SWIS data you needed has been posted in the spreadsheet I provided.
... View more
08-10-2013
01:02 PM
|
0
|
0
|
1075
|
|
POST
|
Hello! Is there a tool that snaps features together (within a single feature class and based on a snapping tolerance)? My city's parcels are ridden with gaps and overlap! My boss said he knows of a tool (that at least used to exist) called 'Clean', but I can't find it anywhere. There is a tool called 'Boundary Clean', but it only works for raster data. I want to avoid creating a topology until after this preliminary step is done. Thank you in advance! Brittany The tool for a polygon feature class that fits what you want to do is the Integrate tool. This tool can be run on a single feature class. It modifies the original polygons, so before you use it be sure to back up your original polygon feature class so that if you do not like the results you can start over with other settings. You can also use it within an edit session, so that you can use the undo changes (but I would still back it up to be safe). Also, you should probably check the Environment XY Tolerance setting before running this tool. If you find that certain features need different XY tolerance settings to preserve their integrity you can control the tool by only applying it to a selected set of features. That way you can adjust the tolerance of feature groups differently. Some manual snapping may need to take place at the boundaries of two selection sets with different XY tolerance settings, although some careful use of selection sets and tolerance adjustments could minimize that. Clean was only applicable when coverages were the only way to create shapes. Coverages are fundamentally different from shapefiles and feature classes, in that they actually encompassed polygons, lines and points in a single data structure and the attribute data was held in an ESRI info database file. So all polygons could share the same lines and points more easily. Coverages suffer from a number of limitations, so they could not scale to the same number of features as modern feature classes and they could not support overlapping feature classes except in special types called Regions (assemblages of polygons). To convert or use coverages you have to have ArcInfo Workstation installed and the related maintenance tools require a Standard (ArcEditor) or Advanced (ArcInfo) license, not a Basic (ArcView) license. If your polygons features class is non-overlapping you potentially could convert it to a coverage and use the clean process or the clean tool.
... View more
08-09-2013
05:59 PM
|
0
|
0
|
2692
|
|
POST
|
If you were to try the Python route at some point, most posts in the Python forum read the related table and place its data in a dictionary to do the match up between tables. THe in memory dictionary will perform much better than repeated queries with a cursor. I suspect the Join must use some process through memory as well, since in a field calculation it initially hesitates, but then blasts through many join calculations, especially when the records to transfer can easily be read into memory.
... View more
08-09-2013
01:59 PM
|
0
|
0
|
6440
|
|
POST
|
Ok I have a feature class (260k records) and 3 tables. I need to get specific information (about 20 fields) from each into a new feature class. I have several different ways to do this and I�??m curious if anyone has done any performance testing and knows which of my options would be �??best�?�. Option 1 I could create several joins and append the data into the new feature class, with some additional field calculations for cleanup. Option 2 Create a python script that would loop through each record, search cursor the other tables for data, then insert cursor into the new feature class. Thank you Alan Assuming the join fields are indexed on all of the tables, option 1 blew away cursors under the pre-da version cursors. Have not tested the da version cursors. However, even ArcObjects cursors perform slower than joins, so I doubt Option 2 would work faster even with a da cursor. Hitting tables with repeated queries is much slower than a join, which does just one correlation of the tables, because each new query has to reset the table read, as far as I know. Main reason to not use joins would be if there was a 1:M or M:M relationship to traverse.
... View more
08-09-2013
11:41 AM
|
0
|
0
|
6440
|
|
POST
|
This won't work, since "lyr" is not the underlying feature class name. arcpy.SelectLayerByAttribute_management("lyr", "ADD_TO_SELECTION",'"TestDate" = (SELECT MAX("TestDate") FROM "lyr") WHERE "HydrID" = %s' % ID) This may work (but I don't know the Pythonic way to do the fc name substitution: arcpy.SelectLayerByAttribute_management("lyr", "ADD_TO_SELECTION",'"HydrID" = %s And "TestDate" = (SELECT MAX("TestDate") FROM ' + fc + ') WHERE "HydrID" = %s' % ID) How do you obtain the underlying feature class name of the layer from the fc variable? In any case, that is what must be after the FROM, the underlying FC name. You also much select the HydrID outside of the subquery, because the subquery will just return a date without any ID association.
... View more
08-08-2013
02:58 PM
|
0
|
0
|
1859
|
|
POST
|
Actually it appears fgdb subqueries can return Max date values, but they cannot do a correlated subquery that applies the Group By option. If the original query had worked it would only have returned all records with the dates that matched the list of dates associated with each unique ID value. But the query would not have preserved the group correlation in the selection output, since the original syntax only correlates the dates to the ID groups to create the date list, not for doing the selection of records based on those dates. An external table is needed and a join is the only way to do this.
... View more
08-08-2013
01:00 PM
|
1
|
0
|
5316
|
|
POST
|
This is not correct. A scalar sub-query in FileGDB can reference the same table. I do this all the time, and it was written specifically for this purpose. For example, if my table is ROADS, I can execute the following sub-query in a WHERE clause: OID = (SELECT MAX(OID) FROM ROADS) Could you provide some specific examples of the things you have tried that do not work as you would like? David: Thanks for correcting me and weighing in on this subject. Apparently my problems in attempting subqueries are either than my information is out of date (derived from tests mostly done at 9.3) or that this is related to the poor documentation that confuses syntax from many databases in the SQL Reference, which is what I have always tried to follow. In any case, I can confirm that after following David's examples he provided me in an e-mail that an fgdb can make subquery selections as David has said. Also fgdb subqueries can return Max(Date) values. The subquery can operate within a selection involving a single table and they can select based on Max date. So in reality it appears that the problem is that you cannot use "lyr" as the table name in the subquery. You must use the underlying Feature Class name. So for example, if my layer is named CENTERLINE but the underlying feature class of the layer is named CENTERLINE_EXTENDED, this subquery will not work: "MODIFIED_DATE" = (SELECT MAX("MODIFIED_DATE") FROM CENTERLINE WHERE "STNAME" = 'HIGH VISTA DR') but it will work if I put the actual feature class name. So this does work: "MODIFIED_DATE" = (SELECT MAX("MODIFIED_DATE") FROM CENTERLINE_EXTENDED WHERE "STNAME" = 'HIGH VISTA DR') So you do not need two queries, just one for your problem. However, you need to use the underlying name of the fc variable. So something like this should replace the two queries in the original post (untested and not sure if I have to access a property of the fc to get its name): arcpy.SelectLayerByAttribute_management("lyr", "subset_Selection",'"HydrID" = ' + i + ' And "TestDate" = (Select Max("TestDate") from ' + fc + ' WHERE "HydrID" = ' + i)
... View more
08-08-2013
11:25 AM
|
0
|
0
|
1864
|
|
IDEA
|
-->
Currently all summary tools in ArcMap, like Summarize from a tableview, Summary Statistics, Frequency, Dissolve, Spatial Join, etc., do not work to summarize dates for Min or Max values. Dates can only provide a first and last in the Summarize output from tableviews, but they can't even do that from Summary Statistics or Frequency. Many operations are based on finding the oldest or most recent or next date within a set of records in a table and having no way to effectively find this in ArcMap is very frustrating. Dates can't be the unique value field for the Summarize operation in a tableview, but they can be for the Summary Statistics, Frequency and Dissolve operations. Why does Summarize support the exact opposite options relative to Summary Statistics, Frequency and Dissolve for dates/ Why don't they all support using dates as unique values, and at least first and last summaries (although Min and Max is far more useful)? Personal geodatabases and SDE databases support such date summaries in their subqueries, but fgdb's do not not. Those other databases can also perform subqueries within the table where selections are being made based on the subquery result, but not fgdb's. I nearly always want to select the set of recrods for the max date of the set of unique IDs within the same table, not an external table. The closest work around for an fgdb I have come up with is listed in this post: http://forums.arcgis.com/threads/89570-Select-By-Attributes-latest-date-from-Data-Table?highlight=max+date However, the number of steps is far too many to use for on the fly analysis. Please devote more effort to making summarizing and uniquely grouping data on date fields more accessible and easy.
... View more
08-08-2013
10:40 AM
|
7
|
2
|
1683
|
|
POST
|
Here is another post discussing the limitations of subqueries when using fgdb's. The Pandas approach is probably your best option within Python as a work around. I personally want better support in the basic geoprocessing tools for finding Min and Max dates.
... View more
08-08-2013
10:00 AM
|
0
|
0
|
1864
|
|
POST
|
I have posted an idea to improve the ability to find Min and Max Dates and perform subqueries in fgdb's here. Please vote for it and offer comments and further suggestions if you need better support for analyzing dates in ArcMap.
... View more
08-08-2013
09:46 AM
|
1
|
2
|
5316
|
|
POST
|
Thanks for the response - obviously that was not what I wanted to here. I know. I have posted an Idea on the ideas page related to the poor handling and inconsistencies of date related summaries and operations in ArcMap here and requested that they improve the ability to get such information. Please vote for it and offer any other comments or suggestions on that idea.
... View more
08-08-2013
09:43 AM
|
0
|
0
|
1864
|
|
POST
|
Perhaps I did not express myself clearly - I do not have SDE. I am dealing with a file gdb. When I export the table to Access then I can easily extract what I want but within Arc and python I am totally lost. Your screwed. fgdb's support an extremely limited set of subqueries that are under the restrictions I mentioned and cannot do what you can do with personal geodatabases and SDE databases, which support full subquery functionality. Fgdb subqueries can only return one value from an entire table and the table providing the subquery value (MAX, SUM, MEAN, etc) must be external to the table where you are making the selection based on the subquery value. Nothing can make the approach your code is attempting work with an fgdb.
... View more
08-08-2013
09:09 AM
|
0
|
0
|
1864
|
|
POST
|
Python Beginner - Using version 10.1 and not an SDE install I have an atribute table with firehydrant inspection data. I am trying to create a layer that will only show the records grouped by fire hydrant number and then only display the most recent inspection date. When I execute the following code it runs fine and does in fact create the layer but it doesn't select the Max Date. If I have a record for Hydrant 100 with two dates I only want the most recent date to be created within the new layer. Appreciate any assistance on this. import arcpy
from arcpy import env
env.workspace=r"Z:\GIS_Data\gdb\GIS_Test.gdb"
fc="COA_FH_Inspections"
cursor = arcpy.UpdateCursor(fc)
idlist = []
datelist = []
for row in cursor:
idlist.append(row.getValue('HydrID'))
datelist.append(row.getValue('TestDate'))
cursor.updateRow(row)
print idlist
print datelist
idunique = set(idlist)
#Make a layer from the feature class
arcpy.MakeFeatureLayer_management(fc, "lyr")
for i in idunique:
if i == idlist:
arcpy.SelectLayerByAttribute_management("lyr", "New_Selection", '"HydrID" = i')
arcpy.SelectLayerByAttribute_management("lyr", "subset_Selection",'"TestDate" = (Select Max("TestDate") from "lyr"') Again thank you - Terry SDE and personal geodatabases supposedly support subqueries, but they are not well documented and not easy to troubleshoot. The Subquery has to return a single result and be in the format: RelateField2 IN (SELECT RelateField1 FROM Table1 WHERE SQLWhereClause1) I also do not think a subquery for a Max value can come from the same table that you are making a selection on (at least I know they fail for an fgdb, but those are much more limited than SDE subqueries, so that may not be a restriction for your SDE database) To do this I use the Summary Statistics. Unfortunately dates do not allow you to perform summary functions in any ESRI tools. The work around steps I have had to use are listed here. The advantage of the Summary Statistics approach over the approach you are attempting is that it can summarize thousands of max dates for thousands of unique IDs in under 2 minutes and do the selection of every Max date for every unique ID in the entire tables in one selection operation. A Feature Class to Feature Class output of that selection can make a 1:1 joinable table for other summary or data transfer operations. You can make the summary outputs to in memory tables if you don't want them written to disk. Processing each ID with individual queries can take up to 100 times longer to process, since that causes a new disk read from the start of the table for each new query.
... View more
08-08-2013
08:55 AM
|
0
|
0
|
2334
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-24-2026 11:37 PM | |
| 1 | 03-24-2026 08:01 PM | |
| 7 | 02-23-2026 08:34 AM | |
| 1 | 03-31-2025 03:25 PM | |
| 1 | 03-28-2025 06:54 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-09-2026
12:59 AM
|