<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>南山无物</title>
        <link>http://www.supony.top//</link>
        <description>这是一个由NotionNext生成的站点</description>
        <lastBuildDate>Sun, 20 Jul 2025 12:02:35 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2025, 南山无物</copyright>
        <item>
            <title><![CDATA[GeoSOT网格编码]]></title>
            <link>http://www.supony.top//article/tools/geosot</link>
            <guid>http://www.supony.top//article/tools/geosot</guid>
            <pubDate>Fri, 04 Jul 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[GeoSOT 是基于2ⁿ一维整型数组的全球经纬剖分网格，其相关标准为《GB/T 40087-2021地球空间网格编码规则》。GitHub开源库catnuko/geosot的使用方法，包括经纬度与二进制/四进制编码的转换、三维编码处理及网格操作等功能。该库实现了标准文件中的编码解码规则，支持从二维到三维空间的网格编码转换，适用于地图绘制、地理信息系统（GIS）等领域的数据组织与管理。]]></description>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-235c8507ccbc80b0976af5de0525453a"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-235c8507ccbc81afbe59fe8ce35924d8" data-id="235c8507ccbc81afbe59fe8ce35924d8"><span><div id="235c8507ccbc81afbe59fe8ce35924d8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81afbe59fe8ce35924d8" title="GeoSOT网格编码教程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">GeoSOT网格编码教程</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-235c8507ccbc813c99b2dcbbbc46ac00" data-id="235c8507ccbc813c99b2dcbbbc46ac00"><span><div id="235c8507ccbc813c99b2dcbbbc46ac00" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc813c99b2dcbbbc46ac00" title="一、网格编码和GeoSOT基本概念及重要性"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">一、网格编码和GeoSOT基本概念及重要性</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81d3b1c6f7d41f40d2ce" data-id="235c8507ccbc81d3b1c6f7d41f40d2ce"><span><div id="235c8507ccbc81d3b1c6f7d41f40d2ce" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81d3b1c6f7d41f40d2ce" title="网格编码基础信息"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">网格编码基础信息</span></span></h4><div class="notion-text notion-block-235c8507ccbc818a8ad4eacd4d6bcb0e">网格编码是按照一定规则，对地球空间网格赋予代码标识，可实现对地理空间的数字化表达和管理。不同的网格编码系统适用于不同的应用场景，以满足多样化的地理信息处理需求。相关标准文件如《GB/T 40087 - 2021地球空间网格编码规则》规定了地球空间网格剖分要求和编码方法，适用于作为空间单元与空间信息组织的地球空间网格剖分和代码标识；《社会治理网格划分和编码规则》规定了社会治理网格的术语和定义、网格划分原则、网格编码原则、网格编码规则等内容，适用于城乡网格化服务与治理中单元网格的划分与编码。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81bd9326c4edb4f4f824" data-id="235c8507ccbc81bd9326c4edb4f4f824"><span><div id="235c8507ccbc81bd9326c4edb4f4f824" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81bd9326c4edb4f4f824" title="GeoSOT基础信息"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">GeoSOT基础信息</span></span></h4><div class="notion-text notion-block-235c8507ccbc8132a087fae51d287589">GeoSOT全称为Geographic Coordinate Subdividing Grid with One Dimension Integral Coding on 2ⁿ - Tree，即基于2ⁿ一维整型数组全球经纬剖分网格。相关标准文件《GB/T 40087 - 2021地球空间网格编码规则》基于GeoSOT地球剖分模型，将地球空间统一剖分成不同尺度的网格单元，并按统一编码规则进行标识和表达，构建了网格化的地球空间数据组织参考框架。</div><div class="notion-text notion-block-235c8507ccbc81af92ced4c967db766f">GeoSOT网格通过地球表面经纬度范围空间经过3次空间扩展（将地球地理空间扩展为512°、将1°扩展为64′、将1′扩展为64″），实现了整度、整分的整型四叉树剖分网格。具体包括度级剖分网格（0 - 9级）、分级剖分网格（10 - 15级）和秒级剖分网格（16 - 21级），秒以下22 - 32级网格严格按照四分方法进行剖分和编码。其具有可标识性、层次性、聚合性和关联性等特点，可实现层次之间的有机关联，为地图多尺度表达提供基础。该网格与国家标准图幅很好地聚合和关联，能够方便地与现在主要的多种类型数据进行转换，有利于多源数据的兼容以及跨部门、跨系统之间的空间数据的整合和共享。</div><div class="notion-text notion-block-235c8507ccbc81ee9f5aeefcc0915cb1">GeoSOT网格编码采用64位编码对各级剖分网格进行标识，最长的编码位为32位四进制数值编码。第1 - 9位是度级网格编码，第10 - 15位是分级网格编码，第16 - 21位是秒级网格编码，第22 - 32位是秒以下网格编码。其编码形式为“Gddddddddd - mmmmmm - ssssss.uuuuuuuuuuu”，其中d、m、s、u取值均为0、1、2、3。具体编码规则是，距赤道和本初子午线的交点最近的剖分网格为0，最远的为3，然后按照先沿纬线方向再沿经线方向对其他两个剖分网格分别为1和2。通过这种编码方式，实现对每个GeoSOT网格单元进行编码且该编码全球唯一，同时具有准确的地理空间含义。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-235c8507ccbc81409c94ff5c672b2314" data-id="235c8507ccbc81409c94ff5c672b2314"><span><div id="235c8507ccbc81409c94ff5c672b2314" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81409c94ff5c672b2314" title="二、经纬度、高度与网格编码之间的编码解码规则及转换规则"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">二、经纬度、高度与网格编码之间的编码解码规则及转换规则</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81de9ad7ef837cc8075d" data-id="235c8507ccbc81de9ad7ef837cc8075d"><span><div id="235c8507ccbc81de9ad7ef837cc8075d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81de9ad7ef837cc8075d" title="（一）网格剖分规则"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（一）网格剖分规则</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc815292d5e16bda419952" data-id="235c8507ccbc815292d5e16bda419952"><span><div id="235c8507ccbc815292d5e16bda419952" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc815292d5e16bda419952" title="1. 地球表面剖分"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 地球表面剖分</span></span></h4><div class="notion-text notion-block-235c8507ccbc8175b1e3d942552738b2">地球空间网格剖分从经度（L）、纬度（B）两个方向逐级递归二分，形成整度、整分、整秒的等经纬度网格。网格剖分在初始空间、1°、1’所对应的第0级、第9级和第15级上有三次扩展。
