Skip to content

Instantly share code, notes, and snippets.

View davewilton's full-sized avatar

David Wilton davewilton

  • Exprodat Consulting
  • Melbourne
View GitHub Profile
@davewilton
davewilton / gist:9317524
Created March 3, 2014 02:32
Wrap a library in AMD
var lib = function() {
// all the code for your lib goes here
lib.myFunction = function(){};
}();
// Support AMD module format
var define;
if (typeof define == 'function' && define.amd) {
define(function () {
return lib;
@davewilton
davewilton / OverwriteOutput
Last active December 29, 2015 08:29
Geoprocessor Overwrite output
Public Overrides Sub Execute(ByVal paramvalues As IArray, ByVal trackcancel As ITrackCancel, ByVal envMgr As IGPEnvironmentManager, ByVal message As IGPMessages)
Dim parameterValue As IGPValue
If CType(envMgr, IGeoProcessorSettings).OverwriteOutput Then
parameterValue = GpUtilities.UnpackGPValue(paramvalues.Element(2))
If Not parameterValue Is Nothing Then
If GpUtilities.Exists(parameterValue) Then
GpUtilities.Delete(parameterValue)
End If
End If
@davewilton
davewilton / RegArcPy
Created November 25, 2013 15:49
Register a .net toolbox with arcpy
Dim gp As IGeoProcessor = New ESRI.ArcGIS.Geoprocessing.GeoProcessor
gp.AddToolbox(regTb) 'location of toolbox with above python code embedded
Dim iv As ESRI.ArcGIS.esriSystem.IVariantArray = New ESRI.ArcGIS.esriSystem.VarArrayClass()
iv.Add(_toolBoxLocation) 'location of toolbox created from .net dll
gp.Execute("registerTbx_regarcpy", iv, Nothing)
gp.RemoveToolbox(regTb)
@davewilton
davewilton / IGPCodedValueDomain
Created November 25, 2013 15:50
Coded value domain in Georpocessing.Net
'Units
inputParameter = New GPParameterClass()
inputParameter.DataType = New GPStringTypeClass()
'Set the default value
gpStringValue = New GPStringClass()
gpStringValue.Value = "meters"
inputParameter.Value = CType(gpStringValue, IGPValue)
inputParameter.Direction = esriGPParameterDirection.esriGPParameterDirectionInput
inputParameter.DisplayName = "Units"
inputParameter.Name = "in_units"
@davewilton
davewilton / ImportToolbox
Created November 25, 2013 15:44
ImportToolbox
# Python Script
tlb = arcpy.GetParameterAsText(0)
# Load required toolboxes
arcpy.ImportToolbox(tlb)
@davewilton
davewilton / CreateToolboxFromFactory
Created November 26, 2013 07:45
Create a toolbox from a .net IGPFunctionFactory
Dim pGPUtilities As ESRI.ArcGIS.Geoprocessing.IGPUtilities3
pGPUtilities = New ESRI.ArcGIS.Geoprocessing.GPUtilitiesClass
pGPUtilities.CreateToolboxFromFactory(toolboxAlias, folder, tbname)
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
frameworks: ['jasmine', 'dojo'],
// list of files / patterns to load in the browser
files: [
'spec/main.js',
# 1. Import modules:
import arcpy
from arcpy import env
import os
# 2. Set Parameters:
env.workspace = arcpy.GetParameterAsText(0)
option = arcpy.GetParameterAsText(1)
/// <reference path="../../../tsd.ts.ts" />
/// <amd-dependency path="dojo/text!./templates/myWidget.html" name="template" />
declare var template: any;
//dojo
import dojoDeclare = require("dojo/_base/declare");
//dijit
import WidgetBase = require("dijit/_WidgetBase");
import TemplatedMixin = require("dijit/_TemplatedMixin");
{
"error" :
{
"code" : 400,
"message" : "Unable to complete operation.",
"details" : [
"'where' parameter not specified",
"'objectIds' parameter not specified",
"'time' parameter not specified",