0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

#概要
cesiumでgooglemap連動してみた。

#写真
image.png

#サンプルコード

var viewer = new Cesium.Viewer('cmap');
var map;
viewer.canvas.addEventListener('click', function(e) {
    var mousePosition = new Cesium.Cartesian2(e.clientX, e.clientY); 
    var ellipsoid = viewer.scene.globe.ellipsoid;
    var cartesian = viewer.camera.pickEllipsoid(mousePosition, ellipsoid);
    if (cartesian) 
    {
        var cartographic = ellipsoid.cartesianToCartographic(cartesian);
        var lon = Cesium.Math.toDegrees(cartographic.longitude).toFixed(6);
        var lat = Cesium.Math.toDegrees(cartographic.latitude).toFixed(6); 
        pano(lat, lon);
    }
    else
    {
        alert('Globe was not picked');
    }	
}, false);
viewer.camera.flyTo({
    destination: Cesium.Cartesian3.fromDegrees(139.60, 35.60, 100000.0),
});
function pano(lat, lon) {
    var koko = new google.maps.LatLng(lat, lon);
	map = new google.maps.Map(document.getElementById('gmap'), {
        center: koko,
        zoom: 8
    });
}

#成果物
http://jsdo.it/ohisama1/QUou

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?