GitHub 仓库

访问 GitHub 获取完整的示例代码和项目模板

访问 GitHub

代码示例

Epoch GisServer MCP 调用示例

import requests

# Epoch GisServer MCP 接口地址
url = "http://localhost:8080/mcp"

# 构建请求参数
params = {
    "action": "getMap",
    "layer": "roads",
    "bbox": "116.0,39.0,117.0,40.0",
    "width": 800,
    "height": 600
}

# 发送请求
response = requests.get(url, params=params)

# 保存结果
with open("map.png", "wb") as f:
    f.write(response.content)

print("地图获取成功!")

Epoch GisServer WMS 服务加载

// 使用 Leaflet 加载 Epoch GisServer 发布的 WMS 服务
const map = L.map('map').setView([39.9, 116.4], 10);

// 添加 Epoch GisServer WMS 图层
L.tileLayer.wms('http://localhost:8080/wms', {
    layers: 'cities,roads',
    format: 'image/png',
    transparent: true,
    attribution: 'GeoEpoch'
}).addTo(map);

Epoch TileBuilder CLI 使用

# 切片影像数据
epoch-tilebuilder --input input.tif \
  --output tiles \
  --format tms \
  --min-zoom 0 \
  --max-zoom 10

# 切片矢量数据
epoch-tilebuilder --input input.shp \
  --output tiles \
  --format mvt \
  --min-zoom 0 \
  --max-zoom 10

使用说明

1

克隆仓库

git clone https://github.com/geoepoch/geoepoch.git
2

安装依赖

pip install requests    # Python 示例
npm install leaflet     # JavaScript 示例
3

运行示例

按照示例代码中的说明运行程序,并根据您的实际需求修改配置参数。