侧边栏壁纸
博主头像
YouGIS博文 - YouGIS顽石工坊 博主等级

行动起来,活在当下

  • 累计撰写 16 篇文章
  • 累计创建 5 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

坐标转换接口完全指南 - 一看就会,一用就灵

Administrator
2026-02-24 / 0 评论 / 0 点赞 / 15 阅读 / 0 字

主页:yougis.com.cn
博文:
blog.yougis.com.cn
工具:
yougis.com.cn/tool/home

qr-wechat.jpg

扫码获取更多精彩内容

点击试用坐标转换服务

扫码关注公众号(yougis),回复坐标转换服务-源码,即可获取Python源码;回复坐标转换服务-镜像,即可获取Docker镜像

坐标转换接口完全指南 - 一看就会,一用就灵

前言

YouGIS坐标转换服务提供了一套简洁易用的RESTful API接口,支持多种坐标系之间的相互转换。本文将详细介绍各个接口的使用方法,帮助你快速集成坐标转换功能到你的应用中。

在线服务地址

https://yougis.com.cn/coord-transform

接口一:查询支持的转换方法

功能说明

获取服务支持的所有坐标转换方法列表。

接口地址

GET/POST https://yougis.com.cn/coord-transform/about

请求参数

无需参数

返回示例

{
    "methods": [
        "gcj02_to_bd09",
        "bd09_to_gcj02",
        "wgs84_to_gcj02",
        "gcj02_to_wgs84",
        "bd09_to_wgs84",
        "wgs84_to_bd09",
        "wgs84_to_cgcs2000",
        "cgcs2000_to_wgs84",
        "wgs84_to_3857",
        "3857_to_wgs84",
        "cgcs2000_to_gcj02",
        "gcj02_to_cgcs2000",
        "cgcs2000_to_tmerc",
        "tmerc_to_cgcs2000",
        "wgs84_to_tmerc",
        "tmerc_to_wgs84",
        "gcj02_to_tmerc",
        "tmerc_to_gcj02",
        "bd09_to_tmerc",
        "tmerc_to_bd09"
    ],
    "name": "coord-transform",
    "version": "20240830"
}

接口二:单个坐标转换

功能说明

转换单个坐标点。

接口地址

GET/POST https://yougis.com.cn/coord-transform/convert

请求参数

参数名

类型

必选

说明

method

string

坐标转换方法名称

x

float

经度/投影x坐标

y

float

纬度/投影y坐标

epsg

int

横轴墨卡托投影EPSG代号

lat_0

float

中央经线的纬线,默认0

lon_0

float

中央经线

x_0

float

x方向偏移量,默认500000

y_0

float

y方向偏移量,默认0

k

float

比例因子,默认1

ellps

string

参考椭球体,默认GRS80

示例1:百度坐标转火星坐标(简单转换)

https://yougis.com.cn/coord-transform/convert?method=bd09_to_gcj02&x=114.31175375989858&y=30.598604365240018

返回结果:

{
    "x": 114.30517272808545,
    "y": 30.592936340516967
}

示例2:国家2000转高斯克吕格投影(使用EPSG)

https://yougis.com.cn/coord-transform/convert?method=cgcs2000_to_tmerc&x=114.31175375989858&y=30.598604365240018&epsg=4548

返回结果:

{
    "x": 242146.0207406803,
    "y": 3389553.714790838
}

示例3:高斯克吕格投影转国家2000(使用lon_0)

https://yougis.com.cn/coord-transform/convert?method=tmerc_to_cgcs2000&x=242146.0207406803&y=3389553.714790838&lon_0=117

返回结果:

{
    "x": 114.31175375989858,
    "y": 30.598604365240014
}

接口三:批量坐标转换(坐标分开传参)

功能说明

批量转换多个坐标点,x和y分别以数组形式传入。

接口地址

POST https://yougis.com.cn/coord-transform/multi-convert

请求参数(JSON格式)

参数名

类型

必选

说明

method

string

坐标转换方法名称

x

array

经度/投影x坐标数组

y

array

纬度/投影y坐标数组

epsg

int

横轴墨卡托投影EPSG代号

lat_0

float

中央经线的纬线,默认0

lon_0

float

中央经线

x_0

float

x方向偏移量,默认500000

y_0

float

y方向偏移量,默认0

k

float

比例因子,默认1

ellps

string

参考椭球体,默认GRS80

请求示例

{
    "method": "bd09_to_gcj02",
    "x": [114.31175375989858, 114.31175375989858, 114.31175375989858],
    "y": [30.598604365240018, 30.598604365240018, 30.598604365240018]
}

返回示例

{
    "x": [114.30517272808545, 114.30517272808545, 114.30517272808545],
    "y": [30.592936340516967, 30.592936340516967, 30.592936340516967]
}

接口四:批量坐标转换(坐标对数组)

功能说明

批量转换多个坐标点,以[[x,y],…,[x,y]]格式传入。

接口地址

POST https://yougis.com.cn/coord-transform/multi-convert2

请求参数(JSON格式)

参数名

类型

必选

说明

method

string

坐标转换方法名称

coords

array

[[x,y],…,[x,y]]格式坐标对数组

epsg

int

横轴墨卡托投影EPSG代号

lat_0

float

中央经线的纬线,默认0

lon_0

float

中央经线

x_0

float

x方向偏移量,默认500000

y_0

float

y方向偏移量,默认0

k

float

比例因子,默认1

ellps

string

参考椭球体,默认GRS80

请求示例

{
    "method": "bd09_to_gcj02",
    "coords": [
        [114.31175375989858, 30.598604365240018],
        [114.31175375989858, 30.598604365240018],
        [114.31175375989858, 30.598604365240018]
    ]
}

返回示例

[
    [114.30517272808545, 30.592936340516967],
    [114.30517272808545, 30.592936340516967],
    [114.30517272808545, 30.592936340516967]
]

接口五:WKT几何对象转换

功能说明

批量转换WKT格式的几何对象。

接口地址

POST https://yougis.com.cn/coord-transform/convert-wkts

请求参数(JSON格式)

参数名

类型

必选

说明

method

string

坐标转换方法名称

wkts

array

WKT格式几何对象数组

epsg

int

横轴墨卡托投影EPSG代号

lat_0

float

中央经线的纬线,默认0

lon_0

float

中央经线

x_0

float

x方向偏移量,默认500000

y_0

float

y方向偏移量,默认0

k

float

比例因子,默认1

ellps

string

参考椭球体,默认GRS80

请求示例

{
    "method": "bd09_to_gcj02",
    "wkts": [
        "POINT (114.31175375989858 30.598604365240018)",
        "LINESTRING (114.31175375989858 30.598604365240018, 114.32175375989858 30.608604365240018)"
    ]
}

返回示例

[
    "POINT (114.30517272808545 30.592936340516967)",
    "LINESTRING (114.30517272808545 30.592936340516967, 114.31517272808545 30.602936340516967)"
]

使用提示

  1. EPSG查询:涉及高斯克吕格投影时,可访问 https://epsg.io/?q=CGCS2000 查询对应的EPSG代号

  2. 参数选择:使用epsg参数时,无需指定lat_0、lon_0、x_0、y_0、k、ellps参数

  3. 批量转换:大量坐标转换建议使用批量接口,效率更高

  4. 跨域支持:接口支持CORS,可直接在浏览器中调用

快速链接

更多精彩内容

坐标转换神器!一个接口搞定所有坐标系转换
深度解析:pyproj库如何实现专业级坐标转换
坐标转换服务私有化部署指南 - 源码与Docker两种方案

0

评论区