コンテンツにスキップ

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="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>
  var apikey= "<YOUR_MAPRAY_API_KEY>";
  const uiviewer = new maprayui.StandardUIViewer( "mapray-container", apikey, {
    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_API_KEY>を、あなたのMapray CloudアカウントのAPI Keyに置き換えるまで、期待通りに動作しません。