Skip to content

Instantly share code, notes, and snippets.

'''
Used for renaming photos in a folder using a matching ID
7/7/2015
'''
import os, csv
#declare new dictionary
IDs = {}
#build dictionary using input csv file. csv should be setup as key:value pairs
@rabbleNaut
rabbleNaut / emstClipper.py
Last active August 29, 2015 14:01
EMST Vegetation Clipper tool
import os, csv
from arcpy import *
# Checks to see which districts are intersected by the project area
def checkDistricts():
x = 0
for fc in fcList:
x += 1
flyr = 'flayer' + str(x)
MakeFeatureLayer_management(fc, flyr)
@rabbleNaut
rabbleNaut / listAliases.py
Created April 10, 2014 14:46
This script will allow the user to select a feature class and output the features Name, Alias, and Type to a .csv file. To be used in ArcGIS Modelbuilder.
'''
===========================
listAliases.py
4/8/2014
This script will allow the user to select a feature class and output the features Name, Alias, and Type to a .csv file.
Arguments:
0 - Input Featureclass
@rabbleNaut
rabbleNaut / DoForms_Downloader.py
Last active August 29, 2015 13:57
For use with ESRI model builder. Downloads images based on URLs, creates new fields, populates new fields with links to local images for reporting.
'''
DoForms_Downloader.py
v1.10
3/21/2014
This script will accomplish the following:
- Allows user to select featureclass generated from DoForms
@rabbleNaut
rabbleNaut / ClipLooper.py
Last active June 29, 2023 12:18
This was for a Scripting for GIS class project using Arcmap 10.1 and Model Builder
'''===============================
ClipLooper.py
The purpose of this script is to step through all 10 counties in the dataset and
clip each of the 3 features (Water Bodies, Streams, City Limits) to the counties border.
Script Arguments:
0 - Input County FC
1 - Input Water Bodies FC
2 - Input Streams FC
@rabbleNaut
rabbleNaut / batchRename.py
Created March 20, 2014 13:05
Uses Arcpy to iterate through feature classes in a feature dataset and rename them.
import arcpy
from arcpy import *
env.workspace = r"C:\Users\RABBEY-C\RA_GIS\Projects\RA_EMST\Updated_Phase_Features.gdb\District_Unions"
fcList = arcpy.ListFeatureClasses()
#Renames featureclasses ending in "_Union" with ""
for fc in fcList:
@rabbleNaut
rabbleNaut / batchFieldDelete.py
Created March 20, 2014 13:04
Uses Arcpy to iterate through features in a featuredataset to delete unwanted fields.
'''
batchFieldDelete.py
Iterate through features in featuredataset to delete unwanted fields.
Delete fields:
1 - Area_MI
2 - DOT_Feature
3 - Area_MI
'''
@rabbleNaut
rabbleNaut / batchFieldUpdate.py
Last active August 29, 2015 13:57
Uses Arcpy to iterate through all feature classes in a feature dataset to create and populate new fields.
'''
batchFieldUpdate.py
For each feature class in EMST_Districts on Comanche.sde, do the following:
1 - Adds new field "Feature_Type"
2 - Calculates field
if type = null add "vegetation"
'''
@rabbleNaut
rabbleNaut / DropMidFields.py
Created March 20, 2014 12:46
Used for editing a .csv file that was too large for Excel or Access.
import csv
# Removes columns starting at remove_from up to- but *not including* - remove_to
# In this example, all columns are removed except for the first 5 and last 21
remove_from = 5
remove_to = 239
fp_in = open("tx000452010.txt", "rb")
@rabbleNaut
rabbleNaut / DropLastFields.py
Last active August 29, 2015 13:57
Used for editing a .csv file that was too large for Excel or Access.
import csv
#removes columns starting at remove_from up to- but *not including* - remove_to
remove_from = 239
remove_to = 260
fp_in = open("tx000452010.txt", "rb")
fp_out = open("tx000452010_PT1.txt", "wb")
reader = csv.reader(fp_in, delimiter=",")