- <b>初始扩展</b>：将纬度从 - 90°~90°扩展为 - 256°~256°，将经度从 - 180°~180°扩展为 - 256°~256°，形成512°×512°的0级网格，0级网格用G标识。
- <b>1°扩展</b>：1级网格在0级网格基础上按等经差和纬差二分，每一级网格在上级网格基础上按等经差和纬差逐级递归二分。接近地球南极、北极时纬线长度急剧收缩，南纬和北纬88°~90°范围的8级和9级网格应合并。
- <b>1’扩展</b>：分网格剖分时将每一个经纬度为1°×1°（60’×60’，9级网格）的网格扩展成为64’×64’的网格。南纬和北纬0°~88°的10级至15级网格，在上级网格基础上继续剖分。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81faaab2e82ee3eaaf3f" data-id="235c8507ccbc81faaab2e82ee3eaaf3f"><span><div id="235c8507ccbc81faaab2e82ee3eaaf3f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81faaab2e82ee3eaaf3f" title="（二）编码规则"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（二）编码规则</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81358859e02728fc91dc" data-id="235c8507ccbc81358859e02728fc91dc"><span><div id="235c8507ccbc81358859e02728fc91dc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81358859e02728fc91dc" title="1. 编码长度和分段"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 编码长度和分段</span></span></h4><div class="notion-text notion-block-235c8507ccbc81b38128cec466f976a9">编码最长为32级，分为四段，分别是9位度网格编码、6位分网格编码、6位秒网格编码和11位秒以下网格编码，形式为：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-plain text">ddddddddd - mmmmmm - ssssss . uuuuuuuuuuu
9位度级编码 6位分级编码 6位秒级编码 11位秒级以下编码</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc8114bcafeaaef9789b41" data-id="235c8507ccbc8114bcafeaaef9789b41"><span><div id="235c8507ccbc8114bcafeaaef9789b41" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8114bcafeaaef9789b41" title="2. 编码顺序"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 编码顺序</span></span></h4><div class="notion-text notion-block-235c8507ccbc819ba82feb248f9c0861">采用Z序进行，1级网格按东北、西北、东南、西南的Z序进行编码，即G0网格对应地球表面空间区域位置是东北半球、G1网格对应西北半球、G2网格对应东南半球、G3网格对应西南半球。每一级网格编码在上一级网格编码基础上采用Z序继续编码。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc812d8e8df9db20f66b63" data-id="235c8507ccbc812d8e8df9db20f66b63"><span><div id="235c8507ccbc812d8e8df9db20f66b63" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc812d8e8df9db20f66b63" title="3. 编码示例"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. 编码示例</span></span></h4><div class="notion-text notion-block-235c8507ccbc814a80dcda7536c50925">以地球参考椭球面经纬度坐标(39°54’37.0″N,116°18’54.8″E)求6级别编码为例：
1. 东北半球：G0
2. 1级：纬度小于256，经度小于256 -&gt; 0
3. 2级：纬度小于128，经度小于128 -&gt; 00
4. 3级：纬度小于64，经度大于64 -&gt; 001
5. 4级：纬度大于32，经度大于96 -&gt; 00013
6. 5级：纬度小于48，经度大于112 -&gt; 00131
7. 6级：纬度小于40，经度小于120 -&gt; 001310
补上G0（东北半球）得到编码值G0001310。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc812e8693e9da043f85b5" data-id="235c8507ccbc812e8693e9da043f85b5"><span><div id="235c8507ccbc812e8693e9da043f85b5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc812e8693e9da043f85b5" title="（三）解码规则"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（三）解码规则</span></span></h4><div class="notion-text notion-block-235c8507ccbc81fb8fe3e94d68996df8">解码是编码的逆过程。给定一个GeoSOT编码，通过对编码中每一个字符进行解析，确定其对应的经纬度偏移量，最终通过累加这些偏移量，得到精确的地理位置坐标。例如，对于编码G0001310：
1. 6级
2. G0 -&gt; 东北半球
3. 1: 0，纬度 -&gt; [0,256] 经度 -&gt; [0,256]
4. 2: 00，纬度 -&gt; [0,128] 经度 -&gt; [0,128]
5. 3: 001，纬度 -&gt; [0,64] 经度 -&gt; [64,128]
6. 4: 0013，纬度 -&gt; [32,64] 经度 -&gt; [96,128]
7. 5: 00131，纬度 -&gt; [32,48] 经度 -&gt; [112,128]
8. 6: 001310，纬度 -&gt; [32,40] 经度 -&gt; [112,120]
G0001310 -&gt; 对应坐标在纬度3240，经度112120之间的区域。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc811a88a6f3c2bac53d22" data-id="235c8507ccbc811a88a6f3c2bac53d22"><span><div id="235c8507ccbc811a88a6f3c2bac53d22" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc811a88a6f3c2bac53d22" title="（四）附录中的转换规则"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（四）附录中的转换规则</span></span></h4><div class="notion-text notion-block-235c8507ccbc8146831bd063fe98109c">标准文件中有相关附录对转换规则进行说明，如附录D（资料性附录）提供了地球参考椭球面经纬度坐标到网格编码转换示例等内容。这些转换规则在实际应用中具有重要的作用，例如在地理信息系统中，能够方便地将经纬度坐标转换为网格编码，便于数据的存储和管理；在地图绘制中，能够根据网格编码准确地确定地理空间的位置，提高地图的精度和准确性。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-235c8507ccbc8186b530f8ce3a5e9bcd" data-id="235c8507ccbc8186b530f8ce3a5e9bcd"><span><div id="235c8507ccbc8186b530f8ce3a5e9bcd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8186b530f8ce3a5e9bcd" title="三、使用开源库实现标准文件中编码解码转换"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">三、使用开源库实现标准文件中编码解码转换</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc8193b3d4ea8d7fe3e58a" data-id="235c8507ccbc8193b3d4ea8d7fe3e58a"><span><div id="235c8507ccbc8193b3d4ea8d7fe3e58a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8193b3d4ea8d7fe3e58a" title="（一）核心函数介绍"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（一）核心函数介绍</span></span></h4><div class="notion-text notion-block-235c8507ccbc81d99ac6fc0d2ea662b9">根据开源库<code class="notion-inline-code">geosot.ts</code>文件的注释，以下是实现标准文件编码解码功能的核心函数：</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81ac8df7f3c34460c749" data-id="235c8507ccbc81ac8df7f3c34460c749"><span><div id="235c8507ccbc81ac8df7f3c34460c749" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81ac8df7f3c34460c749" title="1. 经纬度转编码函数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 经纬度转编码函数</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc8108a194cd13d769fe80" data-id="235c8507ccbc8108a194cd13d769fe80"><span><div id="235c8507ccbc8108a194cd13d769fe80" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8108a194cd13d769fe80" title="locToBinary1D"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">locToBinary1D</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">/** 
* 经纬度转二进制编码 
* @param lng 经度，单位是度 
* @param lat 纬度，单位是度 
* @param level 层级 
* @returns 二进制编码 
*/
export function locToBinary1D(lng: number, lat: number, level: number): bigint</code></pre><div class="notion-text notion-block-235c8507ccbc81e994cceb8b5f5b8e91"><b>功能</b>：实现标准中经纬度到二进制编码的转换，采用Z序编码方式（Morton码）</div><div class="notion-text notion-block-235c8507ccbc812fb9c1f14958b2b611"><b>示例</b>：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 将经纬度转换为20级二进制编码
const binaryCode = geosot.locToBinary1D(116.3152, 39.9088, 20);</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81daa0c2f99870262bf8" data-id="235c8507ccbc81daa0c2f99870262bf8"><span><div id="235c8507ccbc81daa0c2f99870262bf8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81daa0c2f99870262bf8" title="locToQuaternary"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">locToQuaternary</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">/** * 经纬度转四进制编码 
* @param lng 经度，单位是度 
* @param lat 纬度，单位是度 
* @param level 层级 
* @returns 四进制编码 
*/
export function locToQuaternary(lng: number, lat: number, level: number)</code></pre><div class="notion-text notion-block-235c8507ccbc81e6b23bfa63e258cc60"><b>功能</b>：直接生成符合标准格式的四进制编码字符串，对应标准中的”Gddddddddd-mmmmmm-ssssss.uuuuuuuuuuu”格式</div><div class="notion-text notion-block-235c8507ccbc81c897f0ef3dc0f90bdf"><b>示例</b>：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 将北京坐标转换为20级四进制编码const code = geosot.locToQuaternary(116.3152, 39.9088, 20);// 输出类似: G001234567-012345-678901.23456789012</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc8125a624eb2a1aa7429a" data-id="235c8507ccbc8125a624eb2a1aa7429a"><span><div id="235c8507ccbc8125a624eb2a1aa7429a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8125a624eb2a1aa7429a" title="2. 编码转经纬度函数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 编码转经纬度函数</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81789b6ce030a0761725" data-id="235c8507ccbc81789b6ce030a0761725"><span><div id="235c8507ccbc81789b6ce030a0761725" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81789b6ce030a0761725" title="cornerFromCode"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">cornerFromCode</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">/** 
* 四进制编码转瓦片角点经纬度 
* @param code 四进制编码 
* @returns 瓦片的经纬度，瓦片的西南角 
*/
export function cornerFromCode(code: string)</code></pre><div class="notion-text notion-block-235c8507ccbc81ee8d78ece6d6a80557"><b>功能</b>：实现标准中的解码过程，将四进制编码转换为对应网格的西南角经纬度</div><div class="notion-text notion-block-235c8507ccbc81b684ebf9da2a5d58d6"><b>示例</b>：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 解码四进制编码获取对应网格的西南角坐标
const corner = geosot.cornerFromCode(&quot;G001234567-012345-678901.23456789012&quot;);
// 输出: { lng: 116.3, lat: 39.9 }</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc810bb9efd4c12e684735" data-id="235c8507ccbc810bb9efd4c12e684735"><span><div id="235c8507ccbc810bb9efd4c12e684735" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc810bb9efd4c12e684735" title="bboxFromCode"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">bboxFromCode</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">/** 
* 四进制编码转经纬度BoundingBox 
* @param code 四进制编码 
* @returns 瓦片的经纬度BoundingBox 
*/
export function bboxFromCode(code: string)</code></pre><div class="notion-text notion-block-235c8507ccbc817bbddcddb165dfb7b7"><b>功能</b>：根据编码获取网格的边界框信息，返回{west, south, east, north}</div><div class="notion-text notion-block-235c8507ccbc81249ee0e073f873bb57"><b>示例</b>：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 获取编码对应网格的边界框
const bbox = geosot.bboxFromCode(&quot;G001234567-012345-678901.23456789012&quot;);
// 输出: { west: 116.3, south: 39.9, east: 116.4, north: 40.0 }</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81c59587e87649fed31a" data-id="235c8507ccbc81c59587e87649fed31a"><span><div id="235c8507ccbc81c59587e87649fed31a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81c59587e87649fed31a" title="3. 编码与ID转换函数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. 编码与ID转换函数</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81a5aa17d9f645aec06b" data-id="235c8507ccbc81a5aa17d9f645aec06b"><span><div id="235c8507ccbc81a5aa17d9f645aec06b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81a5aa17d9f645aec06b" title="toCode"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">toCode</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">/** 
* 将一个瓦片id转换成一个字符串编码 
* @param id 瓦片id 
* @param level 层级 
* @returns 瓦片id对应的字符串编码 
*/
export function toCode(id: bigint, level: number): string</code></pre><div class="notion-text notion-block-235c8507ccbc81cf8d29c9a0dac8ac9e"><b>功能</b>：将二进制编码（bigint类型）转换为符合标准格式的四进制编码字符串</div><div class="notion-text notion-block-235c8507ccbc81c696a8df2e52abbb65"><b>示例</b>：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 将二进制编码转换为标准格式的四进制编码字符串
const binaryCode = geosot.locToBinary1D(116.3152, 39.9088, 20);
const code = geosot.toCode(binaryCode, 20);</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81fdb559d2551b841975" data-id="235c8507ccbc81fdb559d2551b841975"><span><div id="235c8507ccbc81fdb559d2551b841975" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81fdb559d2551b841975" title="toId"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">toId</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">/** 
* 将一个字符串编码转换成一个瓦片id 
* @param code 瓦片id对应的字符串编码 
* @returns 瓦片id对应的id和级别 
*/
export function toId(code: string): { id: bigint; level: number }</code></pre><div class="notion-text notion-block-235c8507ccbc811cb2d7d1e7acea42cf"><b>功能</b>：将四进制编码字符串解析为二进制编码（bigint类型）和层级</div><div class="notion-text notion-block-235c8507ccbc8162a6afeaf608f44f7f"><b>示例</b>：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 将编码字符串解析为二进制ID和层级
const { id, level } = geosot.toId(&quot;G001234567-012345-678901.23456789012&quot;);</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc8167ba3fce6684b62f8d" data-id="235c8507ccbc8167ba3fce6684b62f8d"><span><div id="235c8507ccbc8167ba3fce6684b62f8d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8167ba3fce6684b62f8d" title="4. 辅助函数"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">4. 辅助函数</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc814eac9edde63017665d" data-id="235c8507ccbc814eac9edde63017665d"><span><div id="235c8507ccbc814eac9edde63017665d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc814eac9edde63017665d" title="getCellSizeInDegree"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">getCellSizeInDegree</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">/** 
* 获取第i级的经纬度网格的大小 
* @param i 级别 
* @returns 第i级的经纬度网格的大小，单位是度 
*/
export function getCellSizeInDegree(i: number)</code></pre><div class="notion-text notion-block-235c8507ccbc81f0a826e4b31511b5b0"><b>功能</b>：根据层级获取网格大小，对应标准中的不同级别网格精度</div><div class="notion-text notion-block-235c8507ccbc818aa9bcf41bd4e60548"><b>示例</b>：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 获取20级网格的大小（单位：度）
const size = geosot.getCellSizeInDegree(20);
// 输出: 0.000277777... (约等于1秒)</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81a181d8d53891feb0c5" data-id="235c8507ccbc81a181d8d53891feb0c5"><span><div id="235c8507ccbc81a181d8d53891feb0c5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81a181d8d53891feb0c5" title="（二）标准编码解码流程实现"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（二）标准编码解码流程实现</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81caae18e9b00d1617bd" data-id="235c8507ccbc81caae18e9b00d1617bd"><span><div id="235c8507ccbc81caae18e9b00d1617bd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81caae18e9b00d1617bd" title="1. 经纬度编码流程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 经纬度编码流程</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 1. 定义经纬度和层级const lng = 116.3152; 
// 经度const lat = 39.9088;  
// 纬度const level = 20;     
// 层级
// 2. 直接生成四进制编码
const code = geosot.locToQuaternary(lng, lat, level);
console.log(&quot;编码结果:&quot;, code);
// 或者分步实现:
// a. 先转二进制编码
const binaryId = geosot.locToBinary1D(lng, lat, level);
// b. 再转四进制编码字符串
const code2 = geosot.toCode(binaryId, level);</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81779cb2d93e385531b5" data-id="235c8507ccbc81779cb2d93e385531b5"><span><div id="235c8507ccbc81779cb2d93e385531b5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81779cb2d93e385531b5" title="2. 编码解码流程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 编码解码流程</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 1. 定义编码字符串
const code = &quot;G001234567-012345-678901.23456789012&quot;;
// 2. 解码获取角点坐标
const corner = geosot.cornerFromCode(code);console.log(&quot;西南角坐标:&quot;, corner);
// 3. 获取边界框
const bbox = geosot.bboxFromCode(code);console.log(&quot;边界框:&quot;, bbox);
// 4. 获取层级
const level = geosot.getLevel(code);console.log(&quot;层级:&quot;, level);</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc813b82a5f737fd26344c" data-id="235c8507ccbc813b82a5f737fd26344c"><span><div id="235c8507ccbc813b82a5f737fd26344c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc813b82a5f737fd26344c" title="（三）与标准文件的对应关系"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（三）与标准文件的对应关系</span></span></h4><div class="notion-text notion-block-235c8507ccbc81f7aeb5da90acfb7046">开源库函数与《GB/T 40087-2021》标准的对应关系如下：</div><table class="notion-simple-table notion-block-235c8507ccbc81d7a186ebc6f052526d"><tbody><tr class="notion-simple-table-row notion-block-235c8507ccbc8146b02bd7a9000d9adb"><td class="" style="width:120px"><div class="notion-simple-table-cell">标准内容</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">开源库实现函数</div></td></tr><tr class="notion-simple-table-row notion-block-235c8507ccbc8113885cf59fc99055d9"><td class="" style="width:120px"><div class="notion-simple-table-cell">经纬度到网格编码转换</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">locToQuaternary, locToBinary1D</div></td></tr><tr class="notion-simple-table-row notion-block-235c8507ccbc81469b70ca75ba0c205d"><td class="" style="width:120px"><div class="notion-simple-table-cell">网格编码到经纬度转换</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">cornerFromCode, bboxFromCode</div></td></tr><tr class="notion-simple-table-row notion-block-235c8507ccbc81c5b3bfc50fc099374f"><td class="" style="width:120px"><div class="notion-simple-table-cell">编码结构定义（32级四段式）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">toCode, getLevel</div></td></tr><tr class="notion-simple-table-row notion-block-235c8507ccbc8191a2ebfe0df97223a5"><td class="" style="width:120px"><div class="notion-simple-table-cell">网格大小计算</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">getCellSizeInDegree</div></td></tr><tr class="notion-simple-table-row notion-block-235c8507ccbc81129cf6c7f63d297fc7"><td class="" style="width:120px"><div class="notion-simple-table-cell">Z序编码规则</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">locToBinary1D（基于Morton码实现）</div></td></tr></tbody></table><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81178c34d0274082fd2d" data-id="235c8507ccbc81178c34d0274082fd2d"><span><div id="235c8507ccbc81178c34d0274082fd2d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81178c34d0274082fd2d" title="（四）实际应用场景"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（四）实际应用场景</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81e183e6e7819396fb83" data-id="235c8507ccbc81e183e6e7819396fb83"><span><div id="235c8507ccbc81e183e6e7819396fb83" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81e183e6e7819396fb83" title="1. 地图瓦片生成"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 地图瓦片生成</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 根据经纬度和层级计算瓦片行列号
const {x, y} = geosot.xyFromLngLat(lng, lat, level);
// 根据行列号获取瓦片URL（示例）
const tileUrl = `https://example.com/tiles/${level}/${x}/${y}.png`;</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc811e8826df7437bc52ef" data-id="235c8507ccbc811e8826df7437bc52ef"><span><div id="235c8507ccbc811e8826df7437bc52ef" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc811e8826df7437bc52ef" title="2. 空间索引构建"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 空间索引构建</span></span></h4><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-javascript">// 将大量POI点编码为GeoSOT网格
const pois = [
  { id: 1, lng: 116.3, lat: 39.9 },  { id: 2, lng: 116.4, lat: 39.8 }
];
// 构建网格索引
const index = new Map();
pois.forEach(poi =&gt; {
  const code = geosot.locToQuaternary(poi.lng, poi.lat, 18);  
  if (!index.has(code)) index.set(code, []);  
  index.set(code, [...index.get(code), poi.id]);
 });
