This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create after render view event hook to detect when view is finished loading | |
// http://mavilein.github.io/javascript/2013/08/01/Ember-JS-After-Render-Event/ | |
// https://github.com/emberjs/ember.js/commit/512327c0128f53d4a0d6828ab38f27c6ccf686ec | |
Ember.View.reopen({ | |
didInsertElement: function () { | |
this._super(); | |
Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent); | |
}, | |
afterRenderEvent: function () {} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Depends on first importing arcpy.da at top of script | |
def unique_values(input_table, field): | |
# search cursor wrapped in list generator creating list of all values | |
values = (row[0] for row in arcpy.da.SearchCursor(input_table, (field))) | |
# pass list into set to get only unique values and return the result | |
return sorted(set(values)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fix_invalid_characters(self, string): | |
""" | |
Drops invalid characters from names according to rules for naming feature classes, notably must | |
start with a letter and remaining characters must be numbers, letters or underscores. | |
""" | |
# drop invalid characters at beginning of string | |
string = re.sub(r'^[^a-zA-Z]+', '', string) | |
# find any invalid characters in remainder of string and replace with underscores | |
return re.sub(r'[^a-z0-9A-Z_]', '_', string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import arcpy...if already imported in your script, this is not necessary | |
import arcpy | |
def _uniqueValues(input_fc, field): | |
# search cursor wrapped in list comprehension creating list of all values | |
values = [row[0] for row in arcpy.da.SearchCursor(input_fc, (field))] | |
# pass list into set to get only unique values and return the result reverse sorted | |
return sorted(set(values), reverse=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get parameter | |
feature_class = arcpy.getParameterAsText(0) | |
# use list comprehension to list all field objects and access the name of the field | |
attribute_names = [field.name for field in arcpy.ListFields(feature_class)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def onClick(self): | |
# name of toolbox without tbx extension | |
toolboxName = "Mapping" | |
# name of tool to be executed | |
toolName = "AddDefinitionQueryLayers" | |
# create string with path to toolbox | |
toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".tbx") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"directory": "resources", | |
"json": "bower.json" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create site object instance for watauga | |
var watauga = new Site('03479000'); | |
// download the data from the USGS | |
watauga.downloadData(); | |
// get the cfs output as JSON (this currently is not working) | |
watauga.getCfs(); |
OlderNewer