Skip to content

Commit

Permalink
pointcloud 0.1
Browse files Browse the repository at this point in the history
add pointcloud demo
  • Loading branch information
JannikBrack authored Dec 13, 2024
2 parents ee941b0 + 4d5332e commit 2a22e37
Show file tree
Hide file tree
Showing 28 changed files with 2,097,420 additions and 75 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ jobs:
CI=false yarn build
cd ..
cp -r multi_tab/dist docs-build/multi_tab
- name: Install and build pointcloud🔧
run: |
cd pointcloud
yarn
CI=false yarn build
cd ..
cp -r pointcloud/dist docs-build/pointcloud
- name: copy catalogue metadata
run: |
cp mc_meta.json docs-build/mc_meta.json
Expand Down
Binary file added assets/thumbnails/PointCloudDemoThumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
175 changes: 100 additions & 75 deletions mc_meta.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,104 @@
{
"AppRunningContest": {
"name": "AppRunningContest",
"title": "Running contest",
"description": "A WebGis application which shows the results of a running contest between members of the different WhereGroup company locations in Germany.",
"i18n": {
"de": {
"title": "Laufwettbewerb",
"description": "Eine WebGis Anwendung die den Laufwettbewerb zwischen Mitarbeitern der verschiedenen WhereGroup Standorte in Deutschland darstellt."
}
},
"tags": [],
"category": "",
"type": "application",
"components": [
"MlTransitionGeoJsonLayer",
"MlGeoJsonLayer",
"MlVectorTileLayer"
],
"thumbnail": "https://mapcomponents.github.io/react-map-components-apps/assets/thumbnails/AppRunningContest.png",
"demos": [
{
"name": "Demo",
"url": "https://mapcomponents.github.io/react-map-components-apps/running_contest/"
}
]
},
"AppWebGis": {
"name": "AppWebGis",
"title": "WebGis",
"description": "An example of a WebGis application with different measure tools, visualizing multiple layers containg various data within north-rhine westphalia",
"i18n": {
"de": {
"title": "WebGis",
"description": "Eine WebGis Anwenung mit Messwerkzeugen, dargestellt werden mehere Layer mit unetrschiedlichen Informationen in NRW"
}
},
"tags": [],
"category": "",
"type": "application",
"components": [
"MlGeoJsonLayer",
"MlIconLayer",
"MlWmsLoader",
"MlNavigationTools"
],
"thumbnail": "https://mapcomponents.github.io/react-map-components-apps/assets/thumbnails/AppWebGis.png",
"demos": [
{
"name": "Demo",
"url": "https://mapcomponents.github.io/react-map-components-apps/webGis/"
}
]
},
"PowerPlantsApp": {
"name": "PowerPlantsApp",
"title": "World Power Plants",
"description": "A WebGis application providing precise Information about various types of energy generation across the whole planet ",
"i18n": {
"de": {
"title": "Energiekraftwerke weltweit",
"description": "Eine WebGis-Anwendung welche Inofrmationen über Energieerzeugung auf der ganzen Welt darstellt"
}
},
"tags": [],
"category": "",
"type": "application",
"components": ["MlGeoJsonLayer", "MlWmsLoader", "MlNavigationTools"],
"thumbnail": "https://mapcomponents.github.io/react-map-components-apps/assets/thumbnails/PowerPlants.png",
"demos": [
{
"name": "Demo",
"url": "https://mapcomponents.github.io/react-map-components-apps/powerplants/"
}
]
},
"AppRunningContest": {
"name": "AppRunningContest",
"title": "Running contest",
"description": "A WebGis application which shows the results of a running contest between members of the different WhereGroup company locations in Germany.",
"i18n": {
"de": {
"title": "Laufwettbewerb",
"description": "Eine WebGis Anwendung die den Laufwettbewerb zwischen Mitarbeitern der verschiedenen WhereGroup Standorte in Deutschland darstellt."
}
},
"tags": [],
"category": "",
"type": "application",
"components": [
"MlTransitionGeoJsonLayer",
"MlGeoJsonLayer",
"MlVectorTileLayer"
],
"thumbnail": "https://mapcomponents.github.io/react-map-components-apps/assets/thumbnails/AppRunningContest.png",
"demos": [
{
"name": "Demo",
"url": "https://mapcomponents.github.io/react-map-components-apps/running_contest/"
}
]
},
"AppWebGis": {
"name": "AppWebGis",
"title": "WebGis",
"description": "An example of a WebGis application with different measure tools, visualizing multiple layers containg various data within north-rhine westphalia",
"i18n": {
"de": {
"title": "WebGis",
"description": "Eine WebGis Anwenung mit Messwerkzeugen, dargestellt werden mehere Layer mit unetrschiedlichen Informationen in NRW"
}
},
"tags": [],
"category": "",
"type": "application",
"components": [
"MlGeoJsonLayer",
"MlIconLayer",
"MlWmsLoader",
"MlNavigationTools"
],
"thumbnail": "https://mapcomponents.github.io/react-map-components-apps/assets/thumbnails/AppWebGis.png",
"demos": [
{
"name": "Demo",
"url": "https://mapcomponents.github.io/react-map-components-apps/webGis/"
}
]
},
"PowerPlantsApp": {
"name": "PowerPlantsApp",
"title": "World Power Plants",
"description": "A WebGis application providing precise Information about various types of energy generation across the whole planet ",
"i18n": {
"de": {
"title": "Energiekraftwerke weltweit",
"description": "Eine WebGis-Anwendung welche Inofrmationen über Energieerzeugung auf der ganzen Welt darstellt"
}
},
"tags": [],
"category": "",
"type": "application",
"components": [
"MlGeoJsonLayer",
"MlWmsLoader",
"MlNavigationTools"
],
"thumbnail": "https://mapcomponents.github.io/react-map-components-apps/assets/thumbnails/PowerPlants.png",
"demos": [
{
"name": "Demo",
"url": "https://mapcomponents.github.io/react-map-components-apps/powerplants/"
}
]
},
"PointCloud": {
"name": "PointCloud",
"title": "PointCloud on world map",
"description": "Ever heard of a PointCloud? Basically, it's a set of points placed in 3-dimensional space creating a detailed 3D object. This application contains an example of a point cloud, but projected onto the world map.",
"i18n": {
"de": {
"title": "Energiekraftwerke weltweit",
"description": "Haben Sie schon einmal von einer PointCloud gehört? Im Grunde genommen handelt es sich um eine Reihe von Punkten, die im dreidimensionalen Raum platziert sind und ein detailliertes 3D-Objekt bilden. Diese Anwendung enthält ein Beispiel für eine Punktwolke, allerdings projiziert auf die Weltkarte."
}
},
"tags": [],
"category": "",
"type": "application",
"thumbnail": "https://mapcomponents.github.io/react-map-components-apps/assets/thumbnails/PointCloudDemoThumbnail.png",
"demos": [
{
"name": "Demo",
"url": "https://mapcomponents.github.io/react-map-components-apps/pointcloud/"
}
]
},
"MultiTab": {
"name": "MultiTab",
"title": "Multi-Tab Demo",
Expand Down
14 changes: 14 additions & 0 deletions pointcloud/.eslintrc.cjs
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',
},
}
26 changes: 26 additions & 0 deletions pointcloud/.gitignore
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*
11 changes: 11 additions & 0 deletions pointcloud/Dockerfile
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;"]
19 changes: 19 additions & 0 deletions pointcloud/README.md
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
```
76 changes: 76 additions & 0 deletions pointcloud/converter.py
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}")
16 changes: 16 additions & 0 deletions pointcloud/index.html
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>
Loading

0 comments on commit 2a22e37

Please sign in to comment.