Skip to content

Instantly share code, notes, and snippets.

@cindygis
cindygis / geomToJSONandCSV.py
Created April 29, 2015 09:11
Converts geometry in a feature class to JSON and writes it to a CSV file
#
# @date 29/04/2015
# @author Cindy Williams
#
# Converts geometry in a feature class to JSON,
# and writes it to a CSV file.
#
# For use in the Python window in ArcCatalog.
#
@cindygis
cindygis / writeLyrPropertiesToCSV.py
Created May 11, 2015 08:25
Writes certain properties of a feature layer within a group layer to csv.
#
# @date 11/05/2015
# @author Cindy Williams
#
# Writes certain properties of a layer within a group
# layer in a mxd to csv.
#
# For use in the Python window in ArcMap.
#
@cindygis
cindygis / updateSymbologyBasedOnDomain.py
Last active August 29, 2015 14:21
Updates the values for a unique symbology renderer based on range domain values.
#
# @date 27/05/2015
# @author Cindy Williams
#
# Updates the values for a unique symbology renderer
# based on range domain values. The layer must have
# the unique symbols renderer enabled manually.
#
# For use in the Python window in ArcMap.
#
@cindygis
cindygis / updateLayerNameWithGroupName.py
Created May 29, 2015 12:02
Updates a layer name with the name of the group layer it is in.
#
# @date 29/05/2015
# @author Cindy Williams
#
# Updates a layer name with the name of the group layer
# it is in, in an existing mxd.
#
# For use in the Python window in ArcMap.
#
@cindygis
cindygis / displayDuplicateValuesInField.py
Last active August 29, 2015 14:22
Displays the key values that are duplicates in a list of attribute field values.
#
# @date 29/05/2015
# @author Cindy Williams
#
# Checks an attribute field for duplicate values,
# and displays them along with the amount of duplicates.
#
# For use in the Python window in ArcMap.
#
@cindygis
cindygis / batchDefineProjection.py
Last active August 29, 2015 14:22
Defines the projection for a folder of shapefiles.
import arcpy
arcpy.env.workspace = r"C:\Some\Arb\Folder"
# Define spatial reference WGS 84
sr = arcpy.SpatialReference(4326)
for shp in arcpy.ListFeatureClasses():
arcpy.management.DefineProjection(shp, sr)
print("Defined " + shp)
@cindygis
cindygis / getArcCatalogConnectionsFolder.py
Last active August 29, 2015 14:22
Gets the folder path where ArcCatalog connections are stored
import arcpy
import os
# Detailed description
os_appdata = os.environ['APPDATA'] # Current user's APPDATA folder
folder_esri = "ESRI" # ESRI folder name
arc_prod = arcpy.GetInstallInfo()['ProductName'] # Get the installed product's name e.g. Desktop
arc_ver = arcpy.GetInstallInfo()['Version'] # Get the installed product's version number
arc_cat = "ArcCatalog" # ArcCatalog folder name
@cindygis
cindygis / createFCsfromDataFrame.py
Created June 24, 2015 13:34
Creates feature classes by looking up the name in a pandas data frame
#
# @date 24/06/2015
# @author Cindy Williams
#
# Creates feature classes by looking up the
# name in a pandas data frame
#
# For use as a standalone script
#
@cindygis
cindygis / linesToPolysToCentroids.py
Created June 26, 2015 19:42
Creates centroids from closed lines by creating temporary polygons.
#
# @date 26/06/2015
# @author Cindy Williams
#
# Creates centroids from closed lines by creating temporary
# polygons.
#
# For use as as a standalone script.
#
@cindygis
cindygis / genAttachmentMatchTable.py
Created July 1, 2015 09:32
Generates a file gdb table containing the paths of photos to be attached to matching points as feature attachments..
#
# @date 01/07/2015
# @author Cindy Williams
#
# Generates a file gdb table containing the paths
# of photos to be attached to matching points as feature
# attachments.
#
# For use as a standalone script.
#