-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add pointcloud demo
- Loading branch information
Showing
28 changed files
with
2,097,420 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': 'warn', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
sample* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:18 as node_builder | ||
WORKDIR /usr/src/app | ||
COPY . /usr/src/app | ||
RUN yarn | ||
RUN yarn build | ||
|
||
FROM nginxinc/nginx-unprivileged:1.21 | ||
|
||
COPY --from=node_builder /usr/src/app/dist /usr/share/nginx/html | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# MapComponents Point cloud - Demo | ||
|
||
Diese Demo lädt eine Punktwolke im JSON-Format. Sie muss sich im Ordner „Public“ mit dem Namen „output_pointcloud.json“ befinden. | ||
Um die Datei zu erzeugen, führt man das Skript **converter.py** aus und übergibt als Parameter den Pfad zur LAS-Datei: | ||
|
||
```bash | ||
python3 converter.py < path_to_file > | ||
``` | ||
|
||
# MapComponents + vite + react + typescript | ||
|
||
This template is based on the vite ts-react template, and adds all | ||
required basic components for a MapComponents application. | ||
|
||
## Start the development server | ||
|
||
```bash | ||
yarn dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import laspy | ||
import json | ||
import numpy as np | ||
from laspy.compression import LazBackend | ||
from pyproj import Transformer | ||
import argparse | ||
|
||
# Set up argument parsing | ||
parser = argparse.ArgumentParser(description="Process a LAS/LAZ file.") | ||
parser.add_argument("input_las", type=str, help="Path to the LAS/LAZ file") | ||
|
||
|
||
# Parse the arguments | ||
args = parser.parse_args() | ||
|
||
# Load the LAS/LAZ file | ||
input_las = args.input_las | ||
|
||
if LazBackend.Lazrs.is_available(): | ||
laz_backend = LazBackend.Lazrs | ||
elif LazBackend.Laszip.is_available(): | ||
laz_backend = LazBackend.Laszip | ||
else: | ||
raise RuntimeError("No LAZ backend is available. Install lazrs or laszip.") | ||
|
||
las = laspy.read(input_las, laz_backend=laz_backend) | ||
|
||
original_crs = "EPSG:25832" | ||
target_crs = "EPSG:4326" # WGS84 | ||
|
||
# Set up transformer for coordinate system conversion to WGS84 | ||
transformer = Transformer.from_crs(original_crs, target_crs, always_xy=True) | ||
|
||
# Extract x, y, z coordinates and transform to WGS84 | ||
x, y, z = transformer.transform(las.x, las.y, las.z) | ||
|
||
# Check for RGB color information | ||
dimension_names = las.point_format.dimension_names | ||
has_rgb = 'red' in dimension_names and 'green' in dimension_names and 'blue' in dimension_names | ||
# Extract color values and normalize them to 8-bit range | ||
if has_rgb: | ||
r = (las.red / 256).astype(np.uint8) | ||
g = (las.green / 256).astype(np.uint8) | ||
b = (las.blue / 256).astype(np.uint8) | ||
else: | ||
# Default grey color if RGB is missing | ||
r = np.full_like(x, 128, dtype=np.uint8) | ||
g = np.full_like(x, 128, dtype=np.uint8) | ||
b = np.full_like(x, 128, dtype=np.uint8) | ||
|
||
# Prepare the data for JSON export | ||
positions: list = [] | ||
normals: list = [] | ||
colors: list = [] | ||
|
||
for i in range(len(x)): | ||
position = [float(x[i]), float(y[i]), float(z[i])] | ||
normal = [0, 0, -1] # Normal placeholder; replace with actual data if available | ||
color = [int(r[i]), int(g[i]), int(b[i])] # Use the scaled 8-bit values | ||
|
||
positions.append(position) | ||
normals.append(normal) | ||
colors.append(color) | ||
|
||
points = { | ||
"positions": positions, | ||
"normals": normals, | ||
"colors": colors | ||
} | ||
|
||
# Export to JSON | ||
output_json = "public/output_pointcloud.json" | ||
with open(output_json, "w") as f: | ||
json.dump(points, f, indent=2) | ||
|
||
print(f"Exported LAS/LAZ data to JSON format: {output_json}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="manifest" href="/manifest.json"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="icon" type="image/png" sizes="196x196" href="favicon-196.png"> | ||
<link rel="apple-touch-icon" href="apple-icon-180.png"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<title>PointCloud (3D-Darstellung)</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.