Skip to content

Instantly share code, notes, and snippets.

View stdavis's full-sized avatar

Scott Davis stdavis

View GitHub Profile
require({
packages: [{
name: 'agrc',
location: 'http://mapserv.utah.gov/cdn/dojo/agrc/2.0/'
}]
}, [
'esri/map',
'esri/layers/ArcGISTiledMapServiceLayer',
'agrc/widgets/locate/FindAddress'
require([
'esri/map',
'esri/layers/ArcGISTiledMapServiceLayer'
],
function (Map, Tiled) {
var serviceUrl = 'http://mapserv.utah.gov/arcgis/rest/services/BaseMaps/Terrain/MapServer';
var map = new Map('map-div');
@stdavis
stdavis / untitled
Created June 7, 2018 20:48
isTrusted bug
{
"SamplingEvents": {
"geometry": {
"paths": [
[
[
439243,
4500045
],
[
@stdavis
stdavis / HelpDavid.py
Created April 23, 2018 16:34
calculate_from_to.py
import arcpy
streets = r'\\Mac\Downloads\streetsforlinearreferencing\streets_for_linear_referencing.shp'
fldFULLNAME = 'FULLNAME'
routes = {}
with arcpy.da.SearchCursor(streets, [fldFULLNAME, 'Shape@', 'OID@'], sql_clause=(None, 'ORDER BY {}'.format(fldFULLNAME))) as cursor:
for name, shape, oid in cursor:
@stdavis
stdavis / walk_test.py
Created March 12, 2018 19:46
walk_test.py
import timeit
from os.path import abspath, dirname, join
import arcpy
current_directory = abspath(dirname(__file__))
sgid = join(current_directory, 'SGID10.sde')
def dowalk():
@stdavis
stdavis / DJScript.py
Created February 8, 2018 18:31
DJScript.py
import arcpy
import sys
import pyodbc
import datetime
# field names
X_fld = 'X'
Y_fld = 'Y'
PRECINCT_ID_fld = 'PRECINCT_ID'
COUNTY_ID_fld = 'COUNTY_ID'
@stdavis
stdavis / Main.cs
Created December 15, 2017 18:34
SetOnUndone & SetOnRedone - What am I doing wrong?
private void AddSelectedToTemp()
{
QueuedTask.Run(() =>
{
using (FeatureClass tempSegsFC = TempSegmentsLayer.GetFeatureClass())
using (RowCursor segmentsCursor = SegmentsLayer.GetSelection().Search((QueryFilter)null, false))
{
EditOperation operation = new EditOperation();
operation.Name = "add selected to temp segments";
bool newPartCreated = false;
@stdavis
stdavis / fix_corrupt_geometry.py
Created November 6, 2017 23:57
fix_corrupt_geometry.py
'''
fix_corrupt_geometries.py
A module that contains code for fixing geometries that stubbornly refused to give you their WKT
This code assumes that the OBJECTIDs are sequential.
Example usage:
from fix_corrupt_geometries import fix
@stdavis
stdavis / find_duplicates.py
Created September 15, 2017 16:22
find_duplicates.py
'''
find_duplicates.py
A module that contains code that finds duplicate features and notifies the owner of them.
'''
from os.path import basename
import arcpy
import messaging