コンテンツにスキップ

Add an atmosphere on the world

Basic sample for adding atmospheric representation to the virtual Earth

basic_atmosphere.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Add an atmosphere on the world</title>
  <meta property="og:description" content="Basic sample for adding atmospheric representation to the virtual Earth" />
  <script src="./v0.10.1/mapray.min.js"></script>
  <script src="./v0.10.1/maprayui.min.js"></script>
  <link rel="stylesheet" href="./v0.10.1/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>
  const cloudApi = new mapray.cloud.CloudApiV2({
        tokenType: mapray.cloud.CloudApi.TokenType.ACCESS_TOKEN,
        token: "<YOUR_MAPRAY_ACCESS_TOKEN>"
    });

    const uiviewer = new maprayui.StandardUIViewer( "mapray-container", {
        dem_provider: new mapray.StandardDemProvider( cloudApi.getDefaultDemAsResource() ),
        atmosphere: new mapray.Atmosphere()
    } );

  uiviewer.setCameraPosition({
    longitude: 137.693861815529,
    latitude: 36.30821404038031,
    height: 3300
  });

  uiviewer.setLookAtPosition({
    longitude: 137.65906432922944,
    latitude:  36.294572127536995,
    height: 2800
  });

  uiviewer.viewer.atmosphere.setRayleigh(0.003);
  uiviewer.viewer.atmosphere.setMie(0.001);


</script>

Info

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