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).
I questioned ESRI recently about an issue I was noticing in firefox 3 with an application I have been working on. The issue was the identify tool, when used in this application, would open a small window with the results of your identify operation. This window contained an image with an x on it to close the information window but when clicked in firefox 3 the action of clicking the close button would initiate another identify operation. This would then create an infinite amount of identify operations if the user would keep trying to close the box.
After asking the ESRI rep if there were any other issues similiar to this he said that there was and the solution was that firefox 3 wasn't supported (NIM037203). Seemed like the easy way out type of response but since I use firefox 3 and have not noticed any other issues I wanted to make this work.
I played around a bit and noticed that the javascript to close the window was being fired with the onmousedown event which is when you click your mouse down. The onmouseup action, or when you release the mouse button, would then call the identify again.
Ok, so simply change the close button event to be onmouseup="closeIdentifyPanel(this)" and the problem is solved.
It's line 313 in the Javascript/MapIdentify.js file.
Log files are very helpful for, well, logging I suppose. If you integrate the code below with a cursor of some variety you can document how features change or when they are created, or if certain values exist.
I use log files to document when traffic accident severity is altered, among other things. The police are constantly getting new data on traffic accidents, for example if someone is hurt really bad, then a week later the die, I have code that goes back through the records and tests each attribute of the accident, and if certain things change the log file is appended accordingly. Pushing the data to a table may make more sense in some cases so that a join could tie the info back to the map, but sometimes you just need to make some notes. My scripts often utilize logging to record the success or failure of complex geoprocessing routines.
Wrapping the logging code into a function often is a good way to handle things because you can pitch variables into the function so that maybe you always get a timestamp, but the other information reflects different items of interest.
This page will be used as a repository for VBA code that was written to help make the process of developing an ArcMap MXD for ArcGIS Server map caching easier.
The functionality includes:
renameLayersInGroupLayerViaSearchAndReplace() allows you to select a group layer (only works on group layers) in the Table of Contents and then do a search and replace on two levels of 'child' layers. When making multi-scale map projects, it's often useful to make a set of layers applying to one scale range, give them an ID, then copy them and rename and resymbolize for another scale range.
rePointSDELayersToAppConnORDirectConnORFileGDB() allows you to repoint feature classes from SDE connections to local fileGDBs. When creating an ArcGIS Server map cache, it is much more efficient to copy your SDE feature classes to File Geodatabase format on the caching maching. If you keep the feature class names the same, this script will repoint all the layers to the local fileGDB location. The script can also be used to change SDE Application connects (app connects) to SDE direct connections and vice versa. NOTE: you will need to set some parameters in this sub procedure and also the called function...look for the *****'s
This code can be used to check and update your ArcSDE feature classes and feature datasets in 'Registered As Versioned' mode.
It will check the registered as versioned status for all selected feature datasets and standalone feature classes and produce a report in a time-stamped text file.
Where possible -- if your connection user is the owner of the data AND there are no existing read locks -- the script will register FC's and FDS's as versioned that are not so already.
To use:
Paste the code below into ArcCatalog's VBA Editor(F11 --> View --> Project Explorer -->ArcCatalog Objects-->ThisDocument)
Select SDE feature classes or feature datasets from the Contents tab in ArcCatlog (not to be confused with the tree view