Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

cesiumでgeojson

More than 3 years have passed since last update.

概要

cesiumでgeojsonやってみた。

写真

image.png

サンプルコード

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.camera.flyTo({
    destination: Cesium.Cartesian3.fromDegrees(140.0 + 0.4, 38.0 - 1.0, 100000.0),
    orientation: {
        heading: Cesium.Math.toRadians(-20.0),
        pitch: Cesium.Math.toRadians(-35.0),
        roll: 0.0
    }
});
var line = {
    "type": "Feature",
    "properties": { 
        "line": "on" 
    },
    "geometry": {
        "type": "LineString",
        "coordinates": [[140.0, 38.0], [140.5, 38.0], [140.5, 38.5], [140.0, 38.0]]
    }
};
var json = JSON.stringify(line); 
var url = URL.createObjectURL(new Blob([json]));
viewer.dataSources.add(Cesium.GeoJsonDataSource.load(url, {
    fill: new Cesium.Color(0, 0, 1, 0.9)
}));



成果物

http://jsdo.it/ohisama1/A2Yj

以上。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away