当前位置: 首页 > news >正文

CesiumJS 案例 P7:添加指定长宽的图片图层(原点分别为图片图层的中心点、左上角顶点、右上角顶点、左下角顶点、右下角顶点)

CesiumJS

  • CesiumJS API:https://cesium.com/learn/cesiumjs/ref-doc/index.html

  • CesiumJS 是一个开源的 JavaScript 库,它用于在网页中创建和控制 3D 地球仪(地图)


一、添加指定长宽的图片图层(原点为图片图层的中心点)

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>ImageryProvider - 添加指定长宽的图片图层(原点为图片图层的中心点)</title><link rel="stylesheet" href="../js/Cesium-1.112/Build/Cesium/Widgets/widgets.css" /><style>* {margin: 0;padding: 0;box-sizing: border-box;}html,body {width: 100%;height: 100%;}.container {width: 100%;height: 100%;}</style></head><body><div id="container"></div></body><script src="../js/Cesium-1.112/Build/Cesium/Cesium.js"></script><script>const viewer = new Cesium.Viewer("container");// 图片图层的长宽const imageWidth = 200; // 单位为米const imageHeight = 100; // 单位为米// 图片图层的原点const originLongitude = 0; // 原点经度const originLatitude = 0; // 原点纬度// 在赤道上,每度大约对应 111,320 米const degreesPerMeterAtEquator = 111320;const longitudeRange = imageWidth / degreesPerMeterAtEquator;const latitudeRange = imageHeight / degreesPerMeterAtEquator;const west = originLongitude - longitudeRange / 2; // 西经(西经为负)const south = originLatitude - latitudeRange / 2; // 南纬(南纬为负)const east = originLongitude + longitudeRange / 2; // 东经(东经为正)const north = originLatitude + latitudeRange / 2; // 北纬(北纬为正)// 创建图片图层const imageryProvider = new Cesium.SingleTileImageryProvider({url: "../img/test.jpg",rectangle: Cesium.Rectangle.fromDegrees(west, south, east, north),});viewer.imageryLayers.addImageryProvider(imageryProvider);// 添加一个点表示原点const entity = viewer.entities.add({position: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude),point: {pixelSize: 5,color: new Cesium.Color(0, 1, 0, 1),},});// 调整相机视角以查看图片viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude, 1000.0),duration: 2.0,});</script>
</html>

二、添加指定长宽的图片图层(原点为图片图层的左上角顶点)

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>ImageryProvider - 添加指定长宽的图片图层(原点为图片图层的左上角顶点)</title><link rel="stylesheet" href="../js/Cesium-1.112/Build/Cesium/Widgets/widgets.css" /><style>* {margin: 0;padding: 0;box-sizing: border-box;}html,body {width: 100%;height: 100%;}.container {width: 100%;height: 100%;}</style></head><body><div id="container"></div></body><script src="../js/Cesium-1.112/Build/Cesium/Cesium.js"></script><script>const viewer = new Cesium.Viewer("container");// 图片图层的长宽const imageWidth = 200; // 单位为米const imageHeight = 100; // 单位为米// 图片图层的原点const originLongitude = 0; // 原点经度const originLatitude = 0; // 原点纬度// 在赤道上,每度大约对应 111,320 米const degreesPerMeterAtEquator = 111320;const longitudeRange = imageWidth / degreesPerMeterAtEquator;const latitudeRange = imageHeight / degreesPerMeterAtEquator;const west = originLongitude; // 西经(西经为负)const south = originLatitude - latitudeRange; // 南纬(南纬为负)const east = originLongitude + longitudeRange; // 东经(东经为正)const north = originLatitude; // 北纬(北纬为正)// 创建图片图层const imageryProvider = new Cesium.SingleTileImageryProvider({url: "../img/test.jpg",rectangle: Cesium.Rectangle.fromDegrees(west, south, east, north),});viewer.imageryLayers.addImageryProvider(imageryProvider);// 添加一个点表示原点const entity = viewer.entities.add({position: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude),point: {pixelSize: 5,color: new Cesium.Color(0, 1, 0, 1),},});// 调整相机视角以查看图片viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude, 1000.0),duration: 2.0,});</script>
</html>

