This file contains hidden or 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 | |
| import pythonaddins | |
| class addDefinitionQueryLayers(object): | |
| """Implementation for arcpyMappingAddin_addin.button (Button)""" | |
| def __init__(self): | |
| self.enabled = True | |
| self.checked = False |
This file contains hidden or 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 modules | |
| import arcpy | |
| # set variables to make life easier | |
| fc = "Wilderness" | |
| def get_centroid(feature_class): | |
| # use describe to create an extent obejct to work with | |
| extent = arcpy.Describe(feature_class).extent |
This file contains hidden or 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
| Date.prototype.yyyymmdd = function() { | |
| var yyyy = this.getFullYear().toString(); | |
| var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based | |
| var dd = this.getDate().toString(); | |
| return yyyy + (mm[1]?mm:"0"+mm[0]) + (dd[1]?dd:"0"+dd[0]); // padding | |
| }; | |
| d = new Date(); | |
| d.yyyymmdd(); |
This file contains hidden or 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 modules | |
| import arcpy | |
| # feature class or table to modify | |
| table = r'path/to/featureClass/or/table' | |
| # create update cursor to interate data | |
| with arcpy.da.UpdateCursor(table, '*') as cursor: | |
| # iterate the rows |
This file contains hidden or 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
| require( | |
| "esri/layers/ArcGISTiledMapServiceLayer", | |
| ) | |
| function ( | |
| Tiled, | |
| ) { | |
| var hydroOverlay = new Tiled("http://hydrology.esri.com/arcgis/rest/services/WorldHydroReferenceOverlay/MapServer"); | |
| map.addLayer(hydroOverlay); |
This file contains hidden or 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
| var iconFs = L.icon({ | |
| iconUrl: 'http://services.arcgis.com/SgB3dZDkkUxpEHxu/ArcGIS/rest/services/huc17_accesses/FeatureServer/0/images/d66f4bf18356e409c6221a46633b935a', | |
| iconSize: [14, 15], | |
| iconAnchor: [0, 0] | |
| }); | |
| var layer = L.esri.featureLayer('http://services.arcgis.com/SgB3dZDkkUxpEHxu/arcgis/rest/services/huc17_accesses/FeatureServer/0', { | |
| pointToLayer: function (feature, latlng) { | |
| return L.marker(latlng, { icon: conFs} ); | |
| } |
This file contains hidden or 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
| 'use strict'; | |
| module.exports = function(grunt) { | |
| grunt.loadNpmTasks('grunt-nodemon'); | |
| grunt.initConfig({ | |
| nodemon: { | |
| dev: { | |
| script: 'app/index.js', |
This file contains hidden or 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
| module.exports = function (grunt) { | |
| require('load-grunt-tasks')(grunt); | |
| grunt.initConfig({ | |
| express: { | |
| options: { | |
| // Override defaults here | |
| }, | |
| web: { |
This file contains hidden or 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
| // purpose: Streamline the process of working through the Getting Started with Grunt book and constantly creating a | |
| // new directory with a new Gruntfile in the directory for each exercise. | |
| // | |
| // use: First create a directory for working through the exercises. Next, get your dependencies all taken care of in | |
| // this directory by using '$ npm init' to create a package.json file. Now, get grunt in this directory using | |
| // '$ npm install --save-dev grunt'. Although you will need more dependencies through the course of the book, | |
| // this is enough to get started. Now, getting started on a new exercise is as simple as using | |
| // '$ grunt newEx:<chapter number>:<exercise number>'. For instance, if starting on chapter three, exercise | |
| // four, just enter '$ grunt newEx:03:04'. This grunt will create ./04/0403/Gruntfile.js. Now start editing | |
| // the Gruntfile to do the exercise. |
This file contains hidden or 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 modules | |
| import os | |
| import arcpy | |
| # variables | |
| gdb = r'C:\Student\PYTH_20141006\PYTH_dataStudent\IAGL_Lincoln\Lincoln.gdb' | |
| # walk recursively from top level in geodatabase | |
| for dir, dirs, files in arcpy.da.Walk(gdb): |