This document describes how to manage geographic coordinates (latitude, longitude, height) for antenna grid positions.
The parts.db database includes coordinate data in two places:
grid_positions for all grid locations (independent of antenna assignments)antenna_positions for assigned antennas (optional coordinates)The antenna_positions table includes optional coordinate columns:
latitude (REAL): Latitude in decimal degreeslongitude (REAL): Longitude in decimal degreesheight (REAL): Height in meters above referencecoordinate_system (TEXT): Coordinate system identifier (e.g., ‘WGS84’, ‘local’)Coordinates are managed via CSV file (database/grid_positions.csv) for easy editing and version control.
The CSV file has the following columns:
grid_code,latitude,longitude,height,coordinate_system,notes
CN021E01,37.8719,-122.2585,10.5,WGS84,North row 21 east 1
CN021E02,37.8720,-122.2583,10.6,WGS84,North row 21 east 2
Empty coordinate values are skipped during loading.
Edit database/grid_positions.csv in a text editor or spreadsheet application:
# With text editor
nano database/grid_positions.csv
# Or import to spreadsheet (Excel, Google Sheets, LibreOffice Calc)
# Then export as CSV when done
Template: A template with all 258 core array positions (CN021E01 through CS021E06) is provided in database/grid_positions.csv. Note that the core array uses 1-based indexing for east columns (E01-E06).
After editing the CSV, load coordinates into the database:
# Load from default CSV (database/grid_positions.csv)
casman database load-coordinates
# Load from custom CSV
casman database load-coordinates --csv my_survey.csv
The command will report:
Example output:
Loading grid coordinates from CSV...
==================================================
Updated: 3 position(s)
Skipped: 0 position(s)
Coordinate data loaded successfully
Query the database to verify coordinates were loaded:
sqlite3 database/parts.db "SELECT grid_code, latitude, longitude, height FROM grid_positions WHERE latitude IS NOT NULL;"
database/grid_positions.csvgit commitcasman database load-coordinates to update grid_positionsgrid_positions.# Via scanner web interface at http://localhost:<dev-port>/scanner
# Scan antenna ANT00001 and assign to CN021E01
grid_code,latitude,longitude,height,coordinate_system,notes
CN021E01,37.871899,-122.258477,10.5,WGS84,North row 21 east 1
casman database load-coordinates
sqlite3 database/parts.db "SELECT * FROM grid_positions WHERE grid_code='CN021E01';"
Common coordinate system identifiers:
Choose a coordinate system appropriate for your site and measurement equipment.
Coordinates are automatically included in position queries:
from casman.database.antenna_positions import get_antenna_position
pos = get_antenna_position('ANT00001')
if pos:
print(f"Latitude: {pos.get('latitude')}")
print(f"Longitude: {pos.get('longitude')}")
print(f"Height: {pos.get('height')}")
print(f"System: {pos.get('coordinate_system')}")
If you need to update coordinates on antenna assignments directly, use
load_grid_coordinates_from_csv() from the antenna_positions module.
No positions updated:
CSV file not found:
database/grid_positions.csv--csv flag to specify different fileCoordinate values incorrect: