This README introduces the pipeline to preprocess swisstopo free geodata for use in CesiumJS. The swisstopo terms of use could be found here.
- Please first go through the swisstopo free geodata website and refer to General Data Flow in
**README.md**
:- swissSURFACE3D:
Lidar Point Clouds: models all natural and man-made objects of the surface of Switzerland in the form of a classified point cloud. - swissSURFACE3D Raster:
DTMs: a digital surface model (DSM) which represents the earth’s surface including visible and permanent landscape elements - SWISSIMAGE 10 cm:
Orthophotos: a composition of new digital color aerial photographs over the whole of Switzerland with a ground resolution of 10 cm
- swissSURFACE3D:
- Build the folder with scene name under the data_preprocess folder, e.g.
./data_preprocess/scene_name
- Locate your target area in the above three links and download the csv file from the webpage to
./data_preprocess/scene_name
folder. We recommand to paddle the target area when you choose by rectangle, e.g. if you are interested in a 3 * 3 area then choose 5 * 5 blocks centered on it.
Operations: Selection mode: select by rectangles -> click New rectangle buttun -> choose the area of interest in the map -> keep default options and click search -> click export all links -> click File ready. Click here to download -> save to./data_preprocess/scene_name
- Run the scripts below to download the files and generate the local geodata.
cd data_preprocess
export DATASET=demo
python helper_download_from_csv.py $DATASET
we process the downloaded .tif surface models and do tiling in quantized-mesh format
bash helper_terrain_preprocess.sh $DATASET
Sanity check on terrain data serving
Note: it helps debug but is not a must during preprocessing.
# serve the local tiles for Cesium usage. $PORT number must be consistent with Cesium app.js
export PORT=3000
bash helper_terrain_serve.sh $DATASET $PORT
# please check the 'install cesium terrain server' section at ../setup/install.sh in case of error
we process the downloaded .tif orthophotos and do tiling in TMS format
bash helper_imagery_preprocess.sh $DATASET
we process the downloaded .las point clouds and do tiling in Cesium 3D tiles format
bash helper_pointCloud_colorize.sh $DATASET
-
Create a Cesium Ion account and enter My Assets page
-
Upload the following asset respectively:
(1) Compress./$DATASET/$DATASET-surface3d/ecef
folder in .zip file(2)
./$DATASET/$DATASET-surface3d-raster/mergedTIF-wgs84.tif
note: When uploading the .tif file, select the kind as raster terrain and choose base terrain as Cesium World Terrain.
-
Adjust the location of the 3D tile asset with '*-ecef.zip' source file.
- Click the Adjust Tileset Location button on the right top preview window of the 3D tile asset.
- Click the Global Settings on the top left
- Select the Terrain as '*-mergedTIF-wgs84' we uploaded and click 'Back to Assets' to save the changes.
-
Copy the
ID
andaccess_token
of the 3D tile asset with '*-ecef.zip' source file. The token can be accessed via Access Token besides 'My Assets' tab. -
Configure the Cesium connection and rendering settings in
../source/app.js
:- Access Token:
Cesium.Ion.defaultAccessToken
- Asset_id:
url: Cesium.IonResource.fromAssetId()
- Resolution:
container.style.width = '720px'; container.style.height = '480px';
- camera parameters:
var fov_deg = 73.74;
- Access Token:
Warning: If you use other Ceisum 3D tiles data source instead of the Swisstopo Free Geodata and the model is already calibrated
in wgs84 coordinate system and finished the Swisstopo Free Geodata preprocess, please comment line 358 to line 363 in ../source/app.js
!!! Otherwise, the local file will overlap with the server file you upload!
- Swiss coordinate system
- typically we have raw data in planimetric
lv95
and altimetricln02
systems (local swiss reference frames), and we would stick with the standardwgs84
ellipsoid (epsg:4326
). - the planimetric (planar coordiantes) conversion from
lv95
towgs84
is straightforward and reliable usinggdalwarp
. - the altimetric (elevation/height) conversion from
ln02
towgs84
is obtained by approximate results in thewgs84
ellipsoid, i.e.,ln02 ---> (reframeTransform.py) ---> wgs84
. The helper functionreframeTransform.py
is at/scripts
folder. The numerical accuracy loss during the conversion is generally very small, and please refer to swisstopo and swissREFRAME for further discussion.
- typically we have raw data in planimetric
- Rules of thumb regarding height system
- if surface raster
tif
is used, it's straightforward to convert itsln02
height towgs84
height withreframeTransform.py
and then covert its planimetric coordinates fromln95
towgs84
withgdalwarp
. For surface point cloudlaz
,reframeTransform.py
could map thelv95
+ln02
3D coordinates intowgs84 ECEF
coordinates directly.
- if surface raster
- This repo records a nice list of available conversion tools.
If you find our code useful for your research, please cite the paper:
@article{yan2021crossloc,
title={CrossLoc: Scalable Aerial Localization Assisted by Multimodal Synthetic Data},
author={Yan, Qi and Zheng, Jianhao and Reding, Simon and Li, Shanci and Doytchinov, Iordan},
journal={arXiv preprint arXiv:2112.09081},
year={2021}
}