// 查询某个区域内的POI
const bboxCode = geosot.locToQuaternary(116.35, 39.85, 16);
const bbox = geosot.bboxFromCode(bboxCode);
// 基于网格索引进行空间查询...</code></pre><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc81d8a2e7d0698680e1aa" data-id="235c8507ccbc81d8a2e7d0698680e1aa"><span><div id="235c8507ccbc81d8a2e7d0698680e1aa" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc81d8a2e7d0698680e1aa" title="（五）额外参考资料和学习资源"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">（五）额外参考资料和学习资源</span></span></h4><ul class="notion-list notion-list-disc notion-block-235c8507ccbc81cf9708de21108e6f95"><li><b>官方文档</b>：可以访问<code class="notion-inline-code">geosot</code>开源库的GitHub仓库（https://github.com/catnuko/geosot ），查看详细的文档和代码示例。</li></ul><ul class="notion-list notion-list-disc notion-block-235c8507ccbc8104907bdc537187ab6e"><li><b>标准文件</b>：《GB/T 40087-2021地球空间网格编码规则》提供了完整的技术规范。</li></ul><ul class="notion-list notion-list-disc notion-block-235c8507ccbc81898724e9c47f0dcb6b"><li><b>源代码注释</b>：直接参考<code class="notion-inline-code">src/geosot.ts</code>文件中的函数注释获取最准确的使用说明。</li></ul></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[城市快照——在线截取城市精美地图]]></title>
            <link>http://www.supony.top//article/tools/citysnap</link>
            <guid>http://www.supony.top//article/tools/citysnap</guid>
            <pubDate>Sat, 19 Jul 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[简单说，它是一个在线地图截图工具，但又不止于此！打开网站，你会看到左侧整齐排列的”工具箱”和右侧的地图”画布”。在这里，你可以搜索任何城市，然后通过各种个性化设置，把普通的地图变成一张有故事的截图——无论是记录旅行足迹、制作城市指南，还是单纯想收藏家乡的俯瞰图，它都能帮你搞定！]]></description>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-21ec8507ccbc8038b604eac3f3fb6442"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-235c8507ccbc8041b4ace8ed34f321f0" data-id="235c8507ccbc8041b4ace8ed34f321f0"><span><div id="235c8507ccbc8041b4ace8ed34f321f0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8041b4ace8ed34f321f0" title="城市快照"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.nanshan.website/tools/citysnap">城市快照</a></span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-235c8507ccbc8085a8f6cdc95298d516"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="http://nanshan.website/tools-data/citysnap/cover.png" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-235c8507ccbc8023962fdeccdef9f80c">嘿，朋友们！🌆 你是否曾想过给你熟悉的城市拍一张特别的”地图照片”？不需要专业相机，也不用出门，今天我要分享一个超实用的小工具——<b>城市快照</b>，它就像给城市地图按下快门，轻松生成你专属的城市地图截图！</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-235c8507ccbc8006b6adc502b4eb5517" data-id="235c8507ccbc8006b6adc502b4eb5517"><span><div id="235c8507ccbc8006b6adc502b4eb5517" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8006b6adc502b4eb5517" title="什么是”城市快照”？"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">什么是”城市快照”？</span></span></h3><div class="notion-text notion-block-235c8507ccbc80ed99b3c63760803484">简单说，它是一个在线地图截图工具，但又不止于此！打开网站，你会看到左侧整齐排列的”工具箱”和右侧的地图”画布”。在这里，你可以搜索任何城市，然后通过各种个性化设置，把普通的地图变成一张有故事的截图——无论是记录旅行足迹、制作城市指南，还是单纯想收藏家乡的俯瞰图，它都能帮你搞定！</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-235c8507ccbc806ba94bed324ab4bd57" data-id="235c8507ccbc806ba94bed324ab4bd57"><span><div id="235c8507ccbc806ba94bed324ab4bd57" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc806ba94bed324ab4bd57" title="三步上手使用指南"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">三步上手使用指南</span></span></h3><div class="notion-text notion-block-235c8507ccbc80eea811e34d3575f048">是不是已经心动了？来，跟我一起三步上手，小白也能秒变地图设计师！👇</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc80b89342e0081afc1681" data-id="235c8507ccbc80b89342e0081afc1681"><span><div id="235c8507ccbc80b89342e0081afc1681" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc80b89342e0081afc1681" title="🔍 第一步：找到你的城市"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🔍 第一步：找到你的城市</span></span></h4><div class="notion-text notion-block-235c8507ccbc806e8737c75381ed43be">在左侧最上方的搜索栏，输入你想”拍摄”的城市名称（比如”武汉”、“北京”），点击放大镜图标，地图就会立刻定位到那里。悄悄告诉你，我试过搜索自己的老家县城，居然也能精准显示呢！</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc8079be4cdf92ffafface" data-id="235c8507ccbc8079be4cdf92ffafface"><span><div id="235c8507ccbc8079be4cdf92ffafface" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc8079be4cdf92ffafface" title="🎨 第二步：挑选地图风格"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🎨 第二步：挑选地图风格</span></span></h4><div class="notion-text notion-block-235c8507ccbc8058844fd8ba3714b055">这是我最喜欢的环节！往下滑，你会看到”地图样式”板块，有六种风格可选：
