Skip to content

Commit 8bf9b1c

Browse files
kylemann16gadomski
authored andcommitted
Add stac_version to example, make file usage more robust, fix links in readme
1 parent 7449319 commit 8bf9b1c

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ LiDAR or coincidence-matched imagery.
1515

1616
- Examples:
1717
- [Example](examples/example-autzen.json)
18-
- [PDAL to STAC Python script](pdal-to-stac.py)
18+
- [PDAL to STAC Python script](examples/pdal-to-stac.py)
19+
- [Environment](examples/environment.yml)
1920
- [JSON Schema](json-schema/schema.json)
2021
- [Changelog](./CHANGELOG.md)
2122

@@ -32,7 +33,7 @@ LiDAR or coincidence-matched imagery.
3233
### Schema Object
3334

3435
A sequential array of Items that define the dimensions or channels of
35-
the point cloud, their types, and their sizes (in full bytes).
36+
the point cloud, their types, and their sizes (in full **bytes**).
3637

3738
| Field Name | Type | Description |
3839
| ---------- | ------- | -------------------------- |

examples/example-autzen.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
"name": "ScanAngleRank",
276276
"position": 9,
277277
"stddev": 8.484304657,
278-
"variance": 71.98342551
278+
"variance": 71.9834255
279279
},
280280
{
281281
"average": 126.4052859,
@@ -364,5 +364,6 @@
364364
"stac_extensions": [
365365
"https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json"
366366
],
367+
"stac_version": "1.0.0",
367368
"type": "Feature"
368369
}

examples/pdal-to-stac.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/usr/bin/env python
22

3-
# conda install -c conda-forge pdal gdal
3+
# conda env create -f environment.yml
4+
# conda activate stac-extensions-pointcloud
5+
# ./pdal-to-stac.py
46

57
import sys
68
import json
7-
import os
9+
from os import path
10+
from pathlib import Path
811
import pdal
912

1013
filename = "https://github.com/PDAL/data/raw/master/autzen/autzen-classified.copc.laz"
@@ -67,7 +70,7 @@ def convertBBox(obj):
6770
output['geometry'] = stats['bbox']['EPSG:4326']['boundary']
6871

6972
output['bbox'] = convertBBox(stats['bbox']['EPSG:4326']['bbox'])
70-
output['id'] = os.path.basename(filename)
73+
output['id'] = path.basename(filename)
7174
output['type'] = 'Feature'
7275

7376
assets = {'data': {'href': filename}}
@@ -91,10 +94,12 @@ def convertBBox(obj):
9194
output['properties'] = properties
9295
output['assets'] = assets
9396
output['stac_extensions'] = ['https://stac-extensions.github.io/pointcloud/v1.0.0/schema.json']
97+
output['stac_version'] = '1.0.0'
9498

9599
link = {'rel':'self',"href":filename}
96100
output['links'] = [link]
97101

98-
with open('examples/example-autzen.json', 'w') as autzen_out:
102+
example_dir = Path(__file__).parent
103+
with open(example_dir/'example-autzen.json', 'w') as autzen_out:
99104
autzen_out.write(json.dumps(output, sort_keys=True, indent=2,
100105
separators=(',', ': ')))

0 commit comments

Comments
 (0)