|
POST
|
Hello, I run the model using ADD JOIN instead of JOIN FIELD tool but the result is the same (i.e., it is slower than when I worked with shapefiles). The problem I think is the copy features tool (at the end of the process). It takes four hours to process this step. Any recomendation? I send you a better version of the Model Builder: [ATTACH=CONFIG]28510[/ATTACH] Thank you very much. You are using a Personal Geodatabase (.mdb) in your model, not a File Geodatabase (.gdb). Personal Geodatabases do not perform well. File Geodatabases are almost exclusively what I use. Create a File Geodatabase and replace the Personal Geodatabase in the model with that. Try the Copy Feature with that geodatabase type as the output. It should take much less time. Also create the File Geodatabase on a local drive, not a network drive if you want better performance. What type is the field that you are joining on? Some field types like long text field values can cause problems in joins. Also, how many fields are in the feature class and table when combined? Part of what is taking so much time is the time the join cursor is searching through the joined data to find a matching record. You could try the Sort tool on the Feature Class and the Join Table and sort both of them on the join field before indexing and creating the join, which should improve performance. If you only intend to keep the final shapefile and do not actually intend to use the File Geodatabase feature class, I think you can remove the Copy Feature step and go straight to the Feature Class to Feature Class step that outputs to a shapefile directly.
... View more
10-22-2013
06:42 AM
|
2
|
0
|
5614
|
|
POST
|
-------------- rfairhur24, Thanks so much for your earlier help. This script has been working great! Just curious if there's a way to update it so it stacks my lllabels after the first word. For instance, if the company name is "Pacific Beverage Company", the script would still replace "Company" with "Co.", but stack the label where Beverage Company comes as a single line under Pacific. Thanks for your help, tiamo Try this: Function FindLabel([dist_name])
Dim name
If IsNull([dist_name]) Then
name = ""
Else
' Add as many replace expressions as you need.
' The first string in the pair must match your input exactly to be replaced.
' The order of replace statements matters.
' Words that can be part of other replaced words must come last.
name = [dist_name]
name = Replace(name, " ", vbNewLine, 1, 1)
name = Replace(name, "Limited Liability Company", "LLC")
name = Replace(name, "Company", "Co")
name = Replace(name, "Beverage", "Bev")
name = Replace(name, "Distributed", "Dist")
End if
FindLabel = name
End Function
... View more
10-21-2013
04:31 PM
|
0
|
0
|
607
|
|
POST
|
Hello, Thanks for the explanation. I was able to run the model, but ... unfortunately is not running faster than before. I send you the Model I have generated and I would really appreciate your feedback if you find any error. [ATTACH=CONFIG]28443[/ATTACH]. Some specific questions I was not sured when I generate the model: 1. I use the tool Join Field and not Add field in the model. Is that correct ? 2. When I used the Copy Feature tool I saved the feature within the geodatabase folder. Is that correct ? 3. In the last step (Feature Class to Feature Class tool), I was not sured how I had to do it, so I saved the final shapefile in a folder, NOT in the geogatabase folder. Is that correct ??? Thank you very very much. Here are my answers to your questions. 1. I have never used Join Field after trying it once and getting horrible performance. I always use the Add Join and Remove Join tools pair in the Data Management Tools Toolbox in the Joins Toolset. Add Join works in memory and is fast. Join Field directly alters your actual input feature class itself and writes the changes to disk, which performs horribly. 2. Correct. Copy Feature after using Add Join (not Join Field). 3. Correct. The last step is to output to shapefile. That step is only necessary if you intend to keep using shapefiles. Personally, if I could use a file geodatabase only I would never go back to a shapefile. I can't read your model. It is too small and low resolution. Please confirm that you have converted the shapefile and excel spreadsheet to a file geodatabase. Also confirm that before you do the Add Join that you have added an Attribute Index to the join attribute in both the source and the join tables. I could not tell if you did that in your model.
... View more
10-21-2013
06:23 AM
|
0
|
0
|
5614
|
|
POST
|
Thanks for your answer. It seems very promising but ... I haven't worked with geodatabase files. Could you please explain me more in detail these steps ?? Thank you very much!! You can create a geodatabase for your project in ArcCatalog or Desktop's ArcCatalog window in to a local workspace. In Model Builder use the Feature Class to Feature Class tool in the Conversion toolbox and the To Geodatabase toolset to convert the shapefile into the geodatabase by choosing it as your output workspace. For Excel use the Table to Table tool to copy it into your new geodatabase, also in the Conversion toolbox and the Geodatabase toolset. Use the Add Attribute Index tool under the Data Management toolbox in the Indexes toolset on the Join fields in both the new feature class and the table to optimize the join performance. Use the Make Feature Layer tool on the converted shapefile feature class. Use the Join tool with that layer as the input layer and the geodatabase table as the join source. Use the Copy Features tool under the Data Management toolbox in the Features toolset to export the joined features to a new feature class. Then use the Feature Class to Feature Class tool in the Conversion toolbox and the To Geodatabase toolset to convert the geodatabase feature class to a shape file by choosing the ulitimate shapefile workspace as your output workspace and naming the file with .shp.
... View more
10-17-2013
01:23 PM
|
0
|
0
|
5614
|
|
POST
|
Hi, I have joined an excel table to a shapefile with multiple registers (more than 200,000) and I�??m trying to export it as a new shapefile but it takes more than 4 hours to do it. Does anybody know another way to do it? I have to repeat the process more that 16 times (using Model Builder) and I need to find a faster way to do it. Any help will be much appreciated !! Thank you. I personally have no use for either shapefiles or excel tables when it comes to geoprocessing. I would convert them both into a file geodatabase, perform the join, export to a geodatabase feature class in the same geodatabase and then export to a shapefile. If the geoprocessing occurs on a local workspace file geodatabase and not one installed on your network you will get additional performance gains. I am sure it would cut down the time involved by hours. There is no way to optimize Excel for a join and shapefiles are also poor performers compared to file geodatabase feature classes and tables.
... View more
10-17-2013
01:04 PM
|
0
|
0
|
5614
|
|
POST
|
Making progress but still an error: Runtime error <class 'arcgisscripting.ExecuteError'>: ERROR 999999: Error executing function. An invalid SQL statement was used. An invalid SQL statement was used. [SmplRts2012Edited4CountyAnalysis] An invalid SQL statement was used. [SELECT * FROM SmplRts2012Edited4CountyAnalysis WHERE "RouteID" =26.2.00] An invalid SQL statement was used. An invalid SQL statement was used. [SmplRts2012Edited4CountyAnalysis] An invalid SQL statement was used. [SELECT * FROM SmplRts2012Edited4CountyAnalysis WHERE "RouteID" =26.2.00] An invalid SQL statement was used. An invalid SQL statement was used. [SmplRts2012Edited4CountyAnalysis] An invalid SQL statement was used. [SELECT OBJECTID FROM SmplRts2012Edited4CountyAnalysis WHERE "RouteID" =26.2.00] Failed to execute (Buffer). I would like to add that the selectedLine seems to be created, but empty. Open table and it has all fields but no data. I tried to find this lyr in catalog (both inside of ArcInfo in catalog and in ArcCatalog) and cant find it. I thought I might need to delete it and get started clean. The properties of the lyr says: File Geodatabase Feature Class Location: C:\CustomTools\DeerSurveyRoutes\RtsAnlysVectors.gdb Feature Class: SmplRts2012Edited4CountyAnalysis Feature Type: Simple Geometry Type: Line I would have assumed it would be in the "C:/CustomTools/DeerSurveyRoutes/rtsScratch.gdb" as set up in my env.workspace earlier. In any case. I can not find it, even after I shut everything down and bring it back up. Thanks! Alicia I assumed RouteID was a number. However, if the value "26.2.00" is a correct RouteID representation then it must be a string, not a number. If that is the case the SQL where clause would be: arcpy.MakeFeatureLayer_management(rtsPath, "selectedLine", '"RouteID" = \'' + ThisFID + '\'"' ... Single quotes have to enclose the ThisFID value within the where clause string so that when it finally is translated to SQL it will appear as: "RouteID" = '26.2.00'
... View more
10-17-2013
12:24 PM
|
0
|
0
|
1529
|
|
POST
|
thisFID = row.getValue('RouteID') arcpy.MakeFeatureLayer_management(rtsPath, "selectedLine", ("RouteID" = thisFID) and changed the syntax of the where clause multiple times '"RouteID" = thisFID' "[RouteID] = thisFID" I am working in ArcINFO 10.0 with file geodatabase in the python window. Frustrated! Alicia The where clause has to be contained in a quoted string within the MakeFeatureLayer method. But the ThisFID has to be translated from a number into a string before it can be appended to the where clause string. So it needs to be written as: arcpy.MakeFeatureLayer_management(rtsPath, "selectedLine", '"RouteID" = ' + str(ThisFID) + '"' ...
... View more
10-17-2013
10:38 AM
|
0
|
0
|
1529
|
|
POST
|
I have a zillion point/ line/ polygon features in a GDB with a domain which allows me to select a town name which the feature is in... I also have a town polygon layer with town names in it... I want to automate this so that I can get every feature to have the correct town name attribute without having to make sure to get it right when i make the feature.... (also so I can get all the ones that got missed when data was created... Spatial Join and then a normal join can do it. You might need to extract the centroids of lines and polygons, since if they touch the town boundaries they can pick up two or more towns. Anyway, it processes entire feature classes with only a few geoprocessing steps.
... View more
10-16-2013
06:02 AM
|
0
|
0
|
632
|
|
POST
|
I got the answer to my question from ESRI tech support. You can export a report from an in_memory feature class created using any standard geoprocessing tool, like Dissolve or Copy Features. The trick is to first use the Make Feature Layer on the Feature Class and then add the layer to a virtual map before running the ExportReport method. In the code sample below assume that PARCELS_Dissolve is defined as a real in_memory Feature Class and that PARCELS_Dissolve_Layer is a layer name string: arcpy.MakeFeatureLayer_management(PARCELS_Dissolve, PARCELS_Dissolve_Layer) lyr = arcpy.mapping.Layer(PARCELS_Dissolve_Layer) arcpy.mapping.ExportReport(lyr, r"C:\Mailing_Labels.rlf", r"C:\Mailing_Labels.pdf", "ALL") The ExportReport only works when it is given a layer that has been added to a map. Fortunately the arcpy.mapping.Layers method appears to be adding the layer to a virtual mxd since I never specified any actual mxd in my code. The code can run completely from Idle.
... View more
10-15-2013
03:58 PM
|
0
|
0
|
1121
|
|
POST
|
Both of the above suggestions work great, when run from the attribute table. I'd like to extend this, though, to creating a python program which reads all of the shapefiles in a workspace, adds a field for z, and updates with the appropriate value. For example, in a set of shapefiles that have PointZ values in meters, I'd like to add a field which captures the Z value in feet (from the source shapefiles, which are in meters). Not sure why I can't get this to work:
import arcpy
from arcpy import env
env.workspace = "P:/path/to/some/directory"
fcList = arcpy.ListFeatureClasses( )
for fc in fcList:
arcpy.AddField_management( fc, "Z_feet", "DOUBLE", "10", "3" )
arcpy.CalculateField_management(fc, "Z_feet", "3.28083 * float(!SHAPE.CENTROID.Z!)", "PYTHON")
In particular, !SHAPE.CENTROID.Z! seems to work in the field calculator (Python mode), but not in a Python program. Suggestions? Change "PYTHON" in your calculation to "PYTHON_9.3". "PYTHON" is pre-9.3 and does not use the current syntax of the field calculator. A new Python keyword was created so that "PYTHON" would remain unchanged for pre-9.3 scripts to maintain backward compatibility. Additionally you don't need to cast to float and you don't need to do the multiplication to convert to Feet. Change the calculation to: !SHAPE.CENTROID.Z@FEET!
... View more
10-15-2013
02:10 PM
|
0
|
0
|
1964
|
|
POST
|
Hi, I am using modelBuilder in order to automate many actions and it has been greate. Therefore there is a step where I need to summarizing a column RECNO in order to get sum of objects within each unique RECNO. The ArcToolbox Summary Statistics is not a right tool for this case. Does anyone can help me to insert summarizing function on modelBuilder? Summary Statistics is the perfect tool to do this. I don't know why you think it wouldn't be. It can use the RECNO field as a case field and then use whatever field you need to sum as a Summary field. Make your original data a Layer or Table View with Make Feature Layer or Make Table View, and Join the summary result on the RECNO field to the source and Field Calculator the summary results to your original data. You can even output the summary to an in_memory table if you don't want it stored on disk. If you want spatial outputs you can use Dissolve to summarize your data into features. Spatial Join can work in some cases. Frequency is also available, but that requires an advanced license and I find Summary Statistics does everything Frequency does plus more. Python can do this with a cursor and Model Builder could call the Python script.
... View more
10-15-2013
01:27 PM
|
0
|
0
|
1635
|
|
POST
|
Brackets only apply to VBA and VB Script fields. With python you use exclamation marks for fields. If you are at ArcGIS 10.0 or above, VBA is no longer supported by the Field Calculator and VB Script, which replaced it, cannot do geometry calculations. You have to use Python. Also you have to specify that you want the Centroid for a point feature class. So check the Python option and use: !Shape.Centroid.Z!
... View more
10-15-2013
03:20 AM
|
0
|
0
|
1964
|
|
POST
|
I despaired trying to get reports to work, the output was too complex. So I switched to exporting to a spreadsheet using the Excel COM interface and a template. Another radical alternative might be to export directly to a PDF using reportlab. Reportlab has an easy module to pour data into tables and graphs. Or maybe use matplotlib? That is very disappointing, and I know you are not someone to give up easily. I will call tech support on this then. I have a report design they have already helped me with and will add this to the support call.
... View more
10-14-2013
01:11 PM
|
0
|
0
|
1121
|
|
POST
|
Hi, Thank you, I now understand why I cannot see both the entries for each TOID with a join. I think I have the answer to your question: the summary cannot work with the null values as null is not automatically assumed to be 0 in a numeric field? - Therefore it would be looking for the min or the max of nothing? Thanks again, Liam. Try the summary. You are wrong about the assumption of the Summary. 0 is not used in the place of Null. Null is preserved for Min and Max in a Geodatabase table if Null is the only choice. It is disregarded if there is any non-Null choice. So, I lied a little about the output. If there is a Null in all input entries then the output of both Min and Max is Null, as I showed. However, if one of the two entries is not Null and the other is Null, the Null entry is ignored and the Min and Max of the two records would just be the non-Null value. That is what you want anyway, since if you have a non-Null value you don't care about the Null value. You really only need the Max of FromTo and ToFrom, since you don't care about the Null if a non-Null value exists. The only time you might care about a Min and Max is if you somehow had two different non-Null values for a single direction, which as I understand it, makes no sense for your model. So if this was the input: CarData_RoadLinks_Statistics RoadLinkTOID ToFromTotalStats FromToTotalStats 1 10 Null 1 Null 1 2 5 Null 3 Null 7 This would actually be the output to a geodatabase table. CarData_RoadLinks_Statistics_Statistics RoadLinkTOID Min_ToFromTotalStats Max_ToFromTotalStats Min_FromToTotalStats Max_FromToTotalStats 1 10 10 1 1 2 5 5 Null Null 3 Null Null 7 7 You only have one slot to fill for each direction per ITN_RoadLinks feature and it is impossible to fill a single directional slot with two different values. You must make a choice if Min and Max are different or take their sum or their average. However, you should always disregard the Null value if there is any non-Null value. You would only preserve the Null output if all the entries are Null. That is exactly the behavior of the Summary with Min and Max when Null values are involved. Even if you requested the Mean, the Null values are disregarded when you do a Mean of two records where one has a Null value and the other record has a non-Null value. In that situation, the Mean will just be the non-Null value for those two records. The Mean will not be half of the non-Null value, which is what the assumption of 0 in the place of Null would produce. Anyway, how would you make a single ITN_RoadLinks feature hold both a Null and a non-Null value at the same time for the ToFromTotalStats? How would you make a single ITN_RoadLinks feature hold both a Null and a non-Null value at the same time for the FromToTotalStats? You can't. You would have choose one or the other. The summary makes the choice the same way you would by only considering Null values when no non-Null values exist. If any non-Null values exist the Nulls are disregarded entirely. Null and non-Null values are never mixed together by the Summary tool. Just in case you ever have two different non-Null values for a specific direction on a specific segment, how would you make a single ITN_RoadLinks feature hold two different non-Null values at the same time for either of those directional fields? You can't. You would have choose the Sum, the Min, the Max, or the Mean. Those summary values are what the Summary Statistics tool gives to you to translate two or more values into a single value for a single slot. If this finally answers your question, be sure to mark the thread as answered for the benefit of others.
... View more
10-14-2013
03:52 AM
|
0
|
0
|
8729
|
|
POST
|
I am not surprised by the records loss you see if the relationship is in fact a One-to-Many relationship. Stop joining the data together and stop introducing new names for your objects like "JOIN SAMPLE DATA:" and "INDIVIDUAL TABLE SAMPLE DATA:". Get me down to the raw data before the join. A joined table cannot be edited while it is joined to another table. That is an intentional behavior and is especially required with a One-to-Many relationship since ArcGIS cannot interpret that kind of relationship through a join. One-to-Many relationships are not supported by joins. Since there are usually 2 table records you must convert it to a single record to use it through a join. Either they must be split into two tables to use a join to transfer the data, with one containing the first instance of a RoadLinkTOID value and the second containing the second instance of the same RoadLinkTOID value. Then you would do two different joins and make a choice if any overwrites would occur as a result of the second join. Otherwise you need to summarize the table records again so that there is only one record in the join table. You can never see both records through the join without exporting the join while both are in the same geodatabase. But the effect of the export would be to duplicate the feature shape into two overlapping shapes, which you do not want. I advise you to collapse the Summary table into a one-to-one relationship and get rid of the Null values. If I understand your data correctly this can be done with the Min and Max operator in a summary when only two records need to be collapsed. What I currently imagine your data to look like in reality is shown below: ITN_RoadLinks: RoadLinkTOID CarDataToFromTOTAL CarDataFromToTOTAL 1 Null Null 2 Null Null 3 Null Null CarData_RoadLinks_Statistics RoadLinkTOID ToFromTotalStats FromToTotalStats 1 10 Null 1 Null 1 2 5 Null 3 Null 7 (2 records with the same RoadLinkTOID value matching the one above) What I want to do is convert the CarData_RoadLinks_Statistics arrangement using another Summary to: CarData_RoadLinks_Statistics_Statistics RoadLinkTOID Min_ToFromTotalStats Max_ToFromTotalStats Min_FromToTotalStats Max_FromToTotalStats 1 Null 10 Null 1 2 5 5 Null Null 3 Null Null 7 7 This new table structure can be joined to the features as a One-to-One relationship join and unlike a One-to-Many relationship no records will fail to show up in the join. Now, tell me why I cannot do the additional summary I am proposing with your CarData_RoadLinks_Statistics table to convert your existing One-to-Many relationship into a One-to-One relationship.
... View more
10-13-2013
01:20 PM
|
0
|
0
|
2682
|
| 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
|