-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTIPS.txt
114 lines (85 loc) · 4.16 KB
/
TIPS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
https://groups.google.com/forum/#!topic/cesium-dev/xLkYIuku9hA
find /srv/calisto/tilesets/ -name '*.json' -exec sed -i 's/NaN/0/g' {} +
I've updated my docker setup here https://github.com/kiselev-dv/osm-cesium-3d-tiles
1. build and run that docker, map some folder on the host to /opt/data
2. download data and save it as /opt/data/map.osm.bz2
3. run convert.sh
What could be wrong:
convert.sh will run gazetteer.jar to filter buildings and split the large dataset into smaller tiles.
you can do it manually, it require two steps
1. java -jar /opt/gazetteer/gazetteer.jar --data-dir /opt/data split /path/to/osm.xml.bz2 or you can use pbf with osmconvert
osmconvert /path/to/pbf | java -jar /opt/gazetteer/gazetteer.jar --data-dir /opt/data split -
2. java -jar /opt/gazetteer/gazetteer.jar tile-buildings --out-dir /opt/osm-tiles --level 12
Next convert osm into obj and split it into z14 tiles
It's done by convert_parallel.py
Manually it's:
cd to /opt/OSM2World
run ./osm2world.sh -i /path/to/osm -o path/to/obj --config /scripts/prop.properties
Than, obj2gltf and gltf2b3dm
Than you can use generated by OSM2World tileset.json
var viewer = new Cesium.Viewer('cesiumContainer');
var position = Cesium.Cartesian3.fromDegrees(-71.1190, 42.3736, 0);
var entity = viewer.entities.add({
name : 'Apple Hill',
position : position,
model : {
uri : 'http://localhost:8003/tilesets/Harvard/harvard.gltf',
minimumPixelSize : 128,
maximumScale : 20000
}
});
viewer.trackedEntity = entity;
======================================================================================================
https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html
var viewer = new Cesium.Viewer('cesiumContainer', {
scene3DOnly : true
});
var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/world',
requestWaterMask : true,
requestVertexNormals : true
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;
var scene = viewer.scene;
var heightOffset = 23.0;
var url = 'tileset.json';
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url : url
}));
tileset.readyPromise.then(function(tileset) {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, 0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
// Position tileset
var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
var matrix = Cesium.Matrix4.fromTranslation(translation);
tileset.modelMatrix = matrix;
var transform = Cesium.Matrix4.pack(matrix, new Array(16));
console.log(transform);
});
=====================================================================================================
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url : 'http://localhost:8002/tilesets/Seattle/tileset.json'
}));
// Common setting for the skipLevelOfDetail optimization
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url : 'http://localhost:8002/tilesets/Seattle/tileset.json',
skipLevelOfDetail : true,
baseScreenSpaceError : 1024,
skipScreenSpaceErrorFactor : 16,
skipLevels : 1,
immediatelyLoadDesiredLevelOfDetail : false,
loadSiblings : false,
cullWithChildrenBounds : true
}));
// Common settings for the dynamicScreenSpaceError optimization
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url : 'http://localhost:8002/tilesets/Seattle/tileset.json',
dynamicScreenSpaceError : true,
dynamicScreenSpaceErrorDensity : 0.00278,
dynamicScreenSpaceErrorFactor : 4.0,
dynamicScreenSpaceErrorHeightFalloff : 0.25
}));