Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for How to consume 3D Tiles (pnts) with Cesium
Hidenori FUJIMURA
Hidenori FUJIMURA

Posted on

How to consume 3D Tiles (pnts) with Cesium

I am developing asite to consume 3D Tiles of PNTS (Point Cloud Tiles) with Cesium. Here is the code.

<html><head><metacharset="UTF-8"><scriptsrc="https://cesium.com/downloads/cesiumjs/releases/1.102/Build/Cesium/Cesium.js"></script><scriptsrc="https://frogcat.github.io/cesium-hash/cesium-hash.js"></script><linkhref="https://cesium.com/downloads/cesiumjs/releases/1.102/Build/Cesium/Widgets/widgets.css"rel="stylesheet"></link><style>#cesiumContainer{position:absolute;top:0;left:0;height:100%;width:100%;margin:0;overflow:hidden;padding:0;font-family:sans-serif;}html{height:100%;}body{padding:0;margin:0;overflow:hidden;height:100%;}</style></head><body><divid="cesiumContainer"></div><script>Cesium.Ion.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI5N2UyMjcwOS00MDY1LTQxYjEtYjZjMy00YTU0ZTg5MmViYWQiLCJpZCI6ODAzMDYsImlhdCI6MTY0Mjc0ODI2MX0.dkwAL1CcljUV7NA7fDbhXXnmyZQU_c-G5zRx8PtEcxE"constviewer=newCesium.Viewer("cesiumContainer",{animation:false,homeButton:false,navigationHelpButton:false,sceneModePicker:false,timeline:false})viewer.scene.imageryLayers.addImageryProvider(imageProvider)viewer.clock.currentTime=Cesium.JulianDate.fromIso8601("2023-03-21T12:00")viewer.scene.globe.depthTestAgainstTerrain=trueconstsearchParams=newURLSearchParams(window.location.search)leturl=searchParams.get('tileset')||'https://d21pj9gigeop84.cloudfront.net/data/point-cloud/lp-2022/22302_kawazu-cho/tileset.json'consttileset=newCesium.Cesium3DTileset({url:url,})tileset.maximumScreenSpaceError=16tileset.style=newCesium.Cesium3DTileStyle({pointSize:3});tileset.pointCloudShading.attenuation=falsetileset.pointCloudShading.geometricErrorScale=1viewer.scene.primitives.add(tileset)viewer.camera.moveEnd.addEventListener(()=>{location.hash=Cesium.Hash.encode(viewer)})constcredit=newCesium.Credit('Virtual Shizuoka and/or 東京都デジタルツイン実現プロジェクト')viewer.scene.frameState.creditDisplay.addDefaultCredit(credit)if(Cesium.Hash.decode(location.hash)==null){tileset.readyPromise.then(function(){viewer.zoomTo(tileset,newCesium.HeadingPitchRange(0.0,-0.5,tileset.boundingSphere.radius/4))location.hash=Cesium.Hash.encode(viewer)})}else{Cesium.Hash(viewer)}</script></body></html>
Enter fullscreen modeExit fullscreen mode

See Also

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Keep web maps open for a better world.
  • Location
    Tsukuba, Japan
  • Pronouns
    he/him
  • Work
    UN Open GIS Initiative Smart Maps DWG Lead
  • Joined

More fromHidenori FUJIMURA

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp