Go to file
2026-01-09 19:05:06 +08:00
static first 2026-01-09 18:52:32 +08:00
templates first 2026-01-09 18:52:32 +08:00
.gitignore Enhance main.go by embedding static files and templates, improve logging during service startup, and update README with detailed API Key instructions and deployment steps. 2026-01-09 19:05:06 +08:00
build-linux.bat Refactor main.go to embed static files and templates, update logging for service start, and enhance README with API Key instructions and deployment steps. 2026-01-09 18:59:41 +08:00
build.bat Refactor main.go to embed static files and templates, update logging for service start, and enhance README with API Key instructions and deployment steps. 2026-01-09 18:59:41 +08:00
config.example.json first 2026-01-09 18:52:32 +08:00
config.json first 2026-01-09 18:52:32 +08:00
go.mod first 2026-01-09 18:52:32 +08:00
go.sum first 2026-01-09 18:52:32 +08:00
main.go Refactor main.go to embed static files and templates, update logging for service start, and enhance README with API Key instructions and deployment steps. 2026-01-09 18:59:41 +08:00
meeting-point-linux-amd64 Refactor main.go to embed static files and templates, update logging for service start, and enhance README with API Key instructions and deployment steps. 2026-01-09 18:59:41 +08:00
README.md Refactor main.go to embed static files and templates, update logging for service start, and enhance README with API Key instructions and deployment steps. 2026-01-09 18:59:41 +08:00

会面点 Meeting Point

一个帮助多人寻找最佳聚会地点的地图应用。输入多个参与者的位置自动计算几何中心并在中心点附近搜索咖啡馆、餐厅、KTV 等聚会场所。

功能特点

  • 📍 多点位置设置

    • 通过地址搜索添加位置(支持输入提示和自动补全)
    • 直接在地图上点击添加位置
    • 支持删除和管理已添加的位置
  • 🎯 智能中心计算

    • 使用球面几何算法计算多点中心
    • 准确计算地球曲面上的几何中心
  • 🔍 周边搜索

    • 支持自定义搜索关键词
    • 可调节搜索半径500米-10公里
    • 预设常用场所类型咖啡馆、餐厅、网咖、棋牌室、KTV等
    • 搜索结果支持名称/地址筛选
  • 🗺️ 地图可视化

    • 深色主题地图
    • 清晰的标记和信息展示
    • 搜索范围可视化
    • 半透明信息窗口
  • 🧭 导航功能

    • 点击搜索结果可查看详情
    • 一键跳转高德地图导航

🚀 快速开始

方式一:下载可执行文件(推荐)

  1. 从 Releases 下载对应系统的可执行文件
  2. 创建 config.json 配置文件
  3. 运行程序

方式二:从源码构建

前置要求

  • Go 1.21+
  • 高德地图开发者账号

获取高德地图 API Key

  1. 访问 高德开放平台
  2. 注册/登录开发者账号
  3. 进入「控制台」→「应用管理」→「创建新应用」
  4. 添加两个 Key
    • Web服务 类型 - 用于后端 API 调用
    • Web端(JS API) 类型 - 用于前端地图展示
  5. JS API Key 需要配置安全密钥

安装步骤

# 克隆项目
git clone https://github.com/yourusername/meeting-point.git
cd meeting-point

# 安装依赖
go mod download

# 复制配置文件
cp config.example.json config.json

# 编辑 config.json填入 API Key

# 启动服务
go run main.go

构建可执行文件

# Windows
go build -ldflags="-s -w" -o meeting-point.exe .

# Linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o meeting-point-linux-amd64 .

# macOS
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o meeting-point-darwin-amd64 .

⚙️ 配置说明

config.json

{
    "amap_key": "你的Web服务API_Key",
    "amap_js_key": "你的JS_API_Key",
    "amap_js_secret": "你的JS_API安全密钥",
    "port": "8080"
}
字段 必填 说明
amap_key 高德 Web 服务 API Key用于后端地理编码和 POI 搜索
amap_js_key 高德 JS API Key用于前端地图展示。不填则使用 amap_key
amap_js_secret 高德 JS API 安全密钥JS API 2.0 必需
port 服务端口,默认 8080

环境变量

环境变量优先级高于配置文件:

  • AMAP_KEY - 高德 Web 服务 API Key
  • PORT - 服务端口

📖 使用说明

添加位置

有两种方式添加参与者位置:

  1. 搜索添加:在左侧搜索框中输入地址或地点名称,从下拉列表中选择
  2. 点击添加:直接在地图上点击想要添加的位置

搜索聚会地点

  1. 添加至少 2 个位置点
  2. 在「搜索类型」中输入或选择想要查找的场所类型
  3. 调整搜索半径
  4. 点击「搜索最佳会面点」按钮

查看结果

  • 地图上会显示计算出的中心点(金色星星标记)
  • 搜索到的场所会以绿色标记显示
  • 右侧浮动面板显示搜索结果列表
  • 支持按名称/地址筛选结果
  • 点击结果项可在地图上定位并显示详情
  • 点击「导航前往」可跳转高德地图导航

🏗️ 技术架构

后端

  • Go - 高性能后端语言
  • Gin - Web 框架
  • embed - 静态资源嵌入(单文件部署)
  • 高德地图 Web API - 地理编码、POI 搜索

前端

  • 原生 JavaScript - 无框架依赖
  • 高德地图 JS API 2.0 - 地图展示和交互
  • CSS3 - 现代化深色主题 UI

API 端点

方法 路径 说明
GET / 主页面
GET /api/config 获取配置
POST /api/geocode 地址转坐标
POST /api/center 计算中心点
POST /api/search 搜索周边 POI
GET /api/tips 输入提示

📁 项目结构

meeting-point/
├── main.go              # 后端主程序(包含嵌入的静态资源)
├── go.mod               # Go 模块文件
├── go.sum               # 依赖锁定文件
├── config.json          # 配置文件(需创建)
├── config.example.json  # 配置文件模板
├── build.bat            # Windows 构建脚本
├── build-linux.bat      # Linux 构建脚本
├── README.md            # 项目说明
├── templates/
│   └── index.html       # 前端页面模板
└── static/
    ├── css/
    │   └── style.css    # 样式文件
    └── js/
        └── app.js       # 前端逻辑

🐧 Linux 部署

# 上传可执行文件和配置文件到服务器

# 设置执行权限
chmod +x meeting-point-linux-amd64

# 创建配置文件
cat > config.json << 'EOF'
{
    "amap_key": "你的Web服务API_Key",
    "amap_js_key": "你的JS_API_Key",
    "amap_js_secret": "你的JS_API安全密钥",
    "port": "8080"
}
EOF

# 前台运行
./meeting-point-linux-amd64

# 后台运行
nohup ./meeting-point-linux-amd64 > meeting-point.log 2>&1 &

# 使用 systemd 管理(推荐)
# 创建 /etc/systemd/system/meeting-point.service

📝 开发计划

  • 添加路线规划功能
  • 支持更多地图服务商
  • 添加位置分享功能
  • 移动端适配优化
  • 添加历史记录功能
  • Docker 容器化部署

📄 许可证

MIT License

🤝 贡献

欢迎提交 Issue 和 Pull Request