A standalone desktop GIS application built in Java 17 + Swing that implements 24 spatial algorithms features operating on Hong Kong geodetic data in the HK1980 Grid coordinate system (EPSG:2326).
Platform: Java 17 · GeoTools 32 · CesiumJS 1.130 · Apache Maven 3
| # | Feature | Theme |
|---|---|---|
| 1 | Join Computation (Distance & WCB) | 2D Geometry |
| 2 | Polar Computation | 2D Geometry |
| 3 | Polygon Area (Shoelace Formula) | 2D Geometry |
| 4 | Point-in-Polygon (Ray Casting) | 2D Geometry |
| 5 | Convex Hull (Graham Scan) | 2D Geometry |
| 6 | K-Nearest Neighbours | 2D Geometry |
| 7 | Line Segment Intersection | 2D Geometry |
| 8 | Buffer Zone (Circular) | 2D Geometry |
| 9 | Minimum Bounding Rectangle | 2D Geometry |
| 10 | Centroid of Point Set | 2D Geometry |
| 11 | Point-to-Line Distance | 2D Geometry |
| 12 | Minimum Spanning Tree (Prim) | 2D Geometry |
| 13 | CRS Transformation (GeoTools) | GeoTools |
| 14 | Shapefile Attribute Filter | GeoTools |
| 15 | 3D Distance, Slope & Vertical Angle | 3D Analysis |
| 16 | 3D K-Nearest Neighbours | 3D Analysis |
| 17 | 3D Spherical Buffer Zone | 3D Analysis |
| 18 | 3D Bounding Box (AABB) & Volume | 3D Analysis |
| 19 | IDW Elevation Interpolation | 3D Analysis |
| 20 | DBSCAN Spatial Clustering | Advanced |
| 21 | Ordinary Kriging Interpolation | Advanced |
| 22 | Voronoi Diagram (Bowyer-Watson) | Advanced |
| 23 | Kernel Density Estimation (Gaussian) | Advanced |
| 24 | LiDAR Point Cloud Analysis | Advanced |
src/main/java/hkspatialanalysis/
├── Main.java # Entry point
├── MainFrame.java # Swing UI — toolbar, layout, event routing
├── MapPanel.java # Interactive 2D canvas, 12-layer overlay rendering
├── SpatialAlgorithms.java # Features 1-12, 20-23
├── SpatialAlgorithms3D.java # Features 15-19
├── PointCloudHandler.java # Feature 24 — LAS/XYZ parser, voxel downsampling
├── CRSTransformer.java # GeoTools EPSG:2326 ↔ EPSG:4326
├── ShapefileHandler.java # GeoTools shapefile reader (Feature 14)
├── FileHandler.java # CSV reader (4/6-column)
├── TileMapProvider.java # Async tile fetcher + LRU cache
├── ThreeDViewer.java # CesiumJS 3D viewer via localhost HTTP server
└── SpatialPoint.java # Domain object: E, N, Z, category, description
data/
├── hk_trig_stations.csv # 43 HK geodetic trig stations (auto-loaded)
├── hk_school.csv # HK secondary school dataset
└── hk_facilities.csv # HK public facilities dataset
| Library / Service | Version | Role |
|---|---|---|
| Java SE | 17 | Core language, Swing UI, NIO ByteBuffer |
| Apache Maven | 3.x | Build & dependency management |
| GeoTools gt-referencing | 32.x | CRS objects and MathTransform |
| GeoTools gt-epsg-hsql | 32.x | EPSG geodetic authority database |
| GeoTools gt-shapefile | 32.x | Shapefile reader/writer |
| CesiumJS | 1.130 | WebGL 3D globe, 3D Tiles 1.1 |
| HK Gov CSDI 3D Tiles | v1.1 | Official HK building models |
| OpenStreetMap / CartoDB | Z/X/Y | Raster basemap tiles |
Prerequisites: Java 17+, Maven 3.x
git clone https://github.com/4mthxmas20/HKSpatialAnalysis.git
cd HKSpatialAnalysis
mvn clean package -q
java -jar target/HKSpatialAnalysis-1.0-SNAPSHOT-jar-with-dependencies.jarOr open in NetBeans / IntelliJ and run Main.java directly.
The bundled dataset hk_trig_stations.csv contains 43 geodetic triangulation stations from the Hong Kong Lands Department with HK1980 Grid coordinates (EPSG:2326) and elevation (HKPD datum).
Elevation range: 65.0 m (Waglan Island) — 958.5 m (Tai Mo Shan).
All algorithm computations use EPSG:2326 (HK1980 Grid) planar coordinates.
The basemap uses EPSG:4326 (WGS84) for slippy-tile URL generation, converted via GeoTools.
| HK1980 Grid (EPSG:2326) | WGS84 (EPSG:4326) | |
|---|---|---|
| Type | Projected (Transverse Mercator) | Geographic |
| Units | Metres | Decimal degrees |
| Easting / Longitude | ~800,000–875,000 m | ~113.8–114.4 °E |
| Northing / Latitude | ~800,000–860,000 m | ~22.1–22.6 °N |
| Used for | All spatial computations | Basemap tile URLs |

