|
POST
|
What you want is not possible to do. The order you see in an unsorted table view is essentially random and undetectable by any means as far as I know and I have never understood why this order occurs in a table view. Anything other than ObjectID order or a sort field order is influenced by the order of edits and changes every time you edit the table (attributes or geometry). The mere act of calculating or altering the field value in the visible order you see would change the order of what you see in the table view after the calculation/script completed and the numbers would appear random again. You have to have some field that you want this sorted by to get a specific order of incremented values. You cannot use the field calculator to sort by anything other than the ObjectID, so you have to use a Python cursor, not the field calculator to get an alternative order. See this post for how to increment based on the sort order of a given field value (if it is not unique for every record you must use the ObjectID or another field to break the tie and make it unique).
... View more
04-10-2015
01:25 PM
|
0
|
5
|
7444
|
|
POST
|
Yes, it is slicing. I remembered that term last night, but it did not come to mind when I was writing the response.
... View more
04-09-2015
10:05 AM
|
0
|
0
|
5045
|
|
POST
|
I am basing my statements on ArcObjects cursors, not Python cursors, since I don't know how to make a da cursor sort. da cursors seem more optimized than ArcObjects cursors, so that may be the reason you see such fast performance. Several years ago I gave up on sorted cursors and never was willing to try them again, especially since there is virtually no documentation on how to set it up (figuring out ArcObjects was a pain and disappointment). ORDER BY is not documented with da cursors. Document how to use it in this post. I am at a disadvantage, since I have explained my code so you can test my approach, but you have not shown or explained your da cursor syntax as far as I have seen so I cannot test your approach (if I missed it, please repeat it). My technique is actually more of a way to avoid doing joins and field calculations than it is to avoid sorting within a single feature class, but it fits this need as well. In the case of joins and data transfers between feature classes/tables my approach is much faster than all other methods I have tried.
... View more
04-09-2015
09:52 AM
|
0
|
3
|
2194
|
|
POST
|
I agree that the user can use the Project tool to convert from a Geographic Coordinate System to a Projected Coordinate System before using my tool. However, I am not familiar with the best projection choice for Germany, so I was not prepared to do that with this particular data. Anyway, using a Projected Coordinate System would be a requirement of the line network buffer tool I am building at this stage and that requirement will be specified in the help and error messages for the tool by the time I release it. Thanks for the feedback on the buffers. I spent about 6 hours tweaking the results. Essentially anywhere the cut between two communities bends, I drew that. Bending cuts are not precisely measured to split between communities exactly 50/50 and is only eye ball accurate in those cases. But since these cuts are within waters (rivers and coastal areas) obviously controlled by Germany and not another country, I was not too concerned about getting better precision. For straight line cuts, the methods involved used a mixture of tools, some of which would require an Advanced license. I had to use the Polygon to Line tool to extract the full community buffer outline and each communities outline as a line. I had to delete all community boundaries that touched another community (easy to do if topology is perfect). The Feature Vertices to Points tool was used to extract points from the ends of each community line for LR processing. I also used the Features to Polygon tool to combine a set of lines at a normal angle to the buffer outline with the buffer to cut it into separate polygons. The Feature Vertices to Points tool was used to extract points from the mid point of each community line and the Spatial Join tool (Basic license) was used to transfer attributes from the mid points to the cut up polygon output of the Features to Polygon tool. The cut lines that were at a normal angle to the buffer outline were created with LR tools and techniques, which work with a Basic license. With these tools I had to categorize the country outlines into groups that would build continuous non-branching, non-looping portions of the country outline into routes and then used the Create Route tool to build simple routes. I used the Locate Features Along Route tool to create an event table of the community outside end points on the routes. I used the Make Route Event layer to create offset points at 2 km from the Germany outline. I used the Points to Line tool to create a line segment between the point on the line and the LR offset point. The straight cut lines were all examined and where the normal angle to the line was not the best fit to the buffer I moved the offset end to a location that I liked manually. I would estimate I did this for about 15-20% of the cut lines. Moving the ends took longer than using the tools to get the 80% of correct cut lines, but was necessary. Anyway, I hope your client is happy with the result.
... View more
04-09-2015
05:16 AM
|
0
|
1
|
10659
|
|
POST
|
Blake: 1. Yes, using "OID@" will work for any field name that is identified as an OID type field. So the names FID, OID, OBJECTID, etc. will all work as long as the field is typed as an OID field. 2. (row[0:]) breaks down as follows: A. (...) creates a tuple (the outside parenthesis define this as a tuple). B. row[0:] reads the row pulled by the for loop within the list comprehension and iterates the listed fields in the field list parameter of the cursor. row[0:] is the same as saying read all field values starting with the first field (0 based) and continuing to the last field for the current row. The remainder of the list comprehension syntax understands to insert a comma between each field value since it is being comprehended within the tuple container. So the full line is building a dictionary like: dict = {(1,1):0,(2, 12):0,(3, 13):0,(4, 15):0,(4, 16):0,...}; The duplicate value of 4 in Nummer field is uniquely counted because it is being paired with the ObjectID value in each dictionary key.
... View more
04-08-2015
05:34 PM
|
2
|
2
|
5045
|
|
POST
|
Please be clear. Original update cursors and data access (da) module update cursors are two different things and may operate differently when it comes to the ORDER BY option. da update cursors are fast and the only cursor type worth using. So are you using the ORDER BY with a da module update cursor and if so what is the syntax? The documentation does not cover this aspect of using the da cursor at all and it would be nice to know how to use it if it is an option. Having said that, dictionaries can out perform the ORDER BY operation by a factor of at least 10 times the speed, since no disk access is involved, whereas Updating using the Order By operator has to retrieve and write to each record in order, which is very slow in my experience and severely impacted by the overall size of the table, whereas unsorted reading to a dictionary and sorting the dictionary is extremely fast.
... View more
04-08-2015
05:19 PM
|
0
|
5
|
2194
|
|
POST
|
Silvan: Glad I could help. Dictionaries and lists provide powerful methods for working with data as you can see. You should definitely invest some time in learning how to use them. They can come in very handy for problems like this. Have a great day. Richard
... View more
04-08-2015
10:05 AM
|
0
|
0
|
5045
|
|
POST
|
Silvan: This is where an adaptation of my Turbo Charging Data Manipulation With Python Cursors and Dictionaries can help overcome the limitation of the DA cursor to control record order (which is a slow database operation even if it worked) and instead take advantage of the speed of a dictionary. The dictionary keys can be sorted and will also let you quickly access them randomly as you write the data back to the cursor. To do this run a search cursor first through the entire record set and create a dictionary of sortable keys with initial values of 0. Process the sorted dictionary keys and increase their values using a counter. Finally run the update cursor and write to it using the dictionary. I would use both your Nummer field and the ObjectID field values to be sure all keys are unique, since otherwise a repeated value in Nummer would mess up the counter. (You are not limited to using the Nummer/ObjectID combination and this is how you can also set up relationships based on multi-field unique key values to overcome the limitations of single field joins). The speed of this code will be virtually as fast as just running the update cursor. So here is the code (replace 'COUNTER' with your actual counter name field): import arcpy
lyr = YourLayer # replace this with your layer name
fields = ['Nummer', 'OID@']
# set up a dictionary and counter
dict = {}
counter = 0
# Use list comprehension to build a dictionary of Nummer/ObjectID tuple keys
dict = {(row[0:]):0 for row in arcpy.da.SearchCursor(lyr, fields)}
# Sort the dictionary keys and increase the counter values based on the key order
for value in sorted(dict.keys()):
counter += 1
dict[value] = counter
# Write back to the layer with an update cursor using the dictionary. Change 'COUNTER' to your counter field
fields = ['Nummer', 'OID@', 'COUNTER']
with arcpy.da.UpdateCursor(lyr, fields) as cursor:
for row in cursor:
row[2] = dict[(row[0],row[1])]
cursor.updateRow(row)
... View more
04-08-2015
07:46 AM
|
4
|
6
|
5045
|
|
POST
|
I created the exterior buffers for the communities. My tool would not work with the projection, but I found methods to create it. It was partly automated using Linear Referencing techniques, but there was a fair amount of manual tweaking, especially in the inlet pockets. Anyway, here you go. Now that I have done the geoprocessing steps and editing manually I have some ideas of how to automate this process, but I need to get my line network tool done first before starting a new tool.
... View more
04-01-2015
07:41 PM
|
0
|
3
|
4327
|
|
POST
|
Here's a link on how to send a message in here. Messages Thanks to Lisa Turner who posted this on another related thread.
... View more
04-01-2015
06:57 AM
|
0
|
6
|
4670
|
|
POST
|
Glad you figured out the issue for the coordinates. I did base my process on a Centerline layer I had. The centerlines determine the angles to use for the intersection cuts. I have not yet placed my tool in a location where it can be accessed by others. The interest in it seems to be growing, so I will try to find some time to develop an interface this week so it can be released for testing. The tool used my centerline layer to create the left and right buffer polygons I showed in the picture in post 4 of this thread. The intention is to create idealized and over-bounded buffers that contained the centerline data and intersect those buffers with the actual road casements based on parcels or aerials. Alternatively,, with an advanced license the intersections X and Y cuts can be extracted using the Polygon to Line tool and retain only the lines that do not have -1 for the left side (the sides of roads would all have -1 for the left FID). Below is an image of my parcel road casements on top of a 50 foot buffer surrounding my centerlines. Where you see solid red fill and black outlines the buffer over-bounds the casement. Intersecting the road casement polygons with the buffers would cut them at the X and Y cuts that are ghosted inside the intersections. Only cul-de-sac bulbs create a special case that my tool does not deal with. The test shown below took 2 minutes and 18 seconds to create the left and right buffers for over 5,000 centerlines (over 10,000 buffers). One of the potential enhancements I may consider in the future is to vary the buffer width based on a field value for each centerline so that I could do different buffers according to the road classifications.
... View more
03-31-2015
12:16 PM
|
0
|
9
|
4670
|
|
POST
|
I have looked at the data and found out that the line offset method I built my tool around does not work with geographic spatial reference data (features that use angular coordinates like decimal degrees) and only works correctly with projected spatial reference data (features that use linear coordinates like meters or kilometers). So there would be substantial distortion relative to the buffer the buffer tool made if I applied my tool. The Copy Parallel option on the Editor drop down menu uses the same method that my tool uses. You can see for yourself the results I would be getting by using that tool. You have to input approximately 0.01 as the distance offset to use a decimal degree length that is approximately 1 km in length with that tool. So while I might get the tool to produce a result, it would not really be correct for this spatial reference. I will need a few days to check out whether other options exist to deal with large area data like this and how much the tool would have to be adjusted to work correctly with this data. I will have to see if I can identify an alternative offset creation method that will work with the rest of the techniques I am using. I also will have to convert the way I determine bearings to use geographic coordinates, which have to be handled differently from linear coordinates. In any case, I have extracted the boundary lines that touch the international border and produced the remainder of the buffer left over after the German communities have been erased. A manual process could create the output you want using these two feature classes in addition to those you already created.
... View more
03-31-2015
10:08 AM
|
0
|
0
|
4327
|
|
POST
|
Is it projecting close to what is right or is it way off? Usually if it way off the X and Y coordinates got reversed somehow. Also, could you screen shot the table output records from the Summarize step. The numeric values in the Concatenate field and the values of Min X and Min Y coordinate fields should be basically match up. You could also try the Max X and Max Y in addition to the Min and compare the values. I am not sure how many digits are significant with this projection, so perhaps if there is variation between the Min and Max that would account for the variance in the location and you would need to round the concatenation to keep more significant digits to not blend distinct points together. I also click on a known coordinate in the points layer to look at its snapped on-screen coordinates in the lower right corner of ArcMap and its calculated coordinates. If they are different by a significant amount (determined by moving the mouse to see how much the numbers change when the mouse moves) then you would need to find out what happened. They should be virtually the same.
... View more
03-31-2015
09:20 AM
|
0
|
0
|
10266
|
|
POST
|
No, I did not automate the instructions in this post. It was one of my earliest attempts to deal with this issue and I was working it out as I wrote it. As far as the summary, did you use the concatenated coordinate value you calculated [round( !X_COORD! , 😎 + ";" + round( !Y_COORD! , 8)] as the case field? Your output should include every concatenated coordinate value in your table and the minimum X_COORD and Y_COORD associated with each concatenated value. Then you are sure you used the same spatial reference when you set up the XY Event table?
... View more
03-31-2015
07:39 AM
|
0
|
2
|
10266
|
|
POST
|
The Frequency field get created by the geoprocessing tools at some stage in the process (probably during a Dissolve for the buffer). The X_COORD and Y_COORD fields are double fields that you can calculate for the points using the geometry calculator or the field Python calculations !Shape.Centroid.X! and !Shape.Centroid.Y!. The X_Y_LINK concatenation can be as simple as doing the python calculation: Round(X_COORD, 😎 + ";" + Round(Y_COORD, 8). You should round to some level of precision acceptable to you, since you don't want extremely minor variations in the coordinate values to be interpreted as different points. I do a more sophisticated calculation to make sure all X and Y coordinates are always 12 characters long with a fixed decimal position that maintains 4 digits after the decimal, but for this exercise that is not necessary. If your polygons are buffers of the Centerlines, rather than centerlines created to match preexisting polygons, then I am actually in the process of creating an Add-In tool that creates buffers like this much more easily and faster. It also populates the buffer polygons with the ObjectID of the source lines and optionally their attributes and splits the buffers on the left and right sides of the centerline (which is easy to merge into a single polygon per centerline using the centerline ObjectID field). It also creates sharp corners at knuckles, not rounded corners. See the attached picture. Unfortunately, it is not yet ready for general release, since the user interface has not been created. Let me know if you are interested in that tool.
... View more
03-30-2015
01:48 PM
|
0
|
5
|
10266
|
| 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 |
4 weeks ago
|