Skip to content

Instantly share code, notes, and snippets.

@cindygis
cindygis / convertXLStoGIS.py
Last active Aug 29, 2015
Takes a folder of spreadsheets and converts it to geodatabase tables using available arcpy tools.
View convertXLStoGIS.py
#
# @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 Aug 19, 2016
Loops over an existing spreadsheet and builds up a definition query to apply to a layer in ArcMap
View buildDefQryFromXLS.py
#
# @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 Aug 29, 2015
Exports data driven pages from a folder of map documents as JPEGs.
View exportMultiDDPasJPEG.py
#
# @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 Aug 29, 2015
Creates a new coded value domain from values in a feature class using a generator expression.
View createCVDfromGen.py
#
# @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 Aug 29, 2015
Adds a new field and assigns an existing domain to a feature class, or assigns the domain only if the field exists.
View assignExistingDomainToField.py
#
# @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 Jul 29, 2018
Extracts a unique list of values from an attribute table and converts it into an coded value domain.
View convertListToCVD.py
#
# @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 Aug 29, 2015
Returns the ESRI WKT for a given coordinate system from epsg.io
View getEsriWKT.py
#
# @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 Mar 6, 2015
Returns the distance a point is along a line.
View getPointDistanceAlongLine.py
#
# @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 Aug 29, 2015
Set the label expression and switch on labels for all layers in an ArcMap document.
View toggleLabelsInMXD.py
#
# @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 Aug 29, 2015
Prints out the key-values pairs of the dictionary of subtypes on a feature class.
View listSubtypesOfFC.py
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']