三、添加指定长宽的图片图层(原点为图片图层的右上角顶点)

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>ImageryProvider - 添加指定长宽的图片图层(原点为图片图层的右上角顶点)</title><link rel="stylesheet" href="../js/Cesium-1.112/Build/Cesium/Widgets/widgets.css" /><style>* {margin: 0;padding: 0;box-sizing: border-box;}html,body {width: 100%;height: 100%;}.container {width: 100%;height: 100%;}</style></head><body><div id="container"></div></body><script src="../js/Cesium-1.112/Build/Cesium/Cesium.js"></script><script>const viewer = new Cesium.Viewer("container");// 图片图层的长宽const imageWidth = 200; // 单位为米const imageHeight = 100; // 单位为米// 图片图层的原点const originLongitude = 0; // 原点经度const originLatitude = 0; // 原点纬度// 在赤道上,每度大约对应 111,320 米const degreesPerMeterAtEquator = 111320;const longitudeRange = imageWidth / degreesPerMeterAtEquator;const latitudeRange = imageHeight / degreesPerMeterAtEquator;const west = originLongitude - longitudeRange; // 西经(西经为负)const south = originLatitude - latitudeRange; // 南纬(南纬为负)const east = originLongitude; // 东经(东经为正)const north = originLatitude; // 北纬(北纬为正)// 创建图片图层const imageryProvider = new Cesium.SingleTileImageryProvider({url: "../img/test.jpg",rectangle: Cesium.Rectangle.fromDegrees(west, south, east, north),});viewer.imageryLayers.addImageryProvider(imageryProvider);// 添加一个点表示原点const entity = viewer.entities.add({position: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude),point: {pixelSize: 5,color: new Cesium.Color(0, 1, 0, 1),},});// 调整相机视角以查看图片viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude, 1000.0),duration: 2.0,});</script>
</html>

四、添加指定长宽的图片图层(原点为图片图层的左下角顶点)

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>ImageryProvider - 添加指定长宽的图片图层(原点为图片图层的左下角顶点)</title><link rel="stylesheet" href="../js/Cesium-1.112/Build/Cesium/Widgets/widgets.css" /><style>* {margin: 0;padding: 0;box-sizing: border-box;}html,body {width: 100%;height: 100%;}.container {width: 100%;height: 100%;}</style></head><body><div id="container"></div></body><script src="../js/Cesium-1.112/Build/Cesium/Cesium.js"></script><script>const viewer = new Cesium.Viewer("container");// 图片图层的长宽const imageWidth = 200; // 单位为米const imageHeight = 100; // 单位为米// 图片图层的原点const originLongitude = 0; // 原点经度const originLatitude = 0; // 原点纬度// 在赤道上,每度大约对应 111,320 米const degreesPerMeterAtEquator = 111320;const longitudeRange = imageWidth / degreesPerMeterAtEquator;const latitudeRange = imageHeight / degreesPerMeterAtEquator;const west = originLongitude; // 西经(西经为负)const south = originLatitude; // 南纬(南纬为负)const east = originLongitude + longitudeRange; // 东经(东经为正)const north = originLatitude + latitudeRange; // 北纬(北纬为正)// 创建图片图层const imageryProvider = new Cesium.SingleTileImageryProvider({url: "../img/test.jpg",rectangle: Cesium.Rectangle.fromDegrees(west, south, east, north),});viewer.imageryLayers.addImageryProvider(imageryProvider);// 添加一个点表示原点const entity = viewer.entities.add({position: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude),point: {pixelSize: 5,color: new Cesium.Color(0, 1, 0, 1),},});// 调整相机视角以查看图片viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude, 1000.0),duration: 2.0,});</script>
</html>

五、添加指定长宽的图片图层(原点为图片图层的右下角顶点)

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>ImageryProvider - 添加指定长宽的图片图层(原点为图片图层的右下角顶点)</title><link rel="stylesheet" href="../js/Cesium-1.112/Build/Cesium/Widgets/widgets.css" /><style>* {margin: 0;padding: 0;box-sizing: border-box;}html,body {width: 100%;height: 100%;}.container {width: 100%;height: 100%;}</style></head><body><div id="container"></div></body><script src="../js/Cesium-1.112/Build/Cesium/Cesium.js"></script><script>const viewer = new Cesium.Viewer("container");// 图片图层的长宽const imageWidth = 200; // 单位为米const imageHeight = 100; // 单位为米// 图片图层的原点const originLongitude = 0; // 原点经度const originLatitude = 0; // 原点纬度// 在赤道上,每度大约对应 111,320 米const degreesPerMeterAtEquator = 111320;const longitudeRange = imageWidth / degreesPerMeterAtEquator;const latitudeRange = imageHeight / degreesPerMeterAtEquator;const west = originLongitude - longitudeRange; // 西经(西经为负)const south = originLatitude; // 南纬(南纬为负)const east = originLongitude; // 东经(东经为正)const north = originLatitude + latitudeRange; // 北纬(北纬为正)// 创建图片图层const imageryProvider = new Cesium.SingleTileImageryProvider({url: "../img/test.jpg",rectangle: Cesium.Rectangle.fromDegrees(west, south, east, north),});viewer.imageryLayers.addImageryProvider(imageryProvider);// 添加一个点表示原点const entity = viewer.entities.add({position: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude),point: {pixelSize: 5,color: new Cesium.Color(0, 1, 0, 1),},});// 调整相机视角以查看图片viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(originLongitude, originLatitude, 1000.0),duration: 2.0,});</script>
</html>

