A Node.js function that converts survey coordinate data (XYZ format) to standard GeoJSON FeatureCollection with coordinate system transformation using proj4js.
npm install
node main.js- Parsing: Handles space/comma/tab-separated XYZ data
- Transformation: Uses proj4js for coordinate system conversion
- Output: Standard GeoJSON FeatureCollection format
- Robustness: Error handling, validation, preserves source data
Input (XYZ - UTM Zone 15N):
440287.50 4431748.25 125.3
440291.20 4431752.80 126.1
440295.10 4431757.50 124.8
Output (GeoJSON - WGS84):
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-93.699, 40.033, 125.3]
},
"properties": {
"originalX": 440287.5,
"originalY": 4431748.25,
"originalZ": 125.3
}
}
]
}xyzToGeoJSON(xyzData, fromProjection, toProjection, options)- Parse: Multi-format support (space, comma, tab delimiters)
- Validate: Skip invalid lines with warnings
- Transform: Batch process using proj4js
- Output: Standard GeoJSON with source data preservation
- Batch processing for large datasets (configurable chunk size)
- Memory-efficient streaming approach
- Error handling per point (doesn't fail entire dataset)
- Vertical datum transformation (NAVD88 → WGS84 using geoid models)
- Support for additional CRS formats (PROJ.4 strings, WKT)
- Performance optimization for million+ point datasets
- Comprehensive test suite
- CLI interface for batch file processing