|
POST
|
Completely agree with this. And not just an issue with performance, there are lots of limitations to the Python Add-In. Since my .NET dev environment has been limited, I've had to get creative with the Python Add-In and Geoprocessor object development. It is a pain to get it all integrated and implemented, but comes with the advantage in distribution compared to a COM/ArcObject component that requires installer packages and such. .Net Add-Ins are as easy to distribute as Python Add-Ins. I see no advantage to Python if an application needs a GUI.
... View more
06-11-2013
05:02 AM
|
0
|
0
|
2432
|
|
POST
|
Hello everybody, I sure hope this is the right subforum. If not, please redirect! I've been looking for hours for a simple tool, I can hardly believe why I havent found it yet! It's basicly what the "Near" tool does, but instead of returning the distance (or angle) of the nearest Feature, I want the tool to create a column with a value of my choosing. For example: I have a couple of layer of points and one of polygons. The polygon layer has a column with the attribute "name". I want the near feature (in this case the polygon) to add the value "name" to the point feature. Is that in any way possible? Thanks in advance, Ratnanil That is what the Spatial Join tool does. Set the tolerance to a level that you desire and probably use the Closest option.
... View more
06-10-2013
03:40 PM
|
0
|
0
|
994
|
|
POST
|
I have similarly used the tools schema configurations to customize standard tool input dialogs (for example populate a combobox based on a selection in another combobox). It, however, suffers performance degradation if you have too many interacting items on a dialog (I had about 15) especially if they perform database queries in response to user inputs (which mine did). The degredation affected opening the tool and making dialog selections. I ended up using VB.Net to rebuild the interface as an Add-In and was much happier with the performance and GUI flexibility.
... View more
06-10-2013
11:18 AM
|
0
|
0
|
2432
|
|
POST
|
Hi All, We have developed a GUI with the help of PYQT. Now we have to add this GUI with ArcMap as a extension. Meanwhile some of the tools in the GUI (i.e Combobox - to display list of layers) needs to interact with .Mxd also Can you guys please help on this. THanks and Regards, Sreeni. Although I would love to be proved wrong, I believe that ESRI has not found a way to get GUI interfaces developed in Python to interact compatibly with ArcMap. They both compete for OS attention and identical resources and generate errors or crashes. So I have not heard of a way to make a python GUI part of an ArcMap extension.
... View more
06-10-2013
10:52 AM
|
0
|
0
|
2432
|
|
POST
|
For cartographic purposes I would like to nuge a few of the symbols of features in a feature class to make them more visible. Is there a way to move the symbol without editing the feature class? I want to maintain the locational integrity of the feature class. Representation is designed to do this and is best for saving the symbol locations permanently. I believe that there are some restrictions on using representations with the Basic license level, but I am not sure how many. Another trick would be to select the features you want to manipulate and export a selection layer. Then borrow the symbology of the original layer and modify the symbol offset values in the symbol editing dialogs. You would probably have to invert the selection and do the same with the rest of the features to avoid showing overlapping symbols. Or similarly, if each feature has a unique ID other than the ObjectID export the feature selection as a new feature class and symbolize it with an offset symbol. You could join it to the other original feature class and set the definition of the layer to show only the features not in the new features class with the statement: JoinedFeatures.ObjectID Is Null
... View more
06-10-2013
10:39 AM
|
0
|
0
|
866
|
|
POST
|
I have a feature class of topologically correct river features. The line�??s are single part features, they have the correct flow direction, and each line end is snapped to its downstream recipiant. I have created routes using the linear referencing tools. I exported the end nodes, and used the end node and the route to calculate river mile. The trouble is... In about half of the cases the distance along the line is zero because the linear referencing tools are getting a distance from the line that produced the end node. What I want is to get the distance from the downstream intersecting line (which will be greater than zero!). How do I accomplish this? I have tried using the line work to linear reference using the routes, but this just returns a start distance of zero, and an to distance that is equal to the line distance and not the distance along the line it intersects. Any help would be appreciated. I am not sure I am following your set up. A picture would really help. It sounds like you want to assign measures to fields and use them to rebuild the routes at branching points. Is that correct? Anyway, try getting a set of points at the Intersections using the Intersection Tool. Then use the Locate Features Along Routes tool with the option to get all available routes to find the measure at the location of the intersection on the mainline route you want to follow. To get the measure of the points use the Field Calculator with the Python expression of: !Shape.Centroid.M!
... View more
06-07-2013
04:33 PM
|
0
|
0
|
685
|
|
POST
|
VBA is supported in the same manner in 10.1 as in 10.0. I'd imagine it is the same for 10.2 though I haven't used it yet. My understanding is that at 10.1 you can only read and run VBA code, but you cannot edit or create new VBA code. At 10.2 it should be gone if ESRI follows through with the game plan they laid out over 3 years ago. VBA is deprecated because Microsoft abandoned it and won't sell any more licenses. ESRI is using up licenses they purchased years ago (probably when they partnered with Microsoft for a time).
... View more
06-05-2013
06:13 AM
|
0
|
0
|
2798
|
|
POST
|
I'm not 100% sure how to try the method you've mentioned above anyway you can break it down a bit? I've managed to plot the points manually using direction/length and point at the end of a line but I'm looking for a faster way to do it, Like on COGO where I put in the distance offset and what side of the line and it creates an offset-ted polyline The data I have at the moment is a table with 4 columns, ID, Distance, Offset, Description. I listed the tools and linear referencing does exactly what you want. Use the Linear Referencing Toolset. Start with Create Route Features and turn your lines into LR routes. Since it sounds like you have distances along the line and offsets in your point table then make your table of points an event table by right clicking it and making the field that corresponds to your line name the Route ID, the distance along the line is the measure of the point (DISTANCE) and the offset distance field the side offset (OFFSET). The offset units must match the XY projection of your lines/routes and should. That is all there really is to it except that to go left or right one set of side offsets is positive and the other is negative. Figure out which is which and multiply your distance offsets by -1 on the side that uses negative values (there are two options that can make either side positive or negative). Just get started with Create Route Features. LR is the way to work with linear features that does everything you described. It can create offset lines if do all the steps above for a line event table, but you check the option for line events and provide two measure value fields instead of just one. As long as your table is filled in with the data all points or lines are created in one step as an event table. No need to do them one at a time. It sounds like all you need to add to your table is a field for RouteID (assuming ID is the point ID and not the line ID). The RouteID field value would match the values in the field you use from your lines in the Create Route Features tool as the Route ID field. Make sure you build your Routes in the same orientation assumed by the Distance value in the table you have.
... View more
06-05-2013
05:09 AM
|
0
|
0
|
3166
|
|
POST
|
I've got a series of points recorded as an offset off from a baseline that I need to plot. using the COGO feature I have plotted in the polyline features but I'm trying to plot in the points in a similar fashion but I cannot seem to find a way to do it. Do you have your points set on the line? Do you know the distances of the points along the line from a given starting point. If so, use Linear Referencing. Use Create Routes Features on your lines. The value for the position along the line will be the measure value of the points on the line and the side offset distance will make the points parallel and tangent to the line. Just change the offset between positive or negative values to alter the side of the line the point will appear on. If the points are already created on the line use Locate Features Along Route to get their measure so that you can convert them to events and apply the side offset field to position them as offset points.
... View more
06-04-2013
07:21 AM
|
0
|
0
|
3166
|
|
POST
|
Here is the latest version....It is getting the job done but is still slow. I am intrigued by rzufelt's suggestion of using the searchcursor, but if I understand correctly the searchcursor is read only so I am not sure how I can then work with the LAST_PNT field? I removed any print functions and it is still not much faster. I will try a combining the 2 sort fields into one to see if that speeds it up. lastValue = arcpy.SearchCursor(infc, "", "", "", OID + " D").next().getValue(myField) #Get 1st row in cursor - gets last value based on OID firstValue = arcpy.SearchCursor(infc, "", "", "", OID + " A").next().getValue(myField) #Get last row in cursor - gets first value based on OID Working Script import arcpy import os import types from arcpy import env #get Parameters from toolbox #-For Use with Script Toolbox #inPts = arcpy.getparameterastext(0) #Animalfield=arcpy.getparameterastext(1) #SortField=arcpy.getparameterastext(2) #-For Troubleshooting inPts = "C:\ArcGIS\Temp\Tester.shp" AnimalField = "AnimalNum" SortField = "MSTTime" #Add Field print "Beginning:" arcpy.DeleteField_management(inPts,"LAST_PNT") arcpy.AddField_management(inPts,"LAST_PNT","SHORT",) ThesortString = AnimalField + " A; " + SortField + " D" # Apply Sort rows = arcpy.UpdateCursor(inPts,"","","",ThesortString) print "Finished Sorting" i=0 lastRow = "Starter" for row in rows: #print i #i=i+1 if row.getValue(AnimalField) == lastRow: #row.setValue("LAST_PNT",0) lastRow=row.getValue(AnimalField) rows.updateRow(row) else: row.setValue("LAST_PNT",1) lastRow=row.getValue(AnimalField) rows.updateRow(row) del row del rows print "Completed!" If speed is your concern, are your sort fields indexed? Python may not take full advantage of them, but the Summary Statistics with a Join and Select where < MAX_MSTTime then field calculator then invert selection then field calculator would finish this is under 2 minutes for 20,000 records. If you don't want a permanent output do the Summary Statistics to an in memory table. You are reinventing the wheel from my perspective, since the above workflow has been optimized (at least as of 10.1). It will beat the performance of any sorted Python cursor easily, since those cursor are not optimized at all for using indexes in my experience.
... View more
06-03-2013
12:47 PM
|
0
|
0
|
3506
|
|
POST
|
Thanks, your script didn't quite work for me but it got me to the point where I could get it working...The script below works for me...but there is now a performance issue. This seems to take much longer than it should to process. It probably takes about 3-4 minutes to process only 1000 records. I have similar functions in Excel that can do this in a few seconds. Given that my actual dataset has about 20,000+ records, I don't know how useful this script will really be. Does anybody have any ideas on how to speed this up?
import arcpy
import os
import types
from arcpy import env
#get Parameters from toolbox
#-For Use with Script Toolbox
#inPts = arcpy.getparameterastext(0)
#Animalfield=arcpy.getparameterastext(1)
#SortField=arcpy.getparameterastext(2)
#-For Troubleshooting
inPts = "C:\ArcGIS\Temp\Tester.shp"
AnimalField = "AnimalNum"
SortField = "MSTTime"
#Add Field
print "Beginning:"
arcpy.AddField_management(inPts,"LAST_PNT","TEXT",)
ThesortString = AnimalField + " A; " + SortField + " D"
# Apply Sort
rows = arcpy.UpdateCursor(inPts,"","","",ThesortString)
print "Finished Sorting"
thecount = arcpy.GetCount_management(inPts).getOutput(0)
i=0
lastRow = "Starter"
for row in rows:
print i
i=i+1
#print str(count)
#thecount = thecount - 1
if row.getValue(AnimalField) == lastRow:
row.setValue("LAST_PNT","FALSE")
lastRow=row.getValue(AnimalField)
rows.updateRow(row)
else:
row.setValue("LAST_PNT","TRUE")
lastRow=row.getValue(AnimalField)
rows.updateRow(row)
del row
del rows
If it is that slow just run Summary Statistics and get the unique result by AnimalNum for the max MSTTime. Should take about a minute to run. You cannot beat it for efficiency.
... View more
06-03-2013
12:22 PM
|
0
|
0
|
2289
|
|
POST
|
OID values are not under a user's control and cannot be retained within an OID field of any exported feature class or table (it will always renumber). Geoprocessing operations that output OID values for backward links (such as Intersect, Spatial Join, and many others) create a Long field with a name like TARGET_FID, JOIN_FID or FID_OPCODE (FID plus source name). Once these fields are converted to a Long field they are no longer ensured to be unique in the output table. These tools usually combine two inputs. Copy Features does not retain OIDs in a field like this as you have seen. So you could create a polygon of your area and do a Spatial join with your features making the lines the TARGET_FID (primary source). They would retain their original shape even if they were not contained completely by the area boundary. Spatial Join should also work with all feature class type combinations (polygon on polygon, line or point, line on polygon, line or point, and point on polygon, line or point). In effect Spatial Join is the process of Select by Location and output to a new feature class in one operation with backward OID support to your original source data.
... View more
05-30-2013
04:04 PM
|
0
|
0
|
1374
|
|
POST
|
Thanks so much for those ideas. I've used inline variables once before and then was when I was doing an iterator tutorial. I'm not sure how I would read the value in the output to a variable. I re-labelled the output of summary stats to %Value% and then did a select by attributes with your SQL expression [Near_Dist >= %Value% - .0000001] but I got invalid SQL errors. Is there a step I am missing? Thanks again!! The variable cannot use the direct output of the summary, which is a table, not a numeric value. You can use a Feature Selection Iterator on the Summary output which would output a variable named %value% automatically and then the expression should work without the brackets. Make the Select by Attribute operation have the Iterator output as a precondition. A python cursor could also read the record of the Summary output as an alternative if this was a python script. Did you try doing a join of the summary output to the original table and using the ObjectID syntax?
... View more
05-28-2013
06:48 AM
|
0
|
0
|
3865
|
|
POST
|
Hi there, I am new to model builder and am stuck on what is a seemingly simple task.. I'd like the model to select the feature with the maximum value so that I can export and use it as my starting point for least cost path iterations. In my case, I just need the feature with the highest numerical value for Near_Dist to be selected. I have looked into the sort tool (sort by descending then select first row), using code blocks and search cursors for calculate field or the select tool, building expressions in select by attributes using somethine like: "Near_Dist=(SELECT MAX(Near_Dist) FROM TableName)" But I have been unsuccessful so I am resorting to this forum. Please let me know if you have encountered this before / have any ideas on what I could do. Thanks so much in advance! Use Summary and create an output table with the Max value, Join it to the original feature class/table (create a layer or tableview first), and select where OBJECTID of the join table is not Null using Select By Attribute, then remove the Join. This is the way I always do Statistical selections, although usually I am doing it using a group field unique value as the join field rather than the summary output itself as the join field. And even more frequently I am doing this technique to use the join to transfer a statistical output back to the original table using the Field Calculator. If the join fails (because joins on double values is not always reliable and in which case you should not use =, but instead use >= to deal with imprecision) you could at least read the value in the output to a variable and then do a simple SQL expression directly on the original feature class: Near_Dist >= %value% - .0000001
... View more
05-27-2013
02:21 PM
|
0
|
0
|
3865
|
|
POST
|
You can use this Field Calculator expression to replace Null values in any field without preselecting records. Of course it is limited to working on one field at a time. This approach is not recommended for SDE version editing, but it is fine for file geodatabases and shapefiles. Parser: VBScript Prelogic codeblock: If IsNull( ) Then ' Substitute with your real field name here
Output = 0 ' Specify the replacement value for Null here. Make sure it is valid for the field you are calculating.
Else
Output = ' Substitute with your real field name here
End If Expression: Output
... View more
05-23-2013
07:55 AM
|
0
|
0
|
1887
|
| 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 |
3 weeks ago
|