相关文章:

CesiumJS 案例 P7:添加指定长宽的图片图层(原点分别为图片图层的中心点、左上角顶点、右上角顶点、左下角顶点、右下角顶点)

CesiumJS CesiumJS API&#xff1a;https://cesium.com/learn/cesiumjs/ref-doc/index.html CesiumJS 是一个开源的 JavaScript 库&#xff0c;它用于在网页中创建和控制 3D 地球仪&#xff08;地图&#xff09; 一、添加指定长宽的图片图层&#xff08;原点为图片图层的中心…...

Redis 主从同步 问题

前言 相关系列 《Redis & 目录》&#xff08;持续更新&#xff09;《Redis & 主从同步 & 源码》&#xff08;学习过程/多有漏误/仅作参考/不再更新&#xff09;《Redis & 主从同步 & 总结》&#xff08;学习总结/最新最准/持续更新&#xff09;《Redis &a…...

【SQL Server】探讨 IN 和 EXISTS之间的区别

前言 在使用 SQL 查询相关表数据时,通常需要根据另一个表中的值来筛选数据。而 IN 与 EXISTS 子句都是用于此场景的常用方式,但使用时两者存在工作方式不同。它们使用上的选择会显著影响查询的性能,尤其是在大型数据集中。本文我们一起探讨 IN 和 EXISTS 之间的区别、使用与…...

清理pip和conda缓存

当用户目录没有空间时&#xff0c;可清理pip和conda缓存 清理conda缓存&#xff1a; conda clean --all清理pip缓存&#xff1a; pip cache purgeNote&#xff1a; 可以利用软链接&#xff0c;将用户目录下的文件链接到其他位置 首先移动文件或文件夹到其他位置 mv ~/test /…...

git rebase和merge的区别

Git merge和Git rebase是两种不同的合并策略&#xff0c;它们在处理分支合并时有各自的优点和缺点。 Git fetch git fetch 命令用于从远程仓库获取最新的更改&#xff0c;但不会自动合并这些更改到你的本地分支。它会下载远程仓库的所有分支和标签&#xff0c;并更新你的本地…...

【elkb】linux麒麟v10安装ELKB 8.8.X版本(ARM架构)

下载软件 相关版本信息 elasticsearch&#xff1a;8.8.1kibana&#xff1a;8.8.1logstash&#xff1a;8.8.1filebeat&#xff1a;8.8.1 下载地址 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.8.1-linux-aarch64.tar.gzhttps://artifacts.elastic…...

bluez hid host介绍,连接键盘/鼠标/手柄不是梦,安排

零. 前言 由于Bluez的介绍文档有限,以及对Linux 系统/驱动概念、D-Bus 通信和蓝牙协议都有要求,加上网络上其实没有一个完整的介绍Bluez系列的文档,所以不管是蓝牙初学者还是蓝牙从业人员,都有不小的难度,学习曲线也相对较陡,所以我有了这个想法,专门对Bluez做一个系统…...

GPT打数模——电商品类货量预测及品类分仓规划

背景 电商企业在各区域的商品存储主要由多个仓库组成的仓群承担。其中存储的商品主要按照属性&#xff08;品类、件型等&#xff09;进行划分和打标&#xff0c;便于进行库存管理。图 1 是一个简化的示意图&#xff0c;商品品类各异&#xff0c;件数众多&#xff0c;必须将这些…...

华为OD机试 - 螺旋数字矩阵 - 矩阵(Python/JS/C/C++ 2024 D卷 100分)

华为OD机试 2024E卷题库疯狂收录中&#xff0c;刷题点这里 专栏导读 本专栏收录于《华为OD机试真题&#xff08;Python/JS/C/C&#xff09;》。 刷的越多&#xff0c;抽中的概率越大&#xff0c;私信哪吒&#xff0c;备注华为OD&#xff0c;加入华为OD刷题交流群&#xff0c;…...

分类预测 | GCN图卷积神经网络多特征分类预测(MATLAB)

