# @geogirafe/lib-geoportal 中文文档

规范地址：https://npmcn.com/package/%40geogirafe/lib-geoportal/

版本：1\.3\.0-dev\.3060317043
npm 元数据更新时间：2026-11-12T15:47:16.329Z
中文译文更新时间：2026-11-16T04:28:11.563Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40geogirafe/lib-geoportal
原文对照：https://npmcn.com/package/%40geogirafe/lib-geoportal/?lang=original
项目主页：https://doc.geogirafe.org/
源码仓库：https://gitlab.com/geogirafe/gg-viewer

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：3.6 MB，946 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=20\.19\.0
- 运行依赖：17 个
- peer 依赖：ol \>=10\.8，olcs 2，proj4 2，cesium \>1\.113，ol-ext 4，ol-mapbox-style \>=12，@geoblocks/print \>=0\.7\.9，@geoblocks/mapfishprint \>=0\.3
- 首次发布：2024-02-07T09:52:55.120Z
- 最新版本发布：2026-11-12T15:47:15.920Z
- 近 30 天下载量：6333（2026-10-16 至 2026-11-14，npm 官方下载统计）
- 已发布版本数：715（近 12 个月 237 个）

## 中文简介

GeoGirafe是构建在线地理学门户的灵活应用.

## 安装

```sh
npm install @geogirafe/lib-geoportal
```

也可以使用：`pnpm add @geogirafe/lib-geoportal`、`yarn add @geogirafe/lib-geoportal`、`bun add @geogirafe/lib-geoportal`

## README

