Useful tools, mostly GIS related.
Adds the erase geoprocessing tool to the ArcMap Basic license level. Works by UNIONing two input feature classes, selecting features that do not overlap with the erase features, and clipping the result. If either input is not a polygon, it will be buffered to a polygon before processing. Tested with ArcMap Desktop Basic 10.5.1 and Python 2.7.
Requirements:
arcpySetup & Usage:
from arcmapBasicErase import erase
erase("path/to/input_fc", "path/to/erase_fc", "path/to/output_fc")
Calculates volumes between two surfaces (DEM and DSM) within polygon boundaries. For each input polygon, extracts the raster surfaces, runs a Cut/Fill analysis, and writes the gross and net volume (in cubic meters) back to the output shapefile.
Requirements:
arcpySetup & Usage:
GROSS_M3 and NET_M3 fields.Clips a single raster, a list of rasters, or an entire directory of rasters to the extent of an input feature class. Outputs are saved with a clipped_ prefix in the specified output folder. Useful for batch processing raster datasets with a specific area of interest.
Requirements:
arcpy, arcpy.saSetup & Usage:
from arcmapRasterClipper import rasterClipper
rasterClipper("path/to/rasters", "path/to/extent_fc", "path/to/output")
Creates a temporary SDE connection file and a named version for versioned editing of enterprise geodatabase feature classes using ArcPy. Handles version creation, editing, reconciliation, posting, and cleanup.
Requirements:
arcpySetup & Usage:
fcLST = ["username.fc1", "username.fc2"] # feature classes to edit
temploc = r"path\to\temp\folder" # location for temp SDE file
sdecon = r"path\to\connection.sde" # existing SDE connection file
user = "username"
password = "password"
from arcmapVersionedEditing import createVersionStartEdit, stopEditReconcileVersion
createVersionStartEdit(fcLST, temploc, sdecon, user, password)
# ... perform your edits here ...
stopEditReconcileVersion()
sde:oracle11g:somesde.world) to match your database.Downloads feature class data from an ArcGIS REST API map service by paginating through all object IDs. Supports optional spatial filtering using a query layer. The data is saved as a feature class in a file geodatabase or in-memory workspace.
Requirements:
arcpy, requests, json, tempfile, shutilSetup & Usage:
url = "https://your-server.com/arcgis/rest/services/ServiceName/MapServer/0"
from arcpyDownloadMapService import downloadRestFeatures
fc = downloadRestFeatures(url, queryLayer="", query="", outLocation="path/to/gdb", outName="output_fc")
queryLayer: Optional feature class to spatially filter results (pass "" for none).query: Optional SQL WHERE clause (pass "" for all features).Creates tile packages (TPKX) from raster data clipped by individual polygon features and optionally uploads them to ArcGIS Portal. Loops through each polygon, generates a TPKX tile package, and publishes it to the active Portal.
Requirements:
arcpy, arcgisSetup & Usage:
rasterType = "TYPE OF RASTER DATA"
subArea = "CITY?"
area = "PROVINCE"
inputPolygons = r"path\to\polygon_features"
inputPolyNameField = 'NAME_FIELD'
detail = 16 # level of detail for tiles
templateAPRXFile = r"path\to\template.aprx" # APRX with one empty map named "Map"
inputRasterLyr = r"path\to\raster.lyrx" # layer file with raster data
outputFolder = r"path\to\output"
enableUploadToPortal = True # set False to only create local TPKX
GIS("home")).python tpkxToPortal.pyExports a CSV file containing information about all items in an ArcGIS Online organization or Portal, including item name, type, ID, size in bytes, and view count. Useful for auditing organizational content and storage usage.
Requirements:
arcgis (ArcGIS API for Python)Setup & Usage:
pip install arcgis
csv_file_path = r'C:\path\to\output.csv'
gis = GIS("https://your-portal.com", "username", "password")
python ArcGISOnlineEnterpriseItemSizeUsage.pyDownloads property assessment data from the Service New Brunswick (SNB) GeoNB REST service. Features a PyQt6 GUI where you can enter a custom query expression, select an output folder, and monitor download progress. Results are exported as KMZ and Excel files.
Requirements:
requests, geopandas, pandas, simplekml, PyQt6, openpyxlSetup & Usage:
pip install requests geopandas pandas simplekml PyQt6 openpyxl
python SNBPropertyDataDownloader.pySNBPropertyData.kmz and SNBPropertyData.xlsx) are saved to the selected folder.Scans a folder of JPEG images for GPS coordinates (latitude, longitude, altitude), camera orientation (roll/pitch/yaw), and sensor specifications (make, model, focal length) by parsing EXIF metadata. Outputs a CSV report summarizing what metadata each image contains. Useful for drone imagery and aerial photography quality checks.
Requirements:
os, struct, csv)Setup & Usage:
IMAGE_FOLDER = r"path/to/your/images"
python cameraMetadataChecker.pyimage_metadata_check.csv in the image folder with columns: image_name, image_path, has_gps_xyz, has_camera_orientation, has_sensor_info.Scans an ArcGIS Portal or ArcGIS Online organization for retired JavaScript 3.x item types including Web AppBuilder applications, Web AppBuilder extensions, AppBuilder Widget Packages, and Map Viewer Classic web maps. Exports findings to a CSV file for migration planning.
Requirements:
arcgis (ArcGIS API for Python)Setup & Usage:
pip install arcgis
gis = GIS("https://your-portal.com", "username", "password")
outputCSV = r"C:\path\to\retired_items.csv"
python checkForRetiredItems.pyInteractive command-line tool that copies a Story Map from one ArcGIS Portal or ArcGIS Online organization to another. Creates all new item IDs and updates internal references. Uses the built-in clone_items function for proper handling of complex Story Map dependencies.
Requirements:
arcgis (ArcGIS API for Python)Setup & Usage:
pip install arcgis
python copy_storymap.pySimple email sending function using Python’s smtplib. Provides a reusable sendEmail() function for sending plain-text emails via SMTP.
Requirements:
smtplib (standard library)Setup & Usage:
from_address = "your_email@example.com"
server = smtplib.SMTP("your.smtp.server.com")
from sendEmail import sendEmail
sendEmail("recipient@example.com", "Subject Line", "Email body text")
Demonstrates a full Site Scan API workflow: creating a project and mission, uploading drone images, starting processing, polling for completion, downloading output products (Ortho, DTM, DSM), and uploading results to ArcGIS Portal using copy_raster.
Requirements:
requests, arcgis (ArcGIS API for Python)Setup & Usage:
pip install requests arcgis
url = 'https://sitescan-api.arcgis.com/api/v2'
token = 'YOUR_API_TOKEN'
project_name = "nameForProject"
mission_name = "nameForMission"
imagesPath = r"C:\path\to\images"
python siteScanAPIExample.py