分类预测 | GCN图卷积神经网络多特征分类预测(MATLAB) 目录 分类预测 | GCN图卷积神经网络多特征分类预测(MATLAB)分类效果基本介绍程序设计参考资料分类效果 基本介绍 GCN图卷积神经网络多特征分类预测(MATLAB) 在图卷积神经网络(GCN)中,多特征分类...

FPGA搭建PCIE3.0通信架构简单读写测试,基于XDMA中断模式,提供3套工程源码和技术支持

目录 1、前言工程概述免责声明 2、相关方案推荐我已有的PCIE方案本博客方案的PCIE2.0版本 3、PCIE基础知识4、工程详细设计方案工程设计原理框图XDMA配置及使用XDMA中断模块数据缓存架构用户逻辑Windows版本XDMA驱动安装Linux版本XDMA驱动安装测试应用程序工程源码架构PCIE上板…...

App相关技术以及打包

平时小伙伴们自己的博客网站只能在浏览器打开&#xff0c;但是有时候你想要制作自己独立个人博客app&#xff0c;宣传并推广自己的app&#xff0c;打造个人ip。如何把自己的web博客网站打包成安卓app&#xff1f; 1.开发App的相关技术使⽤ ⽬前市⾯上的移动互联开发技术主要分…...

【unity】【游戏开发】Unity代码不给提示怎么办?

【现象】 Unity用着用着忽然VS脚本不给提示了。 【分析】 重启Unity无效 重启VS无效 重装VS无效 感觉应该是项目设置问题 【最终方法】 打开Edit->Preferences。 如果是这个画面就把Script Editor改成自己的VS编辑器。 变成下面这个样子&#xff0c;点击Regenerate Pr…...

Kubernetes固定Pod IP和Mac地址

方案1&#xff1a; 在 Calico GitHub Issues#5196 问题的 commits#6249 提交中&#xff0c;引入新的 Pod 注释cni.projectcalico.org/hwAddr&#xff0c;用于将指定的 MAC 地址分配给容器端 Veth 接口。 将Calico升级至v3.24.1或以上版本&#xff0c;使用如下注解轻松设置Pod…...

计算机组成原理之数据的对齐和大/小端存放方式、计算机中数据对齐的具体方式有哪些

1、计算机组成原理之数据的对齐和大/小端存放方式 数据对齐 数据对齐是处理器为了提高处理性能而对存取数据的起始地址所提出的一种要求。 系统一次性读取内存中数据的大小是固定的&#xff0c;例如字长为32位的操作系统&#xff0c;默认的一次读取4字节内容。因此&#xff…...

【学术论文投稿】Windows11开发指南:打造卓越应用的必备攻略

【IEEE出版南方科技大学】第十一届电气工程与自动化国际会议&#xff08;IFEEA 2024)_艾思科蓝_学术一站式服务平台 更多学术会议论文投稿请看&#xff1a;https://ais.cn/u/nuyAF3 目录 引言 一、Windows11开发环境搭建 二、Windows11关键新特性 三、Windows11设计指南 …...

【毕业论文+源码】基于SSM(Spring + Spring MVC + MyBatis)的房屋租赁系统

创建一个基于SSM&#xff08;Spring Spring MVC MyBatis&#xff09;框架的房屋租赁系统是一个涉及多个步骤的过程。这个过程包括但不限于需求分析、数据库设计、前端界面设计以及后端逻辑实现等。 1. 需求分析 首先&#xff0c;明确你的房屋租赁系统的功能需求。例如&…...

【golang】解析 JSON到指定结构体

