-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WrapX doesn't work When I use custom coordinate system BD09; #15844
Comments
Using the example in #10374 (comment) you would need to make the projection global for the view to wrap. However the Baidu tiles overflow the projection extent and do not render correctly when the view wraps if the source projection is set as global. To overcome that you must define two projections https://codesandbox.io/s/xyz-forked-hj52y7?file=/index.js |
感谢回复, 我需要定义两个坐标系是嘛? 但是下面这个地址 我不能访问成功 |
The same example using StackBlitz https://stackblitz.com/edit/js-23bvsn?file=index.js,package.json,index.html |
Thank you very much, tested to work fine |
@mike-000 你好 我按照上述方法 添加了个 额外的 baiduG 的坐标系,并且在初始化 view的时候 使用的是BD09G, 现在遇到一个问题 我们在缩放或者移动地图的时候 会出现 空白区域,且我看了network下瓦片请求没有出现404或者异常的情况。但当我们将view下使用的坐标系改成 BD09 则不会有此问题 。我观察了 BD09与BD09G的差异 就在与 global 配置。 请问出现这种情况 有合适的解决方案嘛 ? const createBD09 = () => {
// 创建百度墨卡托坐标系
const baiduMercator = new Projection({
code: BD09,
units: 'm',
extent: bd09Extent
})
// 添加百度墨卡托坐标系
addProjection(baiduMercator)
// 添加百度墨卡托坐标系与WGS84坐标系之间的转换
addCoordinateTransforms(
'EPSG:4326',
baiduMercator,
projzh.ll2bmerc,
projzh.bmerc2ll
)
// 添加百度墨卡托坐标系与墨卡托坐标系之间的转换
addCoordinateTransforms(
'EPSG:3857',
baiduMercator,
projzh.smerc2bmerc,
projzh.bmerc2smerc
)
}
const createBD09G = () => {
// 创建百度墨卡托坐标系
const baiduMercatorG = new Projection({
code: BD09G,
units: 'm',
extent: bd09Extent,
global: true
})
// 添加百度墨卡托坐标系
addProjection(baiduMercatorG)
// 添加百度墨卡托坐标系与WGS84坐标系之间的转换
addCoordinateTransforms(
'EPSG:4326',
baiduMercatorG,
projzh.ll2bmerc,
projzh.bmerc2ll
)
// 添加百度墨卡托坐标系与墨卡托坐标系之间的转换
addCoordinateTransforms(
'EPSG:3857',
baiduMercatorG,
projzh.smerc2bmerc,
projzh.bmerc2smerc
)
}
function getProjectionByOptions(options) {
let gisEngine = options.gisEngine;
let size = options.size;
let projection = 'EPSG:3857';
switch (gisEngine) {
case Default.gisEngineKey.BAIDU_ONLINE:
case Default.gisEngineKey.BAIDU_OFFLINE:
projection = BD09G;
// projection = BD09;
break;
case Default.gisEngineKey.BITMAP:
projection = new Projection({
code: 'xkcd-image',
unit: 'pixels',
extent: [0, 0, size.w, size.h]
});
break;
default:
break;
}
return projection;
}
....
view = new View({
center,
minZoom,
extent: extent ? extent : undefined,
zoom,
maxZoom,
projection: getProjectionByOptions(params),
constrainResolution: true,
smoothResolutionConstraint: false
}); |
When I use the custom coordinate system BD09, the WrapX configuration does not take effect, and it cannot be dragged infinitely
openlayer version: 6.1.0
当我使用自定义百度的BD09坐标系,发现不能无限制的拖动至全球范围,
The text was updated successfully, but these errors were encountered: