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
def list_to_ranges(in_list): | |
''' Convert a list of integers into a string of ranges of consecutive values. ''' | |
l = in_list[:] | |
l.sort() | |
range_str = str(l[0]) | |
for i in xrange(1,len(l)-1): # Handle first & last separately | |
if l[i] == l[i-1]+1 and l[i] == l[i+1]-1: | |
pass | |
elif l[i] != l[i-1]+1: | |
range_str += ', ' + str(l[i]) |
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
def titlecase(in_str): | |
''' Convert a string to Title Case. Not very intelligent: | |
all words capitalized, and "iPhone" becomes "Iphone". ''' | |
words = in_str.split(' ') | |
for i in xrange(len(words)): | |
words[i] = words[i].capitalize() | |
title = ' '.join(words) | |
return title | |
# Example call: |
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
def create_mean_centroid(in_layer, out_fc, weight_field): | |
''' | |
Calculate average coordinates from all input features' centroids, | |
weighted by values in weight_field. | |
Output is a new feature class containing a single mean centroid point. | |
It is *highly* recommended that a State Plane or UTM coordinate system | |
be used, as the calculations use Euclidean geometry. | |
''' |
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 | |
def check_selection(lyr): | |
"""Check whether specified feature layer has a selection.""" | |
desc = arcpy.Describe(lyr) | |
selected = desc.FIDSet | |
return len(selected) > 0 |
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 json | |
import os | |
import sys | |
if ((3, 0) <= sys.version_info <= (3, 9)): | |
from urllib.request import urlopen # Python 3 | |
elif ((2, 0) <= sys.version_info <= (2, 9)): | |
from urllib2 import urlopen # Python 2 | |
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
<NotepadPlus> | |
<UserLang name="sas" ext="sas"> | |
<Settings> | |
<Global caseIgnored="yes" /> | |
<TreatAsSymbol comment="no" commentLine="yes" /> | |
<Prefix words1="no" words2="no" words3="no" words4="yes" /> | |
</Settings> | |
<KeywordLists> | |
<Keywords name="Delimiters">"`0"'0</Keywords> | |
<Keywords name="Folder+">data proc %macro %macro proc if</Keywords> |
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
#!/usr/bin/env python | |
''' | |
python_toolbox_name.pyt | |
Author: username | |
Revised: mm/dd/yyyy | |
--------------------------------------------------------------------------- | |
Python toolbox (.pyt) description and special instructions. | |
''' | |
import os |
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
.Rhistory | |
*.dbf | |
*.prj | |
*.shp* | |
*.shx | |
*.geojson |
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
CCA_Num | CCA | Pop2010 | Pop2020 | Pop_Change | Pop_PctChange | HH2010 | HH2020 | HH_Change | HH_PctChange | HU2010 | HU2020 | HU_Change | HU_PctChange | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14 | Albany Park | 51542 | 48396 | -3146 | -6.10 | 16322 | 17161 | 839 | 5.14 | 17982 | 18254 | 272 | 1.51 | |
57 | Archer Heights | 13363 | 14196 | 833 | 6.23 | 3838 | 4163 | 325 | 8.47 | 4244 | 4405 | 161 | 3.79 | |
34 | Armour Square | 13443 | 13890 | 447 | 3.33 | 5262 | 5648 | 386 | 7.34 | 5771 | 6078 | 307 | 5.32 | |
70 | Ashburn | 41081 | 41098 | 17 | 0.04 | 12451 | 12909 | 458 | 3.68 | 13060 | 13387 | 327 | 2.50 | |
71 | Auburn Gresham | 48743 | 44878 | -3865 | -7.93 | 17603 | 18071 | 468 | 2.66 | 20351 | 20664 | 313 | 1.54 | |
25 | Austin | 98514 | 96557 | -1957 | -1.99 | 32792 | 35864 | 3072 | 9.37 | 38214 | 39477 | 1263 | 3.31 | |
45 | Avalon Park | 10148 | 9458 | -690 | -6.80 | 3907 | 4145 | 238 | 6.09 | 4274 | 4569 | 295 | 6.90 | |
21 | Avondale | 39262 | 36257 | -3005 | -7.65 | 13573 | 14578 | 1005 | 7.40 | 15339 | 15937 | 598 | 3.90 | |
19 | Belmont Cragin | 78743 | 78116 | -627 | -0.80 | 21591 | 23450 | 1859 | 8.61 | 23634 | 24881 | 1247 | 5.28 |
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
// Line-break enforcer, for instances where ArcGIS Pro won't automatically | |
// insert line breaks in long strings (e.g. in composite callouts). | |
// The targetWidth parameter is a character limit that the function will | |
// use to break the input str into multiple lines. Individual lines may | |
// be slightly longer or shorter than the targetWidth, depending on where | |
// space characters exist that can be replaced with line breaks. | |
function insertNewLines(str, targetWidth) { | |
var words = Split(str, " ") | |
var lines = [] | |
var curLine = "" |