1.解析[1,2,3,4]数组类型的json package mainimport ("encoding/json""fmt" )func main() {// JSON 数据jsonData : [1, 2, 3, 4]// 定义一个切片来接收解析后的数据var numbers []int// 解析 JSON 数据到切片err : json.Unmarshal([]byte(jsonData), &am…...

设计模式——过滤器模式

一、定义和概念 定义 C 过滤器模式&#xff08;Filter Pattern&#xff09;也称为标准模式&#xff08;Criteria Pattern&#xff09;&#xff0c;是一种设计模式&#xff0c;用于根据不同的标准或条件从一组对象中筛选出符合条件的对象。它将筛选条件的逻辑封装在不同的过滤器…...

Unity(四十八):Unity与Web双向交互

效果 游戏对象绑定脚本 游戏脚本源码 using System.Collections; using System.Collections.Generic; using UnityEngine;public class Tent : MonoBehaviour {public Camera camera;// Start is called before the first frame updatevoid Start(){}// Update is called once…...

SSRF漏洞实战:用Pikachu靶场玩转curl_exec和file_get_contents攻击链

SSRF漏洞攻防实战&#xff1a;从Pikachu靶场到企业级防御体系 当你在浏览器地址栏输入?urlfile:///etc/passwd并成功读取系统文件时&#xff0c;服务器就像一位过于热心的管家&#xff0c;将保险柜钥匙交给了陌生人。这就是SSRF&#xff08;Server-Side Request Forgery&#…...

如何使用 GitHub Actions + image-syncer 实现 Docker Hub 到 Azure ACR 的自动化镜像同步

背景/引言 HagiCode 项目使用 Docker 镜像作为核心运行时组件&#xff0c;主要镜像托管在 Docker Hub。随着项目发展和 Azure 环境部署需求的增加&#xff0c;我们遇到了以下痛点&#xff1a; 镜像拉取速度慢&#xff0c;Docker Hub 在国内及部分 Azure 区域访问受限依赖单一…...

HunyuanVideo-Foley部署指南:多用户隔离WebUI会话与资源配额设置

HunyuanVideo-Foley部署指南&#xff1a;多用户隔离WebUI会话与资源配额设置 1. 镜像概述与核心功能 HunyuanVideo-Foley是一款专为视频生成与音效生成任务优化的私有部署镜像&#xff0c;基于RTX 4090D 24GB显存显卡和CUDA 12.4深度优化。这个镜像开箱即用&#xff0c;内置完…...

FLUX.1-dev实战案例:像素幻梦工坊生成高清16-bit游戏素材全流程

FLUX.1-dev实战案例&#xff1a;像素幻梦工坊生成高清16-bit游戏素材全流程 1. 像素幻梦工坊简介 像素幻梦工坊&#xff08;Pixel Dream Workshop&#xff09;是一款基于FLUX.1-dev扩散模型的像素艺术生成工具。它采用明亮的16-bit像素风格设计&#xff0c;为游戏开发者和数字…...

洛阳万达商场美团快闪店设计,凭什么成为商圈流量密码?肆墨设计

在商业美陈从 “装饰载体” 向 “生活场景容器” 转型的当下&#xff0c;洛阳万达商场美团 “美事发生” 美好生活集市快闪店&#xff0c;以品牌 IP 为核心锚点&#xff0c;融合女性消费心理与地域商业特质&#xff0c;构建了一场兼具视觉冲击力、情感共鸣与商业转化的沉浸式空…...

API网关选型指南:从Nginx到Kong的5个关键决策点(含实战代码)

API网关选型指南&#xff1a;从Nginx到Kong的5个关键决策点&#xff08;含实战代码&#xff09; 在数字化转型浪潮中&#xff0c;API作为系统间通信的桥梁&#xff0c;其管理效率直接影响业务敏捷性。当团队面临每秒数千次API调用时&#xff0c;选择合适的网关技术栈往往成为架…...

别再让漏洞扫描报警了!手把手教你给老旧Linux服务器升级OpenSSH和OpenSSL(附systemd服务修复秘籍)

企业级Linux服务器安全加固实战&#xff1a;OpenSSH与OpenSSL深度升级指南 凌晨三点&#xff0c;刺耳的安全告警声再次划破运维中心的宁静——漏洞扫描报告上醒目的红色标记显示&#xff1a;OpenSSH 7.4存在CVE-2023-38408高危漏洞。这不是演习&#xff0c;而是每位运维工程师都…...

别再只改max_clients了!CentOS 7上vsftpd 3.0.2并发性能实战调优(附Java压测代码)

CentOS 7下vsftpd 3.0.2高并发调优实战&#xff1a;突破传统认知的性能优化指南 在Linux服务器运维领域&#xff0c;FTP服务的高并发性能优化一直是个被低估的技术难点。许多工程师习惯性地将注意力集中在max_clients和max_per_ip这两个显性参数上&#xff0c;却忽略了那些真正…...

2026年AI Agent崛起:从知识库到智慧助手,收藏这份程序员必看指南!

2026年&#xff0c;AI智能体将大规模部署&#xff0c;成为企业数字化核心。与传统AI知识库不同&#xff0c;智能体具备规划、执行、反思和记忆能力&#xff0c;能自主完成任务。核心应用包括跨系统自动化、智能客服、IT运维等。企业需关注多智能体协同、与RPA融合、开放协议及人…...

清音刻墨·Qwen3在新闻媒体中的应用:直播回放自动字幕生成时效性测试

清音刻墨Qwen3在新闻媒体中的应用&#xff1a;直播回放自动字幕生成时效性测试 1. 引言&#xff1a;当新闻直播遇上AI字幕 想象一下这个场景&#xff1a;一场重要的新闻发布会刚刚结束&#xff0c;编辑团队需要在半小时内将完整的直播回放配上精准的字幕&#xff0c;发布到各…...