コンテンツにスキップ

Display 3D Buildings on the earth

Using the B3dTiles format converted from PLATEAU LOD3.

display_3d_building.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Display 3D Buildings on the earth</title>
  <meta property="og:description" content="Using the B3dTiles format converted from PLATEAU LOD3." />
  <script src="https://resource.mapray.com/mapray-js/v0.9.6/mapray.min.js"></script>
  <script src="https://resource.mapray.com/ui/v0.9.6/maprayui.min.js"></script>
  <link rel="stylesheet" href="https://resource.mapray.com/styles/v1/mapray.css">
  <style>
    body {margin: 0; padding: 0;}
    html, body, div#mapray-container { height: 100%; }
  </style>
</head>

<body>
<div id="mapray-container"></div>
</body>
</html>

<script>
  // Set up your access token, which can be created in Mapray Cloud.
  const apikey = "<YOUR_MAPRAY_API_KEY>";

  // The StandardUIView in the ui package includes mouse-based camera manipulation.
  const uiviewer = new maprayui.StandardUIViewer( "mapray-container", apikey, {
    atmosphere: new mapray.Atmosphere()
  } );

  // Shinbashi Station in Tokyo JP,
  uiviewer.setCameraPosition({
    longitude: 138.863329,
    latitude: 35.098357,
    height: 100
  });

  // Tokyo Tower
  uiviewer.setLookAtPosition({
    longitude: 138.860898,
    latitude: 35.103137,
    height: 100
  });

  const provider = new mapray.StandardB3dProvider( "https://opentiles.mapray.com/3dcity/numazu/", ".bin" );
  uiviewer.viewer.b3d_collection.createScene(provider);
</script>

Info

このサンプルコードは、<YOUR_MAPRAY_API_KEY>を、あなたのMapray CloudアカウントのAPI Keyに置き換えるまで、期待通りに動作しません。