Skip to content

Instantly share code, notes, and snippets.

@cindygis
cindygis / convertXLStoGIS.py
Last active August 29, 2015 14:16
Takes a folder of spreadsheets and converts it to geodatabase tables using available arcpy tools.
#
# @author Cindy Williams
# @date 14/11/2014
#
# Takes a folder containing deeds data in spreadsheet
# format and converts it into a GIS table for further processing.
# It must adhere to a specific format.
#
# For use as a script tool in an ArcGIS Toolbox.
#
@cindygis
cindygis / buildDefQryFromXLS.py
Last active August 19, 2016 19:48
Loops over an existing spreadsheet and builds up a definition query to apply to a layer in ArcMap
#
# @author Cindy Williams
# @date 25/06/2013
#
# Loops over an existing spreadsheet with attribute data
# and builds up a definition query to apply to the dataset.
#
# For use in the Python window in ArcMap.
#
@cindygis
cindygis / exportMultiDDPasJPEG.py
Last active August 29, 2015 14:16
Exports data driven pages from a folder of map documents as JPEGs.
#
# @author Cindy Williams
# @date 23/08/2013
#
# Exports the data driven pages from a folder of
# map documents as JPEGs.
#
# For use as a script tool in an ArcGIS Toolbox.
#
@cindygis
cindygis / createCVDfromGen.py
Last active August 29, 2015 14:16
Creates a new coded value domain from values in a feature class using a generator expression.
#
# @date 25/02/2015
# @author Cindy Williams
#
# Extracts a list of values from a field in an attribute table
# to be used in a coded value domain.
#
# For use in the Python window in ArcCatalog.
#
@cindygis
cindygis / assignExistingDomainToField.py
Last active August 29, 2015 14:16
Adds a new field and assigns an existing domain to a feature class, or assigns the domain only if the field exists.
#
# @date 25/02/2015
# @author Cindy Williams
#
# Adds a new field to feature classes in a file GDB
# and assigns an existing domain to it. If the field
# exists, only the domain is assigned.
#
# For use in the Python window in ArcCatalog.
#
@cindygis
cindygis / convertListToCVD.py
Last active July 29, 2018 11:06
Extracts a unique list of values from an attribute table and converts it into an coded value domain.
#
# @date 31/05/2013
# @author Cindy Williams
#
# Extracts a unique list of values from an attribute table
# and converts it into an coded value domain.
#
# For use as a script tool in an ArcGIS Toolbox.
#
@cindygis
cindygis / getEsriWKT.py
Last active August 29, 2015 14:16
Returns the ESRI WKT for a given coordinate system from epsg.io
#
# @date 04/03/2015
# @author Cindy Williams
#
# Returns the ESRI WKT for a given EPSG from epsg.io
# Adapted from http://geospatialpython.com/2014/12/wkt-epsg-strings-made-easy.html
#
def getPRJwkt(epsg):
import urllib
@cindygis
cindygis / getPointDistanceAlongLine.py
Created March 6, 2015 13:07
Returns the distance a point is along a line.
#
# @date 06/03/2015
# @author Cindy Williams
#
# Returns the distance a point is along a line. Assumes that the
# existing point and line feature classes have the same spatial reference,
# and the points are snapped to the line.
#
# For use as a standalone script.
#
@cindygis
cindygis / toggleLabelsInMXD.py
Last active August 29, 2015 14:17
Set the label expression and switch on labels for all layers in an ArcMap document.
#
# @date 17/09/2014
# @author Cindy Williams
#
# Set the label field and switch labels on for
# all layers in a mxd.
#
# For use in the Python window in ArcMap.
#
@cindygis
cindygis / listSubtypesOfFC.py
Last active August 29, 2015 14:17
Prints out the key-values pairs of the dictionary of subtypes on a feature class.
import arcpy
ftr = r"C://Some//Arb//Folder//work.gdb//ftr"
subs = arcpy.da.ListSubtypes(ftr)
for k, v in subs.iteritems():
print k, v['Name']