- <b>街道</b>（默认）：清晰显示道路和建筑物，适合日常导航截图
- <b>户外</b>：突出绿地和自然景观，爬山爱好者必备
- <b>浅色/深色</b>：极简风格，搭配不同背景使用超赞（深色做手机壁纸绝了！）
- <b>卫星</b>：真实航拍视角，看城市布局超震撼</div><div class="notion-text notion-block-235c8507ccbc801286a6fd56de898368">点击任意风格，右侧地图会实时变化，选一个你最爱的吧！</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc80218969c12100e18317" data-id="235c8507ccbc80218969c12100e18317"><span><div id="235c8507ccbc80218969c12100e18317" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc80218969c12100e18317" title="🎛️ 第三步：微调细节（高级玩家必看）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">🎛️ 第三步：微调细节（高级玩家必看）</span></span></h4><div class="notion-text notion-block-235c8507ccbc80e89ad0dae7dcff4bab">如果你想让截图更有个性，可以试试”遮罩设置”：
- 拖动”透明度”滑块（默认80%），调整地图上方遮罩的深浅
- 点击”颜色”选择框，换个遮罩颜色（黑色经典，试试蓝色？）
- 开关”显示遮罩”按钮，决定是否需要这个效果</div><div class="notion-text notion-block-235c8507ccbc80768bb9dc069a08842d">右侧的”图层控制”也很有趣，勾选不同选项，可以显示/隐藏建筑物、水域、公园等元素，让截图重点更突出！</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-235c8507ccbc80bca2b6d7fb52e4ca2b" data-id="235c8507ccbc80bca2b6d7fb52e4ca2b"><span><div id="235c8507ccbc80bca2b6d7fb52e4ca2b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc80bca2b6d7fb52e4ca2b" title="✂️ 最后一步：咔嚓！保存你的作品"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">✂️ 最后一步：咔嚓！保存你的作品</span></span></h4><div class="notion-text notion-block-235c8507ccbc80cab518f5cc275ff368">一切设置好后，点击右上角的”截图”按钮，一张专属的城市快照就生成啦！悄悄说，右上角还有”导出/导入样式”功能，可以把你调好的参数保存下来，下次直接用～</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-235c8507ccbc80fcb8e6eae38f871023" data-id="235c8507ccbc80fcb8e6eae38f871023"><span><div id="235c8507ccbc80fcb8e6eae38f871023" class="notion-header-anchor"></div><a class="notion-hash-link" href="#235c8507ccbc80fcb8e6eae38f871023" title="写在最后"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">写在最后</span></span></h3><div class="notion-text notion-block-235c8507ccbc80e0b7e9daf52de5d24b">怎么样，是不是超简单？🌟 “城市快照”不仅是个工具，更像是一个城市探索的小窗口。我用它做过旅行手账的插图，给朋友寄过带城市地图的明信片，甚至用深色模式的截图做了电脑壁纸！</div><div class="notion-text notion-block-235c8507ccbc803d80ccf18c2a99cfc4">无论你是想记录生活、分享旅行，还是单纯喜欢研究城市地图，都可以试试这个小工具。现在就去搜索你最爱的城市，给它拍一张独一无二的”快照”吧！期待看到你的作品哦～ 😊</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3D L-System 在线预览平台]]></title>
            <link>http://www.supony.top//article/tools/lsys</link>
            <guid>http://www.supony.top//article/tools/lsys</guid>
            <pubDate>Mon, 26 May 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[我制作了一个简单的3D L-System在线预览工具，可以直观地展示L-System生成的三维结构。下面我将介绍几种经典的L-System模型及其应用。通过这个工具，你可以更好地理解L-System如何描述复杂的自然形态。]]></description>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-226c8507ccbc80f3b919faba24982e3c"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-226c8507ccbc8089a34ae73a92af15eb" data-id="226c8507ccbc8089a34ae73a92af15eb"><span><div id="226c8507ccbc8089a34ae73a92af15eb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#226c8507ccbc8089a34ae73a92af15eb" title="3D L-System 在线预览平台"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://nanshan.website/tools/lsys">3D L-System 在线预览平台</a></span></span></h2><div class="notion-text notion-block-226c8507ccbc8051a6acc186c02385c0">我制作了一个简单的<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://nanshan.website/tools/lsys">3D L-System在线预览工具</a>，可以直观地展示L-System生成的三维结构。下面我将介绍几种经典的L-System模型及其应用。通过这个工具，你可以更好地理解L-System如何描述复杂的自然形态。</div><div class="notion-text notion-block-226c8507ccbc8091b6a9e43fd6cf3225"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://paulbourke.net/fractals/lsys/">L-System</a>，全称Lindemayer System，来自《Algorithmic Beauty of Plants》，是由 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.wikiwand.com/en/Aristid_Lindenmayer">Aristid Lindenmayer</a> 发明的一种用于描述植物形态，细胞生长等分形结构的一种语法。</div><div class="notion-text notion-block-226c8507ccbc8028a65ccd4f6344b98c">L-System 的核心思想是通过简单的替换规则和递归应用，创建复杂的自然结构模型。这种方法特别适合模拟植物生长、分形几何和其他自组织系统。通过调整参数和规则，我们可以生成从简单的几何形状到复杂的植物形态的各种结构。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-226c8507ccbc80d094ddc6f02c550831" data-id="226c8507ccbc80d094ddc6f02c550831"><span><div id="226c8507ccbc80d094ddc6f02c550831" class="notion-header-anchor"></div><a class="notion-hash-link" href="#226c8507ccbc80d094ddc6f02c550831" title="DOL 系统 DOL Systems  "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>DOL 系统 DOL Systems  </b></span></span></h3><div class="notion-text notion-block-226c8507ccbc80c58a52d1f471447fd1">名称：Koch曲线</div><div class="notion-text notion-block-226c8507ccbc800da964c6b093b10e37">公理：F-F-F-F</div><div class="notion-text notion-block-226c8507ccbc809aa21ccf88fb22cab1">生成式：</div><ul class="notion-list notion-list-disc notion-block-226c8507ccbc8092a4c7d3e1b3cc87d5"><li>F = FF-F-F-F-FF</li></ul><div class="notion-text notion-block-226c8507ccbc802ea9ecfbd852558b78">在L-System中，不同的符号代表不同的操作：</div><ul class="notion-list notion-list-disc notion-block-226c8507ccbc8049a347fb0623e6d208"><li><b>F</b>：向前移动一步，同时绘制一条线</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc803e80afcde1381edfa7"><li><b>f</b>：向前移动一步，但不绘制线</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc801c8e0decc8a9820d96"><li><b>+</b>：向右旋转一个角度</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc805b9a1bd3fcf955f622"><li><b>-</b>：向左旋转一个角度</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80489ec9e9069f0b8c1f"><li><b>[</b>：保存当前位置和角度（入栈）</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80a1af6dde2e12e59df2"><li><b>]</b>：返回到之前保存的位置和角度（出栈）</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc809a9f93e34763926e1a"><li><b>|</b>：旋转180度</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc8006ad4dc26ca3d896d1"><li><b>^</b>：向上倾斜一个角度</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80e1b806efe75961b051"><li><b>&amp;</b>：向下倾斜一个角度</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80c797c2dbad85ae0c15"><li><b>\</b>：沿前进方向顺时针旋转一个角度</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc8042b504cfc579f4e890"><li><b>/</b>：沿前进方向逆时针旋转一个角度</li></ul><div class="notion-text notion-block-226c8507ccbc80388d59dcae528d522b">例如，在Koch曲线的例子中：</div><ol start="1" class="notion-list notion-list-numbered notion-block-226c8507ccbc807ca4f2d06178a90df4"><li>从&quot;F-F-F-F&quot;开始（一个正方形）</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-226c8507ccbc8075aa2ddb7736bb093f"><li>每个F被替换为&quot;FF-F-F-F-FF&quot;</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-226c8507ccbc805797e8c78de7e54167"><li>&quot;-&quot;符号表示向左旋转，默认是90度</li></ol><div class="notion-text notion-block-226c8507ccbc80e5bdcafa7141ff9f85">通过这种简单的替换规则，几次迭代后会形成复杂的Koch曲线图案。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-226c8507ccbc80d9b3d9db17e8e00e59" data-id="226c8507ccbc80d9b3d9db17e8e00e59"><span><div id="226c8507ccbc80d9b3d9db17e8e00e59" class="notion-header-anchor"></div><a class="notion-hash-link" href="#226c8507ccbc80d9b3d9db17e8e00e59" title="随机系统 Stochastic Systems "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>随机系统 Stochastic Systems </b></span></span></h3><div class="notion-text notion-block-226c8507ccbc809f845dcced136228d0">随机L-System引入了概率元素，使每次生成的结构都略有不同，更接近自然界的变异性。在随机系统中，同一个符号可以有多个可能的替换规则，每个规则都有一定的概率被选中。这种随机性使得生成的模型更加自然，避免了完全确定性系统中可能出现的人工痕迹。</div><div class="notion-text notion-block-226c8507ccbc80d0afdff671e91ea322">例如，一个模拟树生长的随机L-System可能如下：</div><div class="notion-text notion-block-226c8507ccbc806aa219def7d0289620">名称：随机树</div><div class="notion-text notion-block-226c8507ccbc808684a0d8d03f70278b">公理：F</div><div class="notion-text notion-block-226c8507ccbc8074958cfe52481fccd5">生成式：</div><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80dfa33ff319770cc2b7"><li>F 0.33= F[+F]F[-F]F</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80749c75c295f0e06071"><li>F 0.33= F[+F]F</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80a2a767c39119945b62"><li>F 0.34= F[-F]F</li></ul><div class="notion-text notion-block-226c8507ccbc8030a854c68e40663ea0">这里，F有三种可能的替换规则，分别有33%、33%和34%的概率被选中。每次应用规则时，系统会根据这些概率随机选择一个替换规则，从而生成不同的结构。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-226c8507ccbc805493bed12ab32f3b27" data-id="226c8507ccbc805493bed12ab32f3b27"><span><div id="226c8507ccbc805493bed12ab32f3b27" class="notion-header-anchor"></div><a class="notion-hash-link" href="#226c8507ccbc805493bed12ab32f3b27" title="参数化系统 Parametric Systems  "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>参数化系统 Parametric Systems  </b></span></span></h3><div class="notion-text notion-block-226c8507ccbc800f9dd7e639c0b9a2b7">参数化L-System在基础L-System的基础上引入了参数，使每个符号可以携带额外的数值信息。这种扩展使得模型能够表达更细微的变化和复杂的生长规则。在参数化系统中，符号可以有参数（如F(a,b)），替换规则可以包含条件表达式，以及参数之间的数学计算。</div><div class="notion-text notion-block-226c8507ccbc80919a08e9552a95fba9">例如，一个简单的参数化L-System可能如下：</div><div class="notion-text notion-block-226c8507ccbc80da9c96e905178bc47f">名称：参数化树</div><div class="notion-text notion-block-226c8507ccbc80c09d35c3af03e82e93">公理：F(1,10)</div><div class="notion-text notion-block-226c8507ccbc80a3917cfac9f65f58c2">生成式：</div><ul class="notion-list notion-list-disc notion-block-226c8507ccbc808092b6cb4a1d766b3c"><li>F(a,l) : a &lt; 3 → F(a+1,l)[+F(a/2,l-2)][-F(a/2,l-2)]</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc802e9264db935c86bb55"><li>F(a,l) : a ≥ 3 → F(a,l-1)</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-226c8507ccbc80948292d0bf40bb93c8" data-id="226c8507ccbc80948292d0bf40bb93c8"><span><div id="226c8507ccbc80948292d0bf40bb93c8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#226c8507ccbc80948292d0bf40bb93c8" title="上下文相关系统 Contextual Systems  "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>上下文相关系统 Contextual Systems  </b></span></span></h3><div class="notion-text notion-block-226c8507ccbc80d6a0ecd859f7bbc1a7">上下文相关L-System是对基本L-System的扩展，其中替换规则依赖于符号的上下文环境。这种系统能够模拟更复杂的生物结构和生长模式。在上下文相关系统中，替换规则的形式为&quot;左上下文 &lt; 符号 &gt; 右上下文&quot;，表示只有当符号处于特定上下文中时，才应用该替换规则。</div><div class="notion-text notion-block-226c8507ccbc8089a0bfe44ae754aa17">例如，考虑以下上下文相关的L-System：</div><div class="notion-text notion-block-226c8507ccbc805bbefaf43cad0723a6">名称：简单细胞生长模型</div><div class="notion-text notion-block-226c8507ccbc80c3affad0d8d9541fbf">公理：B</div><div class="notion-text notion-block-226c8507ccbc80a1bde1ff1436f23f3a">生成式：</div><ul class="notion-list notion-list-disc notion-block-226c8507ccbc8077bacfc235d28f2230"><li>B &lt; A &gt; B = C</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80c5843de2cdb01e5e51"><li>A &lt; B &gt; A = C</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc8011bc7dd708d3c88f08"><li>B = A</li></ul><ul class="notion-list notion-list-disc notion-block-226c8507ccbc80178fdcf26f1684980f"><li>A = AB</li></ul><div class="notion-text notion-block-226c8507ccbc80039685d8e183cfec2f">在这个例子中：</div><ol start="1" class="notion-list notion-list-numbered notion-block-226c8507ccbc80da8debfb40c8027f14"><li>第一条规则表示，如果A左边是B，右边是B，则A替换为C</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-226c8507ccbc8022840ce75b5cd87bc0"><li>第二条规则表示，如果B左边是A，右边是A，则B替换为C</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-226c8507ccbc8074a42bccdfaa1d73c0"><li>如果以上条件都不满足，则B替换为A</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-226c8507ccbc80b4bdb6d571d8874e4a"><li>如果以上条件都不满足，则A替换为AB</li></ol><div class="notion-text notion-block-226c8507ccbc807fb30ee23c88f01ce8">这种上下文相关的规则能够模拟细胞分裂和组织形成过程中的局部相互作用，使模型更接近自然界中的实际生长过程。</div><div class="notion-blank notion-block-226c8507ccbc80e3aec7e0e5a95e11ec"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-226c8507ccbc80189332f0830b316f86" data-id="226c8507ccbc80189332f0830b316f86"><span><div id="226c8507ccbc80189332f0830b316f86" class="notion-header-anchor"></div><a class="notion-hash-link" href="#226c8507ccbc80189332f0830b316f86" title="3D L-System在线预览工具生成的树"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://nanshan.website/tools/lsys">3D L-System在线预览工具</a>生成的树</span></span></h3><div class="notion-row notion-block-226c8507ccbc80238839ef1d3cfe0fea"><div class="notion-column notion-block-226c8507ccbc80cf8017c527deb3f4dc" style="width:calc((100% - (2 * min(32px, 4vw))) * 0.33333333333333337)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-226c8507ccbc80679e1ffa3ec2f956db"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:240px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="attachment:57e296a2-3f6f-4592-bd5e-1210e39c4d9e:Honda-单轴树-a.png" alt="Honda-单轴树-a" loading="lazy" decoding="async"/><figcaption class="notion-asset-caption">Honda-单轴树-a</figcaption></div></figure></div><div class="notion-spacer"></div><div class="notion-column notion-block-226c8507ccbc80ae8c7cc5f9de967553" style="width:calc((100% - (2 * min(32px, 4vw))) * 0.33333333333333337)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-226c8507ccbc80eda90eebcf16fd878d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:288px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="attachment:51b3ab05-57f5-4192-9ed5-b37e8cf0b20e:合轴树-a.png" alt="合轴树-a" loading="lazy" decoding="async"/><figcaption class="notion-asset-caption">合轴树-a</figcaption></div></figure><div class="notion-blank notion-block-226c8507ccbc8018b0b1c1f5bdefd379"> </div></div><div class="notion-spacer"></div><div class="notion-column notion-block-226c8507ccbc80ecb4b8d5bed13906f7" style="width:calc((100% - (2 * min(32px, 4vw))) * 0.3333333333333333)"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-226c8507ccbc80a79b1ce9ddbb3f69e8"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:336px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="attachment:27b41eed-6f6e-40ed-a144-6140706cbeb0:合轴树-d.png" alt="合轴树-d" loading="lazy" decoding="async"/><figcaption class="notion-asset-caption">合轴树-d</figcaption></div></figure></div><div class="notion-spacer"></div></div><div class="notion-blank notion-block-226c8507ccbc80be9e05ef15e6264c7e"> </div><div class="notion-blank notion-block-226c8507ccbc8016a7e0d56a7896b94e"> </div><div class="notion-blank notion-block-226c8507ccbc80b597eed3131890076f"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[理论3D地球1：计算大地表面某点的法线]]></title>
            <link>http://www.supony.top//article/globe3d/1</link>
            <guid>http://www.supony.top//article/globe3d/1</guid>
            <pubDate>Sun, 09 Apr 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[在渲染三维地球时大地表面法线很有用，比如计算阴影，在地理坐标系中精确的定义高度。]]></description>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-70f53e84a766491ba7b36a5cd776a3ce"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-d1205ad346164d31b91e98a3ffa54e6e" data-id="d1205ad346164d31b91e98a3ffa54e6e"><span><div id="d1205ad346164d31b91e98a3ffa54e6e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d1205ad346164d31b91e98a3ffa54e6e" title="学完本章你将了解："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">学完本章你将了解：</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-4252cd8e4fe049339379431556d18c69"><li>地球的数学模拟</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-b869caaa0a5c4420a0d0afdb246dae3e"><li>WGS84坐标系</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-4114ab89e33e4a0bb0c3cf6a9383696a"><li>什么是大地坐标系和笛卡尔坐标系（空间直角坐标系）</li></ol><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-5ec1cb2aa90e4fab8ca95dc0347d729d" data-id="5ec1cb2aa90e4fab8ca95dc0347d729d"><span><div id="5ec1cb2aa90e4fab8ca95dc0347d729d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#5ec1cb2aa90e4fab8ca95dc0347d729d" title="地球的数学模拟"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">地球的数学模拟</span></span></h3><div class="notion-text notion-block-0e0227c5799b430fa19b858dc9d11953">构建一个3D地球，首先需要用数学公式描述出地球，但地球表面高低起伏，高处珠穆拉玛峰8848米，低处马里亚纳海沟11000米，上下相差19848米，极其不规则，所以我们只能用数学公式近似描述。</div><div class="notion-text notion-block-3de9b93d74cc4ff4ac3cb5e0de36a2a6">科学家想到了一个办法来近似的描述地球，就是地球的<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zhuanlan.zhihu.com/p/44098054">三级逼近</a>。<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://epsg.io/7030-ellipsoid">WGS84椭球体</a>是第三级逼近中的参考椭球体，在其基础上建立了<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://epsg.io/4326">WGS84坐标系</a>，是国际通用坐标系。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-0212e2afc65b4cc485085d5f8b18a3e4" data-id="0212e2afc65b4cc485085d5f8b18a3e4"><span><div id="0212e2afc65b4cc485085d5f8b18a3e4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0212e2afc65b4cc485085d5f8b18a3e4" title="WGS84椭球体"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">WGS84椭球体</span></span></h3><div class="notion-text notion-block-291f52c77fb54a73be04efe8b34d9cce">长轴为6378137m</div><div class="notion-text notion-block-196a621d0fe144b9845c0ff87f5e0b52">短轴为6356752.3142m</div><div class="notion-text notion-block-2eac6032aca04eabb1ee9f6774daaf15">原点在地球质心</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-2de0a53692484cf4891deea63b2b31c1" data-id="2de0a53692484cf4891deea63b2b31c1"><span><div id="2de0a53692484cf4891deea63b2b31c1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2de0a53692484cf4891deea63b2b31c1" title="WGS84坐标系"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">WGS84坐标系</span></span></h3><div class="notion-text notion-block-9025698e1c934083a4960a75781a4686">WGS84坐标原点在地球质心，Z轴指向北极，X轴指向0度经线的位置<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，Y轴通过右手规则确定，指向<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。赤道在XY平面上。</div><div class="notion-text notion-block-d511296a38d44a51959661a184b30146">WGS84坐标系固定在地球上，地球旋转，坐标系也旋转，地球上的物体跟着旋转。</div><div class="notion-text notion-block-63bc995051bb4306b25b48a605ac1195">在理论地球中，WGS84坐标系的单位是米。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-752c86e7bfec4e888a3d681201121b0e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fbea683ae-57ce-47a6-ad4e-66d09fad3603%2FUntitled.png?table=block&amp;id=752c86e7-bfec-4e88-8a3d-681201121b0e" alt="WGS84坐标系示意图" loading="lazy" decoding="async"/><figcaption class="notion-asset-caption">WGS84坐标系示意图</figcaption></div></figure><div class="notion-callout notion-gray_background_co notion-block-d48c1a9bf62b4d4b997f62c98a70e8e0"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-0662e6e373cb40f2ae0bd80c712ca4c2">右手定则：中指指向X轴指向自己，食指指向Z轴指向北极，大拇指即是Y轴的方向。XYZ三轴互相垂直。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-65d687b681bc4b6885bccd88a7238288"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:220px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F31c49b3d-d0d4-4776-9ff3-d6d09eb3b211%2FUntitled.png?table=block&amp;id=65d687b6-81bc-4b68-85bc-cd88a7238288" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></div><div class="notion-text notion-block-bfb20c9b23e848acb08eff94e1cf700d">有了坐标系，相当于我们有了一把尺子，有了一个空间，拿着尺子在空间中一点点量测，我们就能构建出一个接近真实的地球。</div><div class="notion-text notion-block-4032782c8d2b4c8f8aa9594907fa4e56"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://katex.org/docs/supported.html">Supported Functions · KaTeX</a></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-ced5b4a7bb4a4e0cb5388c7a2c69f742" data-id="ced5b4a7bb4a4e0cb5388c7a2c69f742"><span><div id="ced5b4a7bb4a4e0cb5388c7a2c69f742" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ced5b4a7bb4a4e0cb5388c7a2c69f742" title="大地坐标系和地理坐标系"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">大地坐标系和地理坐标系</span></span></h3><div class="notion-text notion-block-1ad8f81c973c469bbc9e46789cf7c87e">大地坐标系是大地测量中以参考椭球面为基准面建立起来的坐标系，也就是地理坐标系，地面点的位置用大地经度L、大地纬度B和大地高度H表示，单位为度分秒。大地坐标系以纬度B、经度L、大地高H描述一点的空间位置。 纬度的定义是某点的地面法线与赤道面的夹角，以赤道面为起算点，向南为负，范围为<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>-90°~0°，向北为正，范围为0°~90°；经度L由起始大地子午面起算，向东为正，向西为负，范围是-180°~180°。</div><div class="notion-callout notion-gray_background_co notion-block-f99b5cf282524b4ba84fa3abfb15554f"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">大地坐标系上任一点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>可对应笛卡尔坐标系中一点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-a344a4b9cf9f42e480bc699cc5d7f9ad" data-id="a344a4b9cf9f42e480bc699cc5d7f9ad"><span><div id="a344a4b9cf9f42e480bc699cc5d7f9ad" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a344a4b9cf9f42e480bc699cc5d7f9ad" title="计算大地表面某点的法线"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">计算大地表面某点的法线</span></span></h3><div class="notion-text notion-block-a27e6e71a138474f965f7c9fa0883c8d">在渲染三维地球时大地表面法线很有用，比如计算阴影，在地理坐标系中精确的定义高度。</div><div class="notion-text notion-block-cc9be3df5078433288922e28f196c028">球面点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>的法线很简单，假如球的中心在原点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，我们可以把<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>当作向量<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，归一化(<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>)该向量<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>即可得到<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>的法线。将这个过程应用在地心椭球体（比如WGS84椭球体）即可得到地心表面法线（geocentric surface normal），之所以叫地心，是因为它从椭球体的原点发出穿过<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。如果椭球不是一个完美球体，这个向量对于大多数点来说实际上不是垂直于曲面的。</div><div class="notion-text notion-block-0cec2c160bfa47439392e6eaaa0c9fd5">大地表面法线（geodetic surface normal）是椭球体上的点的实际表面法线,可以理解为铅垂线。当椭球是正球时，大地表面法线和地心表面法线相等，椭球越扁，两者相差越大。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-28564ad690e04123b775f41ee97f83a0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F15f2bd56-fb89-47f2-8a51-da57c474a29a%2FUntitled.png?table=block&amp;id=28564ad6-90e0-4123-b775-f41ee97f83a0" alt="长半轴都为1，短半轴分别为1，0.7，0.4" loading="lazy" decoding="async"/><figcaption class="notion-asset-caption">长半轴都为1，短半轴分别为1，0.7，0.4</figcaption></div></figure><div class="notion-text notion-block-2caa712470be4c5ea869a24696fcb3ae">大地表面法线计算公式要比地心表面法线稍微复杂些。</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-3cdd1d440d5b41a98ca49f428c04710c">a,b,c是椭球体的半径，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>是椭球体表面点，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>是大地表面法线。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-c8bddb0f84b040b4b4c167c50b23ddbe" data-id="c8bddb0f84b040b4b4c167c50b23ddbe"><span><div id="c8bddb0f84b040b4b4c167c50b23ddbe" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c8bddb0f84b040b4b4c167c50b23ddbe" title="JL1"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">JL1</span></span></h3><div class="notion-text notion-block-d31bb4c5d0b34fc6b77ffa568895ee5a">文字表述<b>：</b>椭球半径和表面点已知时，能计算出大地表面法线。</div><div class="notion-text notion-block-c821df958f3c496c9f02cafd3ca753d2">函数表述:</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">//p是地球表面一点
