w3reality / three-geo

3D geographic visualization library
MIT License
1.09k stars 183 forks source link

how to get contours terrain and wireframe terrain? #18

Open zxo102 opened 4 years ago

zxo102 commented 4 years ago

Follow the example of https://github.com/w3reality/three-geo/tree/master/examples/editor like: tgeo.getTerrain(origin, radius, 12, { // onVectorDem: (mesh) => { /* just for debugging ajax */ }, onRgbDem: (meshes) => { ... } , onSatelliteMat: (mesh) => { mesh.material.wireframe = true; mesh.material.side = THREE.DoubleSide; render(); }, }); I can get satellite terrain. How can I get the other two types: contours terrain and wireframe terrain?

zxo102 commented 4 years ago

I found a solution here:

https://observablehq.com/@j-devel/hello-3d-geographic-contours

zxo102 commented 4 years ago

I got satellite and contours terrains from tgeo.getTerrain(origin, radius, 12, {...}) in different sizes with same parameters:

image

image

For satellite terrain:

tgeo.getTerrain(origin, radius, 12, { onRgbDem: (meshes) => { meshes.forEach((mesh) => { scene.add(mesh); }); render(); }, onSatelliteMat: (mesh) => { mesh.material.wireframe = true; mesh.material.side = THREE.DoubleSide; render(); }, });

For contours terrain:

tgeo.getTerrain(origin, radius, 12, { onVectorDem: (objs) => { objs.forEach((obj) => { scene.add(obj); }); render(); }, });

How do I get the same size of terrain boxes?

Thanks a lot.

j-devel commented 4 years ago

How do I get the same size of terrain boxes?

It seems you need to crop each terrain model horizontally along the white reference boxes so they have "the same" sizes. But, currently, we don't have this functionality in three-geo (https://github.com/w3reality/three-geo/issues/8#issuecomment-558545985).

Edit: more precisely, we already have this cropping feature for vector DEMs (disabled at this moment), but not for rgb DEMs.

zxo102 commented 4 years ago

Thanks a lot for your reply @j-devel and see what I can do.