I had a user with a series of GPS points (that were in chronological order) that they wanted to know the accumulated distance from the start to each point in their shapefile. First, we calculated the distance from each point to the previous point into a field called [DistFt].
Then, we hacked out this quick python function to accumulate the total distance in Arcmap’s Field Calculator:
totalDistance = 0
totalDistance += inDist
And we called it:
And we got what we wanted.
Recently we took a call from a user who could not see the legend for one of the feature classes in one of our services. (Precambrian Bedrock in http://mgsweb2.mngs.umn.edu/arcgis/services/state/mnbdrkgeology )
After trying some standard things–restarting the service, checking the source .MXD–I turned to The Google Machine and quickly found help from ESRI: http://support.esri.com/zh-cn/knowledgebase/techarticles/detail/33741 .
Turns out the default number of legend items ArcMap will display from an ArcGIS Server map service layer is 100 and we had 102 in the problematic layer. (I plead innocence, blame the geologist for needing that many categories).
The solution was to edit the Windows registry and change the setting for “Maximum Legend Count” from 100 to something higher than 102. After doing that (see path note below) and restarting ArcMap, the legend showed for us.
The path turned out to be a little different on Windows 7 than the paths indicated in the help article.
ESRI indicated that the path varied by ArcGIS version:
- ArcGIS 9.3.x: HKEY_CURRENT_USER > Software > ESRI > MapServerLayer
- ArcGIS 10.0: HKEY_CURRENT_USER > Software > ESRI > Desktop10.0 > ArcMap > Server > MapServerLayer
- ArcGIS 10.1: HKEY_CURRENT_USER > Software > ESRI > Desktop10.1 > ArcMap > Server > MapServerLayer
I actually changed this in a number of locations–presumably once for each user profile on my machine. Each followed a pattern something like:
Out of cursiousity, I wondered if the 100 item limit was a per service or per layer limitation so I set my limit at 103. Because the service has several other layers, the total number of layers in the legend was about 130. Everything drew OK so it appears the limit applies per layer.
I was helping a co-worker who needed to check if a field exists in their arcpy script. Since we were located at their computer, I thought I would just do a quick Google search and pull the code off this blog. Seemed logical since I the original purpose was exactly that—to serve as a handy, public place to store code snippets that I use & that others might find handy.
Anyhow, my Google Search on “Node Dangles field Exists” came up with a 9.3 script to check if field index exists. And I also have a 10.0 version but did not come up with the field exists snippet. So here it is:
def fieldExists(inFeatureClass, inFieldName):
fieldList = arcpy.ListFields(inFeatureClass)
for iField in fieldList:
if iField.name.lower() == inFieldName.lower():
In the last week, I have looked for multi-part features a couple of times. Today, I was looking for multi-part polygons after dealing with the fall-out of a case of Clip Gone Wild as shown below.
I have not found a way to write a query to find these but Field Calculator does allow you to calculate a field’s value to the number of parts.
Using the Python parser, just write the formula (note that case matters): !shape!.partCount
One of my main tasks right now is to document many of the details of maintaining ArcSDE geodatabases so I anticipate having several blog posts on this topic that are re-writes of documents I am working on. I am presuming that the person will have no ArcSDE experience so I am documenting very detailed information.
Almost all of the ArcSDE commands require that you specify which instance (service/port) the command applies to by using the “-i” parameter.
ArcSDE Instance Parameter
Since we have multiple ArcSDE geodatabases, I like to have a handy-dandy sticky note with all the geodatabases and their respective ports on the side of my monitor.
But when that is not handy and I can never remember the ArcSDE command line syntax to get a list of instances and their ports–I mean remembering “sdeservice -o list” is difficult at my age.
The quickest and most reliable way I’ve found to get the instance number is just to check the properties of your SDE connection file in ArcCatalog, right-click on it and select “Connection Properties”.
And the port is right there in the service entry (5164).
Ok, it has been to long since I last posted and I thank those few people who asked If I had suffered a Segmentation Violation or something.
By means of a brief explanation, I changed jobs last summer, going back to a previous employer in a very different role than what I’ve ever had before. It was a challenging and difficult and one that I had minimal success at but, in the end, didn’t work out. Mostly because I wasn’t a good fit for a variety of reasons including, not surprisingly, geography! I was mostly tele-commuting because the office was two hours away. I really needed to be in the office more than I was and I wasn’t in a position to relocate.
During my time with that employer I was doing less technical stuff and just did not feel the urgency to be blogging.
I’ve left that job (which was very hard to do because I felt like I was abandoning friends) and have a short-term gig with the employer I left in the summer which will be almost entirely technical work, so I hope to crank out some more technical blog posts.
Also, I’m hoping to shift my career focus somewhat. I’ve been somewhat stuck as a desktop guy–developing mostly desktop applications. I’ve wanted to do more web development stuff but never made the switch. I’m hoping to build my web skills in the short-term and have been cramming on topics like Java, HTML5, CSS, Map Server, Geo Server, php, jQuery, and anything else that might enhance my web-abilities.
So expect some changes to the blog and I thank everyone who comes to the blog, while the numbers aren’t huge, I am still surprised at how many people find their way here.
Awhile ago, I had a ArcSDE problem that required ESRI technical support to help trouble-shoot. The problem was odd but was resolved by rebooting the server.
During the process, though, the support person had me set a couple of environment variables for logging SDE activity on the client machine.
The settings were SDEINTERCEPT and SDEINTERCEPTLOC.
From ESRI’s Help, SDEINTERCEPT specifies what activity to log and SDEINTERCEPTLOC specifies where to save the log files.
I recently deleted the directory I made for the log files but did not remove the variables and I noticed that one of my python scripts reported a weird error (but continued to run, I think). I tracked it back to these variables and realized what I had done.
Googling SDEINTERCEPTLOC did lead me to some helpful information like:
The SDEINTERCEPT blog where Ken posts ArcSDE help.
This ESRI post about troubleshotting geoprocessing problems.
And this ESRI technical article about diagnosing ArcSDE Connections.