//e是椭球体默认值为WGS84椭球体
//返回：点P的大地表面法线
JL1 = (p:Vec3,e:Ellipsoid = WGS84Ellipsoid)⇒Vec3</code></pre><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-b13a41c94af444128b8b2451518a43ea" data-id="b13a41c94af444128b8b2451518a43ea"><span><div id="b13a41c94af444128b8b2451518a43ea" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b13a41c94af444128b8b2451518a43ea" title="结论的用处："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>结论的用处：</b></span></span></h3><div class="notion-text notion-block-204d305e967842108a2aa2a1ed6d150e">一是用公式总结上述过程</div><div class="notion-text notion-block-1790b13f4bc34ea4bef6685d3d6a679a">二是定义一个函数JL1 = (p:Vec3,e:Ellipsoid = WGS84Ellipsoid)⇒Vec3</div><div class="notion-text notion-block-5722b9ea32ca48888aa63020394ecd80">三是当使用JL1(P(x,y,z))时，意味着将得到一个点P的大地表面法线</div><div class="notion-blank notion-block-6dc27e9630c14be3bdb8bfc56a3b95f1"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[理论3D地球3：地理坐标系转WGS84互相转换]]></title>
            <link>http://www.supony.top//article/globe3d/3</link>
            <guid>http://www.supony.top//article/globe3d/3</guid>
            <pubDate>Sun, 09 Apr 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[详细推导Cesium中的Cartographic和Cartesian3之间的转换过程]]></description>
            <content:encoded><![CDATA[<div id="container" class="mx-auto undefined"><main class="notion light-mode notion-page notion-block-abf76d27f2a94f8db988113131430a7a"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-ff886550c25948a8856c0cd68bd5a2f6" data-id="ff886550c25948a8856c0cd68bd5a2f6"><span><div id="ff886550c25948a8856c0cd68bd5a2f6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ff886550c25948a8856c0cd68bd5a2f6" title="学完本章你将了解："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">学完本章你将了解：</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-17162141697948f99eef992f45e6c2f7"><li>地理坐标系转WGS84</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-0f97c3365a5c41e195d5d12207052f28"><li>WGS84转地理坐标系</li></ol><div class="notion-text notion-block-b544ab3c7c914109b67d7fae3b03c119">大多数地理数据是以地理坐标系的方式存储，而渲染3D地球是在空间直角坐标系中进行，所以地理数据和空间直角坐标系之间的转换必不可少。</div><div class="notion-text notion-block-7242ada7daf44b78a97bfe885597ac26">在下面的讨论中，经度用<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>表示，大地纬度用<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，高度用<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>表示（经度，纬度，高度）。而空间直角坐标系中的某一点用<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>表示，椭球体表面某点用<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>表示。所有的表面法线都是大地表面法线。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-d2ca783a94274c428c04011efddde5b1" data-id="d2ca783a94274c428c04011efddde5b1"><span><div id="d2ca783a94274c428c04011efddde5b1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d2ca783a94274c428c04011efddde5b1" title="地理坐标系转WGS84"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">地理坐标系转WGS84</span></span></h3><div class="notion-text notion-block-a1be06408d164d2184b0ec33ff961ce3">给定地理坐标<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>和一个中心点在远点的<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>的椭球体，假定点是WGS84坐标系，空间直角坐标系中的某一点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，椭球体上某点的表面法线是<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。想要求<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，只需要计算出点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>在椭球体表面上的点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>和高度向量<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ac6a2d29efc7478fa7dd940861ded427"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:451px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F589c0580-d414-45ac-8686-68394c15a9a3%2FUntitled.png?table=block&amp;id=ac6a2d29-efc7-478f-a7dd-940861ded427" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-8aa62d539da54720b8114f98d2407674">给定表面某点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，表面法向量为<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，根据定义：</div><div class="notion-row notion-block-481d04d0517644caa3f76ade73302458"><div class="notion-column notion-block-b4b2d28f20be48cfb6f1c48d11486fff" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-0ea1202b1afb435bbff07ca301a9d2f0"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-6e0faea0858b481a8d37f61590b56ccb" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.125)"><div class="notion-text notion-block-fad52d2a6e764516a036e456f50d8488">(3.1)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-2bb03f05beea4d8e9f07b74aab17cedc">给定表面某点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，非归一化表面向量为<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，则：</div><div class="notion-row notion-block-f5e0b612a91e4c8090906be06c14778d"><div class="notion-column notion-block-e19194a5f0044bda9090a014bce154bf" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-c542a461d7be4d36bd980181a37efcce"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-5c213331bef44d81a3f6217b3c9f6ad8" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000003)"><div class="notion-text notion-block-ee6742b5a246402086d9afc2d0122512">(3.2)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-baa85392f2ea4341b14baf41218145b5">得到<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>为相差的常量：</div><div class="notion-row notion-block-7d0dfc28f54541ec93bfa003478f0d8e"><div class="notion-column notion-block-ae17ac06e3ab48c0aede324a174098c7" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-23a85a91067c4edea0827306bb25568d"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-8253566ee49f4c73be9a6b32b9d40f40" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000003)"><div class="notion-text notion-block-57bf6c1f2a0b4e43a340e3da0fbcd7d1">(3.3)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-d1d156dbc6c24f02b4d1ed296432d701">将公式(3.2)带入(3.3)得到：</div><div class="notion-row notion-block-b4d8b74c05da4243a48861325c352e2a"><div class="notion-column notion-block-83a2948df6434821bf9e3d3e0fcc8a22" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-d70b0b7b2e8a47a0b72f010f579b0402"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-7dd5129c5fc6425f990e8e17df0d6564" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000003)"><div class="notion-text notion-block-33557ae7d11341a7a0034af3f4705165">(3.4)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-b4162f80b094484a9d4bad2f65583a88">已知<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，而不知道<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，所以我们用三个等式重写(3.4):</div><div class="notion-row notion-block-4355d782a93f42168321ed65b53c1f35"><div class="notion-column notion-block-9ff4f490883f4731ac9fb9450df0491c" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-b4a91b70a9d445b29289172a01494268"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-2036684e129c43b9bdf65113117aeedf" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000003)"><div class="notion-text notion-block-677520959d4c40ac8bfefc71e93ef9ba">(3.5)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-e278360f0ea7421dacdbe65675aab1e5">重新排列下组合：</div><div class="notion-row notion-block-6a7b5d3dd42f4f61a48d0f7ac84132c6"><div class="notion-column notion-block-d98d7f732eab4343a287b55ef05b444c" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-c773a3359b81415883b7cf8eb51e248a"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-de9a6a645d294f51b5e8eb3d231646d9" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000006)"><div class="notion-text notion-block-5ce411794572458f8d07d088996349bd">(3.6)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-747234124a4f4a4d9c413b49b19ea3ab">我们最终要计算<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，只需要计算出<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>即可，我们都知道椭圆公式为<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，将(3.6)里的等式将<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>替换可得<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：</div><div class="notion-row notion-block-ea6d4ec60c47436eb9078b6accdcb01f"><div class="notion-column notion-block-dbefcb44a744455b993b9f56f9727175" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-bc6c2e190e634f1890c42588d498d337"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>t</div></div><div class="notion-spacer"></div><div class="notion-column notion-block-a6dca952f2564b2386383bc4dabb473b" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000003)"><div class="notion-text notion-block-2d6fac1588a34c989a677c3ab0e48497">(3.7)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-d55342f0b0b243549b33defc20f6bdc3"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-92ef7a9ce41c414bab2c3139613cb7a0"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-552d8df0c9cf43a1ba3c41a87707a831">将(3.7)代入到(3.6)中可得<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。</div><div class="notion-text notion-block-d4c3b3f809534ce1b56fba909f2945d4">可用高度h和表面法向量计算出<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：</div><div class="notion-text notion-block-0c909f114383498983028242f0474239"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-9a01125cc0714dc3b0e6d83f25eb640e">j</div><div class="notion-text notion-block-09ae13970fd84b35bff647c0b9cf86b7">将向量<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>和<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>相加即可得出<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：</div><div class="notion-text notion-block-a81a915f9ab9410dac8d41c544f7c773"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-bd9e2542b46c478c9bdbb76e5ed70009" data-id="bd9e2542b46c478c9bdbb76e5ed70009"><span><div id="bd9e2542b46c478c9bdbb76e5ed70009" class="notion-header-anchor"></div><a class="notion-hash-link" href="#bd9e2542b46c478c9bdbb76e5ed70009" title="JL2"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">JL2</span></span></h3><div class="notion-text notion-block-abfa0f9fe89e46169041dcb74a85e8c6">名称：地理坐标系转WGS84</div><div class="notion-text notion-block-41f33520d3aa40f38ac37a0af0e8b64d">文字表述<b>：</b>根据地理坐标和椭球体，能计算出相应的空间直角坐标系</div><div class="notion-text notion-block-3fc81dfb28db4e72bba825330ab6cd9b">函数表述:</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">//p是地球表面一点，经度，纬度，高度
//e是椭球体默认值为WGS84椭球体
//返回：点p的空间直角坐标系坐标
JL2 = (p:Vec3,e:Ellipsoid = WGS84Ellipsoid)⇒Vec3</code></pre><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-95c3911954ac4b6e9b1955e5d6ced321" data-id="95c3911954ac4b6e9b1955e5d6ced321"><span><div id="95c3911954ac4b6e9b1955e5d6ced321" class="notion-header-anchor"></div><a class="notion-hash-link" href="#95c3911954ac4b6e9b1955e5d6ced321" title="WGS84转地理坐标系"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">WGS84转地理坐标系</span></span></h3><div class="notion-text notion-block-5afd15120c884ce78c8e885648c1d31d">wgs84坐标<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>转地理坐标系有些复杂，需要分几步来做。</div><div class="notion-text notion-block-6d59602f21ea437a9e28b3f80d261fbe">首先，将椭球体表面的点转换为地理坐标系，再将点沿着</div><ol start="1" class="notion-list notion-list-numbered notion-block-6ae1cfefb40444898ee9c52b13f5817a"><li>计算点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>沿地心表面法线方向延长线与椭球体表面的交点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><div class="notion-text notion-block-5a3d02321e504ecfaf0f108bf0640b73">假设<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>为空间直角坐标系中任意一点，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>是点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>到原点的连线和椭球体的交点，即沿地心表面法线方向与椭球体的交点。</div><div class="notion-text notion-block-7c075a78bf0a4e5dae259a66362bca78"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-ed9e8475f9274a8d820e8070df9c3019">把上述等式代入椭圆方程可得下面等式：</div><div class="notion-row notion-block-915746d4cb064e3a8b2c437599cca605"><div class="notion-column notion-block-196681fdecee4336b7cfe8aeafb429bd" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-74990aa221f848d586b01c66b5fb0aac"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> </div><div class="notion-text notion-block-7cb19dee270f4b6784caf20a5e0fb526">已知<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>和<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，很容易计算<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><h3 class="notion-h notion-h2 notion-block-4abfca8cb527410cbb98947dfa0588c9" data-id="4abfca8cb527410cbb98947dfa0588c9"><span><div id="4abfca8cb527410cbb98947dfa0588c9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4abfca8cb527410cbb98947dfa0588c9" title="JL3"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">JL3</span></span></h3><div class="notion-text notion-block-15cb2e6c66894557a08fd109187f459a">名称：ScaleToGeocentricSurface</div><div class="notion-text notion-block-52b85c5db80e4d4c92f3931cb283d9d0">文字表述：已知空间直角坐标系中的某一点和椭球体，能计算出点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>沿地心表面法线方向延长线与椭球体表面的交点。</div><div class="notion-text notion-block-59e14987ecef4a8995a1e2907f1014be">函数表述：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">//p是空间直角坐标系的某一点
//e是椭球体默认值为WGS84椭球体
//返回：点p的空间直角坐标系坐标
JL3 = (p:Vec3,e:Ellipsoid = WGS84Ellipsoid)⇒Vec3</code></pre></div><div class="notion-spacer"></div><div class="notion-column notion-block-fbf08652eb8547e6b8aa595f790ea7fa" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.125)"><div class="notion-text notion-block-c241fd8f41cd4b2d9b1308c2c3d210cf">(3.8)</div></div><div class="notion-spacer"></div></div><ol start="1" class="notion-list notion-list-numbered notion-block-7ae5361151c844559239500999b5fefa"><li>计算点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>沿大地表面法线方向延长线与椭球体表面的交点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><div class="notion-text notion-block-629250929f6d4a56af729f9abda3eb55">假设<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>为空间直角坐标系中任意一点，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>是点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>到原点的连线和椭球体的交点。则：</div><div class="notion-row notion-block-699cc6c570ea4615b6744baf3335eb3b"><div class="notion-column notion-block-199b083b0db54fc181614edb0df37315" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-a7a040c15a814d44bb487f533e54cc46"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-blank notion-block-343d59f7f05a4cbbbc338bfd6a035ff8"> </div></div><div class="notion-spacer"></div><div class="notion-column notion-block-4e39f8a3e95349bfbb778b4873d6fe4a" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000006)"><div class="notion-text notion-block-bbd222103b4249a38e7abe48d24ed175">(3.9)</div><div class="notion-blank notion-block-686500c92cf64d54b7e0bb7682230b91"> </div></div><div class="notion-spacer"></div></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-9365e5b1063242589615cf8066f15fec"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:375px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc26771bd-3928-4943-9d62-9d1e6ca291b0%2FUntitled.png?table=block&amp;id=9365e5b1-0632-4258-9615-cf8066f15fec" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-8ab7cede8e654749905b294edfbe55e7">向量<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>和(3.2)中的<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>的方向相同，模不同，因此可以得到一个等式：</div><div class="notion-row notion-block-467e6463aaee4a138df9e512a2026663"><div class="notion-column notion-block-1faeedfd73e946c0935f01f4faadd83a" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-3f0ef7a84b74451fa245cfb190698b26"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-1ff15443b5d64719b85c3352ff5f4249" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000006)"><div class="notion-text notion-block-bcada475f2d141c98a498acede7487dd">(3.10)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-32f8c3bdc1ac4da5b5e98d0a0faa1f91">把(3.10)代入到(3.9)中可得：
<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-efeae71c3ad6440e9f6570bb739e4f87">把上述等式写成分量的形式，并把(3.2)代入其中得：</div><div class="notion-text notion-block-d4c984d1b0a1499bb31d8b9645fc177a"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>ti</div><div class="notion-text notion-block-fef4a0768bee402fbe274f54085a6697">提出<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>:</div><div class="notion-text notion-block-c3d9112a58994116b7f29b29c9db1a6d"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-e38ec01b699a4494a6f1ff34542b3775">可得：</div><div class="notion-row notion-block-3485dd77b05b40f49e596b82f36a03cf"><div class="notion-column notion-block-2532d21335914011a00e8beb97c2e389" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-007f03d54712468ca8395243283492f5"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-cd6a4d8442474037a408e3a2a9b03a54" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.125)"><div class="notion-text notion-block-2b447a94a7f54e98a40bb297059633d9">(3.11)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-5593345d6dd249e1bf0baa0514633371">椭圆公式中<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>改成<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>的形式：</div><div class="notion-row notion-block-4cdf6825057b4e22a73ed07de941e5d4"><div class="notion-column notion-block-b3b91745cbf24c9da02ca67c9bdac0d4" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-3ac011db0a4c4ffb9072e7adc0100085"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-3fd6a2b68fb24f77bba11b2328a2abfd" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000006)"><div class="notion-text notion-block-8237853de55f451db59bbdd1f932ad64">(3.12)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-c7534a0fef7940669813e68bfe8a231f">把(3.11)代入到(3.12)中可得：</div><div class="notion-row notion-block-8b2b20410a0e4f4aa8366e6bf511398c"><div class="notion-column notion-block-b1462e7236ac432faa1cc807bddbd6e2" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-dec1077388334629b451aafc3f381b1d"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-blank notion-block-19ab5a4d62ef4feb98b71be49279cf1b"> </div></div><div class="notion-spacer"></div><div class="notion-column notion-block-578f8692a0114b6bb23700b6cf806dc5" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.125)"><div class="notion-text notion-block-31b0029e86b746f1be28b1d41d141490">(3.13)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-dcc597814e05423b8bdd7d329147967a"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>都是已知的，解方程求得<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，把<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>代入到等式(3.11)中即可得到<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，但是怎么解方程的根呢？这里用<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zhuanlan.zhihu.com/p/400064205">Newton-Raphson</a>方法求出相似解是最快的办法。这种方法对于地球的扁球体收敛速度很快，而且不需要任何三角函数，效率很高。它不适用于非常接近椭球中心的点。</div><div class="notion-text notion-block-ed55366979434ec3aebe6241d80c068f">把(3.13)函数求导函数可得：</div><div class="notion-row notion-block-f8c2b193fd57401bae3b0c3f2679cd21"><div class="notion-column notion-block-6c33d974ee764d5daff4c281e217db2e" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.875)"><div class="notion-text notion-block-8cf13dc128964caa885c73e4ac1894d9"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></div><div class="notion-spacer"></div><div class="notion-column notion-block-0a2c91c6854849c080a73e2fd1f38cf6" style="width:calc((100% - (1 * min(32px, 4vw))) * 0.12500000000000003)"><div class="notion-text notion-block-69263dcee85147f29bdfecd42d436a42">(3.14)</div></div><div class="notion-spacer"></div></div><div class="notion-text notion-block-fb8c0e7459c545509a938a02807c560d">在迭代过程中求得的<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>,代入到(3.13)中求得的<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>越接近于0，说明解越精确。根据迭代公式<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>可得：</div><div class="notion-text notion-block-5087b37976344f19b158c1a0deaffb65"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-da0598aa1a5248a0aa47fd1d1b5a37f2">详细的计算过程就不在罗列。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-05a110b86a794fe2a2d2d72d80f8359b" data-id="05a110b86a794fe2a2d2d72d80f8359b"><span><div id="05a110b86a794fe2a2d2d72d80f8359b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#05a110b86a794fe2a2d2d72d80f8359b" title="JL4"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">JL4</span></span></h3><div class="notion-text notion-block-7c5ef18ce83b43018af6451e093beb7d">名称：ScaleToGeodeticSurface</div><div class="notion-text notion-block-8c82014e2ccd493b8386db05201d87b4">文字表述：已知空间直角坐标系中的某一点和椭球体，能计算出点<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>沿大地表面法线方向延长线与椭球体表面的交点。</div><div class="notion-text notion-block-f8c119d66de54195953e3d6c283a3f69">函数表述：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">//p是空间直角坐标系的某一点
//e是椭球体默认值为WGS84椭球体
//返回：点p的空间直角坐标系坐标
JL4 = (p:Vec3,e:Ellipsoid = WGS84Ellipsoid)⇒Vec3</code></pre><ol start="1" class="notion-list notion-list-numbered notion-block-8087d63680a44f16b05fccd7a026ad23"><li>最终的计算</li></ol><div class="notion-text notion-block-86b13d857431445889af02a89673c840">已知有(3.2)公式，归一化大地表面法线<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>则：</div><div class="notion-text notion-block-1dd828b2c3be4c33bac568c91a9a148c"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-7a89d95bda7749c58165910b976ea01d">则经纬度分别为：
<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-4f781826d8854a5fa237bdd420e4bd65">高度为：<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，</div><div class="notion-text notion-block-d9a05c727c7348e09e6dfab5990163f7"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-d3b78c3cacdb43c7affead183e5d0ad3">我们获得了最终的结果<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-d912df8af90543ef85731a4593ad1004" data-id="d912df8af90543ef85731a4593ad1004"><span><div id="d912df8af90543ef85731a4593ad1004" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d912df8af90543ef85731a4593ad1004" title="JL5"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">JL5</span></span></h3><div class="notion-text notion-block-73b548805e574933ba96588e2e2401ab">名称：CartesianToCartographic</div><div class="notion-text notion-block-01a5f26e942f48e08e0f1d3c53df92a5">文字表述：已知空间直角坐标系中的某一点和椭球体，能计算出该点的经纬度表示</div><div class="notion-text notion-block-10f8b1ccf5a1482180d0b5efc3ad7816">函数表述：</div><pre class="notion-code"><div class="notion-code-copy"><div class="notion-code-copy-button"><svg fill="currentColor" viewBox="0 0 16 16" width="1em" version="1.1"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg></div></div><code class="language-typescript">//p是空间直角坐标系的某一点
//e是椭球体默认值为WGS84椭球体
//返回：点p的空间直角坐标系坐标
JL5 = (p:Vec3,e:Ellipsoid = WGS84Ellipsoid)⇒Vec3</code></pre><div class="notion-blank notion-block-60cafeff14de4a658f81b143ddefed05"> </div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>