This section provides a venue for sharing GIS-related programming code and custom scripts in a variety of languages. Posts can be viewed by category or as a whole in blog format (below).
Source Analysis for C# does for C# code what Microsoft Word's grammar check does for your documents. Even though your code will work the same and your sentence will project the same idea, Source Analysis standardizes the way you write code or fixes your grammar.
If you write code with multiple other developers and would like to standardize on commenting, variable names, and many other items, Source Analysis helps you do that with 200+ rules for formatting your code.
This helps to make your code more readable, which is a bonus if a few months down the road you need to modify something you or a co-worker wrote.
I installed this right away and updated my current project. I suggest you do the same.
This script will move feature-linked annotation to a location determined by 2 hard coded-offset distance parameters from the upper left corner of the linked feature's extent.
The script as written contains a conditional statement that will UNLINK the annotation from the feature providing a -1 FeatureID value if the 'annotation is contained by its linked feature and a -2 FeatureID value if the 'annotation is not contained by its linked feature.
Test this out on a dummy feature class and see if it behaves as expected. The expected behavior is that you'll end up with incremented Numeric ID's in a string field, even if some of the records already have ID's. This script should find the last used ID, and then start adding new ones. As with all of my code, look before you leap. I wrote this awhile ago for a specific task and haven't really revisited it.
This script was written by Tim Hodson ofESRI to make wholesale rubbersheet-style adjustments to all the layers in an edit session based on a shift in location of control points. It was written to adjust parcels, sections, and other boundary features based on old GCDB control points to line up with new, more accurate and/or precise GCDB control points obtained with survey grade GPS. It requires that the old and new points are stored in separate layers but carry common unique IDs for each point. Thanks Tim!