MCP 服务器投影( cartographic projections and coordinate transformations) 能够实现不同坐标系统之间的转换,为地理数据处理提供了便利。
服务器实现了两个坐标转换工具:
转换坐标
示例:从 WGS84(EPSG:4326)转换到正交投影
输入:
- source_crs: EPSG:4326
- target_crs: +proj=ortho +lon_0=112.364017384874 +lat_0=34.9227297291321 +a=6371010 +units=m +no_defs
- coordinates: [112.364017384874, 34.9227297291321]
输出:
- 转换后的坐标:[0.00000000, 0.00000000]
列出支持的 CRS
要调试服务器,请按照以下步骤操作:
npm install mcp-proj
inspector.cmd --host localhost:3000
以下是服务器的配置信息:
const development = {
port: 3000,
host: 'localhost',
db: {
url: 'mongodb://localhost:27017',
name: 'mcp_proj'
}
}
const production = {
port: 80,
host: 'api.mcp.com',
db: {
url: 'mongodb://db:mongo@cluster0.mongodb.net/test',
name: 'mcp_prod'
}
}
GEOGCS["WGS 84",
DATUM["WGS84",
SPHEROID["WGS84",6378137,2550000.001,
AUTHORITY["EPSG","7008"]],
AUTHORITY["EPSG","6085]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["Degree",0.01745329251994329,
AUTHORITY["EPSG","9108"]],
AUTHORITY["EPSG","4326"]]
PROJCS["WGS84 / Web Mercator",
DATUM["WGS84",
SPHEROID["WGS84",6378137,2550000.001,
AUTHORITY["EPSG","7008"]],
AUTHORITY["EPSG","6085]],
PRIMEM["Greenwich",0],
UNIT[" metre",1],
PROJECTION["Mercator_1SP",
PARAMETER["central_meridian",0],
PARAMETER["latitude_of_origin",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0]],
AUTHORITY["EPSG","3857"],
AXIS["X",EAST],
AXIS["Y",NORTH]]
+proj=longlat +datum=WGS84 +no_defs +type=crs
+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +no_defs
有关坐标系统的更多信息,请访问:https://epsg.io/ 如果对 JavaScript 实现的坐标转换感兴趣,可以查看:https://github.com/proj4js/proj4js