Utah.govOnline ServicesAgency ListBusiness.Utah.gov

Home arrow GIS Resources arrow Scripts and Code
GIS-Related Scripts and Programming Code

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).

Category Links:

GIS Scripts and Code (Weblog format, All Posts):




Changing the HeaderText of an AJAX Toolkit TabPanel with Javascript PDF Print E-mail

Written by Steve Gourley,

 One would think that changing some text of a tab would be pretty trivial, especially since the ajax TabContainer control contains this function...

set_headerText : function(value) {
        if (!this.get_isInitialized()) {
            throw Error.invalidOperation(String.format(AjaxControlToolkit.Resources.Tabs_PropertySetBeforeInitialization, 'headerText'));
        }
        if (this._headerText != value) {
            this._headerTab.innerHTML = value;
            this.raisePropertyChanged("headerText");
        }
    }

This function didn't work as simply as I had imagined

Comment on this Article
11, Aug. 2008
Last Updated ( 13, Aug. 2008 )
Read more...
 
VB Script Label Expression for Multiple Line Labels in ArcMap PDF Print E-mail

Written by Bert Granberg,

This label expression can be used to display long text strings from an attribute field as a multi-line label. Basically it attempts to add hard returns (line breaks) after every other word.

For example, the script will display the value "Western Washington County Special Service District 1, Pine Valley" as:

Western
Washington
County Special
Service District 1,
Pine Valley

There are three parameters to keep in mind.

  • The input field name, currently set to [Name] in the code below. Change this in two places to the field from which you would like to get the label string.
  • MaxWordLength, currently set to 10, change this to force long words onto their own line like 'Washington' in the example above
  • MixWordLength, currently set to 3, change this to keep short words from being put on the next line like '1,'  in the example above

When using a label expression, you'll need to click the expression button on the label properties window and then click the advanced button. Delete the suggested code and replace it with the code below.
Comment on this Article
31, Jul. 2008
Last Updated ( 31, Jul. 2008 )
Read more...
 
Python! Refactoring Redundant Code PDF Print E-mail

Written by Kevin Bell,

If you ever need to do repetitive work then you can either code each operation one after the next which can make your script really long winded, or you can make your code more efficient by utilizing functions. The code below has a dictionary containing a whereclause for each desired output layer. I could code something like this:

  • make feature layer1
  • kernel density from lyr1
  • make feature layer2
  • kernel density from lyr2
  • make feature layer3
  • kernel density from lyr3
  • etc
  • etc
  • etc...

A "cleaner" approach is use something like the code below, which passes each key and value from a dictionary that consist of the output hotspot rasters-to-be's name, and the whereclause that subsets the data from a master Feature Class.

 

Comment on this Article
23, Jul. 2008
Last Updated ( 01, Aug. 2008 )
Read more...
 
ArcGIS Server 9.3, FloatingPanels, and Javascript Frameworks PDF Print E-mail

Written by Steve Gourley,


When playing with AGS 9.3, firebug for Firefox , and fiddler for IE I realized that the esri:FloatingPanel control carries along a lot of baggage with it.  Not only are the esri:FloatingPanels strictly asynchronous, every time you hide/show a panel with javascript, in our case 26KB of the contents of your FloatingPanel are sent from the client to server to maintain session state.  Depending how much content you have in your FloatingPanel the overhead could make your application unusable for slower internet users.
User Comments (1)
17, Jul. 2008
Last Updated ( 22, Jul. 2008 )
Read more...
 
<< Start < Prev 1 2 3 4 5 6 7 8 9 Next > End >>

Results 1 - 8 of 65

AGRC Contacts | UGIC Contacts

feed image feed image

Utah GIS Portal © 2008 AGRC

Optimized for