惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Engineering at Meta
Engineering at Meta
腾讯CDC
宝玉的分享
宝玉的分享
H
Help Net Security
I
InfoQ
博客园 - Franky
The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
博客园_首页
美团技术团队
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
The Cloudflare Blog
博客园 - 司徒正美
Vercel News
Vercel News
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
月光博客
月光博客

博客园 - zhh

Cesium 河道形状 Cesium 实现 FlowMap Unity3D c# 使对象物体始终面向摄像机 Cesium For Unity Convert WGS84 to Earth Centered Earth Fixed 小流域设计洪水计算 cesium自定义st TerrainProviderEdit Redis Server监控数据采集 cesium添加过道corridor Cesium:entity闪烁(点、面以及billboard) arcgis 3.x 打印 CAS Client集群环境的Session问题及解决方案 不能退出登录 Client Server集群模式下session问题[转] quartz数据不完整导致不调度并且报错Couldn‘t store trigger arcgis popup关闭事件 arcgis 叠加图片 watch 三维地图3DGIS平台技术指标要求规划 Java – Get All Dates Between Two Dates 太阳方位角
arcgis 叠加图片
zhh · 2021-11-09 · via 博客园 - zhh
<html>
    <head>
    <meta charset = "utf-8" / >
    <meta name = "viewport"
content = "initial-scale=1,maximum-scale=1,user-scalable=no" />
    <title> Intro to MapView - Create a 2 D map - 4.15 title > 
    <style>
    html,
    body, #viewDiv {
        padding: 0;
        margin: 0;
        height: 100 % ;
        width: 100 % ;
    }

    .mystyle {
        position: absolute;
        top: 937 px;
        left: 0 px;
        width: 1920 px;
        height: 937 px;
    }

    </style>
    <link rel = "stylesheet"
href = "http://localhost/4.15/esri/themes/light/main.css" / >
    <script src = "http://localhost/4.15/init.js" > < /script > 
    <script >
    require(['esri/Map', 'esri/views/MapView', 'esri/core/watchUtils'], function (Map, MapView, watchUtils) {
        var map = new Map({
                basemap: 'osm',
            }

        );
        var view = new MapView({
            container: 'viewDiv',
            map: map,

            zoom: 7,
            center: [104.071883, 30.664022],
            // longitude, latitude             
        });

        let extent = {
            xmin: 10138549.59667821,
            ymin: 3449716.2722409572,
            xmax: 10249869.087471481,
            ymax: 3578363.913808475,
        };
        var resultDom;
        view.when(
            function () {
                //添加图片         
                var selectDom = document.getElementsByClassName('esri-view-surface esri-view-surface--inset-outline esri-view-surface--touch-none', );
                console.log(extent);
                resultDom = document.createElement('img');
                resultDom.src = './testquickviewphoto.png';
                resultDom.className = 'mystyle';
                resultDom.id = 'mystyle';
                selectDom[0].appendChild(resultDom);
            });
        var absd = view.zoom;
        watchUtils.when(view, 'extent', function () {
            if (view.extent && document.getElementById('mystyle')) {
                var lefttop = {
                    x: extent.xmin,
                    y: extent.ymax,
                    spatialReference: {
                        wkid: 102100,
                    },
                };
                var screen_lefttop = view.toScreen(lefttop);
                document.getElementById('mystyle').style.top = screen_lefttop.y + 'px';
                document.getElementById('mystyle').style.left = screen_lefttop.x + 'px';
                //zoom未改变的情况下不重新计算image长和宽                  
                if (absd != view.zoom) {
                    var rightbottom = {
                        x: extent.xmax,
                        y: extent.ymin,

                        spatialReference: {
                            wkid: 102100,
                        },
                    };
                    var screen_rightbottom = view.toScreen(rightbottom);
                    document.getElementById('mystyle').style.width = screen_rightbottom.x - screen_lefttop.x + 'px';
                    document.getElementById('mystyle').style.height = screen_rightbottom.y - screen_lefttop.y + 'px';
                }
            }
        });
        setTimeout(reloadPhoto, 500);

        function reloadPhoto() {
            //console.log(extent.xmax)           
            //左下角           
            var leftbottom = {
                x: extent.xmin,
                y: extent.ymin,
                spatialReference: {
                    wkid: 102100,
                },
            };
            var screen_leftbottom = view.toScreen(leftbottom);
            //右上角 
            var righttop = {
                x: extent.xmax,
                y: extent.ymax,
                spatialReference: {
                    wkid: 102100,
                },
            };
            var screen_righttop = view.toScreen(righttop);
            document.getElementById('mystyle').style.top = screen_righttop.y + 'px';
            document.getElementById('mystyle').style.left = screen_leftbottom.x + 'px';
            document.getElementById('mystyle').style.width = Math.abs(screen_righttop.x - screen_leftbottom.x) + 'px';
            document.getElementById('mystyle').style.height = Math.abs(screen_righttop.y - screen_leftbottom.y) + 'px';
        }
    }); 
    </script>     
    </head >  
    <body>
    <div id = "viewDiv" > </div>    
    </body> 
    </html>