【解决办法】在地图服务的prjCoordSys资源获取wkt坐标系信息,获取位置如图:贴图
获取完成后通过wkt在MapboxGL加载,需要引入mapbox-gl-enhance:
示例代码如下:
var WKT = 'PROJCS["CGCS2000_3_Degree_GK_CM_116E",GEOGCS["GCS_China_2000",DATUM["D_China_2000",SPHEROID["CGCS2000",6378137.0,298.257222101,AUTHORITY["EPSG","7044"]]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["DEGREE",0.017453292519943295],AUTHORITY["EPSG","4490"]],PROJECTION["Transverse_Mercator",AUTHORITY["EPSG","9807"]],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",116.0],PARAMETER["Latitude_Of_Origin",0.0],PARAMETER["Scale_Factor",1.0],UNIT["METER",1.0],AUTHORITY["EPSG","4490"]]'
var map = new mapboxgl.Map({
container: 'map',
style: 'http://localhost:8090/iserver/services/map-mvt-City1/rest/maps/City1/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true&tileURLTemplate=ZXY',
// mapboxgl.CRS(name,wkt,extent);
// name:坐标系名称,必填
// wkt:坐标系的WKT或者Proj4表述,必填。
// extent: 当前坐标系范围,[左,下,右,上]
crs: new mapboxgl.CRS('2000地方', WKT, [-3258341.95 , 700013.44, 1909139.08 , 5962850.53]),
center: [104.29411212318577,29.941653923532186],
zoom: 3,
renderWorldCopies: false,
});
map.addControl(new mapboxgl.NavigationControl());