Skip to content

Instantly share code, notes, and snippets.

@cindygis
cindygis / segmentLineByMeasures.py
Last active August 29, 2015 14:26
Creates segments along a selected line feature by splitting it according to a table of measures and saving it in a new feature class.
#
# @date 04/08/2015
# @author Cindy Williams
#
# Creates segments along a selected line feature
# by splitting it according to a table of measures
# and saving it in a new feature class.
#
# For use as a standalone script.
#
@cindygis
cindygis / createRandomPointsInPoly.py
Last active October 14, 2015 06:29
Creates random points in each polygon feature. Bypasses the Advanced licence needed to run the Create Random Points tool in ArcMap.
#
# @date 06/08/2015
# @author Cindy Williams
#
# Creates random points in each polygon feature
# without the need for an Advanced licence to run
# the Create Random Points tool.
#
# For use in the Python window in ArcCatalog.
#
@cindygis
cindygis / reformatAllLayerNames.py
Last active August 29, 2015 14:27
Quickly formats the names of all the layers in a map document.
#
# @date 14/08/2015
# @author Cindy Williams
#
# Quickly formats the names of all the layers in a map
# document. In this example, the part of the name before
# the first full stop is removed, underscores are replaced
# spaces, a regex is used to insert spaces before capitals
# and the string is converted to proper case.
#
@cindygis
cindygis / convertMultiPagePDFtoTIFF.py
Created August 18, 2015 07:47
Converts a range of pages from a pdf to separate tiff files using the PDF to TIFF tool added at ArcGIS 10.3.
#
# @date 18/08/2015
# @author Cindy Williams
#
# Converts a range of pages from a pdf to separate tiff
# files using the PDF to TIFF tool added at ArcGIS 10.3.
# For very basic conversion, with minimal error handling.
#
# For use as a standalone script.
#
@cindygis
cindygis / panZoomDataFramesToDDPDataFrame.py
Created September 1, 2015 09:57
Pans and zooms each data frame in an ArcMap document to the extent and scale of the data frame containing the data driven pages index layer before exporting.
#
# @date 25/08/2015
# @author Cindy Williams
#
# Pans and zooms each data frame in an ArcMap document
# to the extent and scale of the data frame containing
# the data driven pages index layer before exporting.
#
# For use as a standalone script.
#
@cindygis
cindygis / displayRasterProperties.py
Created September 3, 2015 12:40
Prints a comparison of the specified raster properties using arcpy and numpy.
#
# @date 25/08/2015
# @author Cindy Williams
#
# Prints a comparison of the specified raster
# properties using arcpy and numpy.
#
# For use as a standalone script.
#
@cindygis
cindygis / convertSIDtoTiff.py
Last active September 18, 2015 10:37
Converts a folder of MRSID files to TIFF files.
'''
@date 2015/09/18
@author Cindy Williams
Converts a folder of MRSID files to TIFF files.
For use as a standalone script.
'''
import arcpy
@cindygis
cindygis / writeFieldsToDOC.py
Created September 21, 2015 09:07
Uses the python-docx package to write various properties of a feature class to docx format.
'''
@date 15/09/2015
@author Cindy Williams
Uses the python-docx package to write various
properties of a feature class to docx format.
'''
import arcpy
@cindygis
cindygis / extractDOCtablesToXLS.py
Created September 29, 2015 08:53
Writes the contents of all rows from multiple tables in a Word document to a spreadsheet.
import docx
import xlwt
doc = r"C:\Some\Arb\Folder\input.docx"
xls = r"C:\Some\Arb\Folder\output.xls"
document = docx.Document(doc)
book = xlwt.Workbook()
cur_sheet = book.add_sheet("Tables")
row_num = 0
@cindygis
cindygis / splitLineAtInteractivePoint.py
Created October 6, 2015 13:39
Uses an arcpy FeatureSet to allow the user to interactively create points on a line which will be used to split that line into parts, while retaining all attributes.
'''
@date 06/10/2015
@author Cindy Williams
@version 1.0
Uses an arcpy FeatureSet to allow the user to interactively create
points on a line which will be used to split that line into parts,
while retaining all attributes.
Requirements: