Skip to content

Commit

Permalink
Fix xyz conversion when offset_scale is None
Browse files Browse the repository at this point in the history
  • Loading branch information
autra committed May 10, 2022
1 parent a7635e9 commit cbb9530
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion py3dtiles/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,12 @@ def add_tasks_to_process(state, name, task, point_count):

zmq_send_to_process(zmq_idle_clients, zmq_skt, [pickle.dumps({
'filename': file,
'offset_scale': (-avg_min, root_scale, rotation_matrix[:3, :3].T if rotation_matrix is not None else None, infos['color_scale'].get(file)),
'offset_scale': (
-avg_min,
root_scale,
rotation_matrix[:3, :3].T if rotation_matrix is not None else None,
infos['color_scale'].get(file) if infos['color_scale'] is not None else None,
),
'portion': portion,
'id': _id
})])
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/simple.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
281345.1234 369123.4567 0.0000
281345.5678 369123.8901 0.0000
281345.9012 369123.2345 0.0000
9 changes: 9 additions & 0 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,12 @@ def test_convert_with_srs(tmp_dir):
srs_out='4978')
assert os.path.exists(os.path.join(tmp_dir, 'tileset.json'))
assert os.path.exists(os.path.join(tmp_dir, 'r.pnts'))


def test_convert_simple_xyz(tmp_dir):
convert(os.path.join(fixtures_dir, 'simple.xyz'),
outfolder=tmp_dir,
srs_in='3857',
srs_out='4978')
assert os.path.exists(os.path.join(tmp_dir, 'tileset.json'))
assert os.path.exists(os.path.join(tmp_dir, 'r.pnts'))

0 comments on commit cbb9530

Please sign in to comment.