[![Pipeline Status](https://gitlab.com/geogirafe/gg-viewer/badges/main/pipeline.svg)](https://gitlab.com/geogirafe/gg-viewer/-/pipelines) [![Docker Pulls](https://img.shields.io/docker/pulls/geogirafe/viewer.svg)](https://hub.docker.com/r/geogirafe/viewer/)

![GitLab Contributors](https://img.shields.io/gitlab/contributors/geogirafe/gg-viewer) ![GitLab Issues](https://img.shields.io/gitlab/issues/open-raw/geogirafe/gg-viewer) ![GitLab Merge Requests](https://img.shields.io/gitlab/merge-requests/open-raw/geogirafe/gg-viewer) ![GitLab last commit](https://img.shields.io/gitlab/last-commit/geogirafe/gg-viewer)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=bugs)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer)

[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=coverage)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer)

[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=geogirafe_gg-viewer&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=geogirafe_gg-viewer)

![GitLab License](https://img.shields.io/gitlab/license/geogirafe/gg-viewer)

# 乔治·吉拉夫

GeoGirafe是构建在线地理学门户的灵活应用. 此寄存器包含工程的网页查看器部分 .

项目文件见这里: [https://doc.geogirafe.org 互联网档案馆的存檔,存档日期2013-12-02](https://doc.geogirafe.org/)。 。 。 .  
GeoGirafe 的演示实例可在此测试: [https://demo.geomapfish.dev. 中国植物物种信息数据库](https://demo.geomapfish.dev/)。 。 。 .

## 目标

GeoGirafe的目标是便于实施稳定、高效和安全的地理门户。 GeoGirafe也是为了便于扩展,允许用户整合自己的插件.

由于GeoGirafe的主要用户不一定具备计算机开发的高级技能,我们希望有一个尽可能平滑的学习曲线. 这就是为什么该项目不使用最新的框架,偏好可读代码而不是符合某些任意"质量"标准的代码. GeoGirafe因此基于网络标准(Vanilla Web组件),并将依赖性的数量限制在其他图书馆.

## 发展哲学

GeoGirafe是根据以下原则开发的:

-   **儿童状况**:GeoGirafe很简单. 由纯瓦尼拉-贾瓦斯克丽普特开发. 没有使用React或Angular等复杂的框架. 如果你知道JavaScript,你可以理解它是如何工作的.
    
-   **函数**:GeoGirafe在软件生命周期的每个阶段都烘焙安全,以便交付安全逐一设计的应用程序. 索纳克卢德平台在不断整合的过程中检查质量、可读性、可靠性和安全性: [查看声纳云报告](https://sonarcloud.io/project/overview?id=geogirafe_gg-viewer)
    
-   **反应**: GeoGirafe 意在按照 [反应宣言](https://www.reactivemanifesto.org/)。 。 。 .
    
-   **敏捷性**:GeoGirafe正在按照Agile方法开发。 我们珍视个人合作,改变反应能力多于进程、工具和计划.
    
-   **无障碍**GeoGirafe正在尽其所能,使残疾人更容易获得网页内容: [查看波浪报告](https://wave.webaim.org/report#/https://demo.geomapfish.dev/mapbs/)。 。 。 .
    

## 建筑

以下详细解释GeoGirafe项目的建筑选择,包括战略目标和技术选择: [https://doc.geogirafe.org/docs/introduction/architecture 页面存档备份,存于互联网档案馆](https://doc.geogirafe.org/docs/introduction/architecture)。 。 。 .

# 开始

若你想从GeoGirafe开始 [https://hub.docker.com/r/geogirafe/viewer 互联网档案馆的存檔,存档日期2014-12-02](https://hub.docker.com/r/geogirafe/viewer)。 。 。 . 这将允许你得到一个运行的例子 GeoGirafe 用最小的努力. 请跟随"多克·赫克·雷克"中的小文档.

# 与GeoGirafe合作

## 发展

### 1\. 克隆库

首先,安装 [节点](https://nodejs.org/en/download/)。 。 。 .

然后,复制仓库:

```
git clone https://gitlab.com/geogirafe/gg-viewer.git
```

### 2\. 发展证书

某些特征(如服务人员)需要有效的HTTPS证书,才能在当地得到发展.  
您可以以 :

##### 在 Linux 上

_在 Linux 或 macOS 上,生成您自己的证书是强制性的(预生成的证书不会工作)._

```bash
npm run generate-dev-certs-nix
```

##### 在窗口上

```bash
npm run generate-dev-certs-win
```

### 3\. 建造和启动GeoGirafe

```bash
npm install
npm start
```

> 当在当地工作 认证, 更普遍与饼干, 浏览器将单标签域(没有任何点的域)与多标签域(至少有一个点的域)区别对待. 在单一标签域上设置的饼干往往被认为不太安全,因为它们更容易被偷取或被滥用。 因此,许多浏览器限制或不允许将 cookie 设定在像 `localhost`。 。 。 .
> 
> 因此,反对https://localhost **将不工作**,因为饼干无法正确设置.  
> 你必须用 [https://app.localhost (英语)](https://app.localhost/),这在本地与GeoGirafe合作时被定义为默认域.

进一步讨论:

-   [https://stackoverflow.com/ questions/7346919.chrome-localhost-cookie-not-ain-set 页面存档备份,存于互联网档案馆](https://stackoverflow.com/questions/7346919/chrome-localhost-cookie-not-being-set)
-   [https://stackoverflow.com/ questions/1134290/cookies-on-localhost- with-explict-domain (中文(中国大陆) )](https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain)

## 使用 VSCode 调试

如果您正在使用 VSCode , 则在 `.vscode` 目录.  
在您在开发模式下启动应用程序后, 请按 `F5`, VSCode 将附加在运行过程中。 然后您就可以调试您的代码 .

## 配置

应用程序的完整配置在文件中完成 `config.json`。 。 。 . 此配置将在应用程序启动时被动态加载 . 因此,在修改此文件时不需要重建工程 .

文件 `config.json` 默认不存在. 最简单的创建方式是,在 _演示_ 目录,并调整内容以适应您的需要.

您也可以通过使用 :

### 在 Linux 上

```bash
npm run configure-demo <environment>
```

### 在窗口上

```bash
npm run configure-demo-win <environment>
```

这将自动复制 `config.json` ,并下载所需的 Moock 对象.

> 请注意,GeoGirafe Viewer目前使用基于GeoMapFish的后端. 因此,您在配置中使用的服务必须符合GeoMapFish.

## 测试

GeoGirafe项目有两种测试:

### 单位数( 有vitest)

要运行单元, 请执行以下命令 :

```
npm run test
```

且道.

### 端到端测试( 有剧作家)

为了能够进行剧作家测试,首先安装了无头铬和火狐二进制:

```
npx playwright install
```

您必须启动应用程序 :

```
npm start
```

然后在另一个控制台 你可以运行测试:

```
npx playwright test
```

结果页会在测试结束时预示.

## 生产建筑

```bash
npm install
npm run build
```

这将输出一个完整的 GeoGirafe 应用程序, 可用 Web 服务器服务 很简单 [备忘/应用](https://npmcn.com/package/%40geogirafe/lib-geoportal/dist/app) 文件夹.

您可以尝试已建资产( 您需要此示例 ) :

```bash
docker run --rm -p 8088:80 -v $(pwd)/dist/app:/usr/share/nginx/html nginx:latest
```

这将旋转一个NGINX 你可以访问它 [app.localhost:8088 (英语)](http://app.localhost:8088/)。 。 。 .

新闻 `CTRL+C` 拦住集装箱.

## 建立国家预防机制一揽子计划

一定要运行命令 `npm login` 至少在一次之前

### 构建库

```bash
npm install
npm run build-lib
```

这将输出( 除其它部分外) GeoGirafe 库部分的转录版本 [点/点](https://npmcn.com/package/%40geogirafe/lib-geoportal/dist/lib)。 。 。 .

### 发布 Lib 软件包 [npmjs.com (英语)](https://npmcn.com/package/%40geogirafe/lib-geoportal/https.//npmjs.com)

```bash
npm run publish-lib --access public
```

## 构建 Android 应用程序

确定您之前已经构建了生产应用程序 `npm run build`。 。 。 .  
文件 `config.json` 包含在 `dist\app` 将使用目录.

```bash
npm run build-apk
```

这将输出一个 GeoGirafe 的 APK 软件包 [磁盘/磁盘](https://npmcn.com/package/%40geogirafe/lib-geoportal/dist/apk)。 。 。 .

## 部署

部署可采取两种方式:

### 使用已存在的 WebServer 服务器

建成后,所有需要部署的都放在 `public` 目录. 复制 `public` 任意网络服务器的目录内容,例如 `htdocs` 目录.

### 使用嵌入器

当工程建成后,您可以构建一个会包含应用程序的嵌入器图像:

```
docker build -t <your_name>/viewer -f buildtools/Dockerfile dist
```

然后,你可以开始:

```
docker run -p 8080:80 -p 8443:443 <your_name>/viewer
```

# 捐款

欢迎合并请求. 对于重大变动,请先开出一个问题来讨论你想要改变什么.  
此处提供捐款准则: [捐款额](https://npmcn.com/package/%40geogirafe/lib-geoportal/CONTRIBUTING.md)。 。 。 .  
**请在投稿前读一下.**

# 支助

支持GeoGirafe的方法很多.

-   您可以在您的项目上使用以下标签来帮助推广 GeoGirafe : [![GeoGirafe](https://geogirafe.org/wp-content/uploads/geogirafe-badge.svg)](https://geogirafe.org/)  
    代码 : `[![GeoGirafe](https://geogirafe.org/wp-content/uploads/geogirafe-badge.svg)](https://geogirafe.org)`
    
-   如果你有兴趣提供财政援助,请联系我们 [联系人@geogirafe.org](mailto:contact@geogirafe.org)。 。 。 .
    
-   如果你有另一个想法 如何支持这个项目, 我们邀请你加入我们 在专有的不和服务器: [https://discord.gg/kdrXjaqBbH 页面存档备份,存于互联网档案馆](https://discord.gg/kdrXjaqBbH)。 。 。 .
    

# 许可证

Apache 许可证,2.0版本

## 常见问题

### @geogirafe/lib-geoportal 是什么？

GeoGirafe是构建在线地理学门户的灵活应用\.

### 如何安装 @geogirafe/lib-geoportal？

在项目目录运行 npm install @geogirafe/lib-geoportal，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：ol（\>=10\.8）、olcs（2）、proj4（2）、cesium（\>1\.113）、ol-ext（4）、ol-mapbox-style（\>=12）、@geoblocks/print（\>=0\.7\.9）、@geoblocks/mapfishprint（\>=0\.3）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。它还提供命令行工具 lib-inline，可以用 npx lib-inline 直接运行。

### @geogirafe/lib-geoportal 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @geogirafe/lib-geoportal 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @geogirafe/lib-geoportal 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=20\.19\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @geogirafe/lib-geoportal 可以商用吗？

@geogirafe/lib-geoportal 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @geogirafe/lib-geoportal 的下载量有多少？

根据 npm 官方下载统计，@geogirafe/lib-geoportal 在 2026/10/16 – 2026/11/14 这 30 天内被下载 6,333 次，日均约 211 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @geogirafe/lib-geoportal 还在维护吗？

最新版本 1\.3\.0-dev\.3060317043 发布于 2026/11/12（3 天前）；至今共发布 715 个版本，其中过去 12 个月发布了 237 个；首次发布于 2024/02/07。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

