使用 Openlayers3 放置静态图像时出错(在 OL2 中工作正常)
Error placing a static image with Openlayers3 (works fine in OL2)
使用最新版本的 Openlayers 3,我无法在地图上正确加载静态图像。经过一些测试(类似配置),我发现图像在OL2上看起来很好,而在OL3上它有几公里的位移,如下图所示:
我已经用那个例子做了一个 plunker。可能是错误还是我遗漏了什么?
http://plnkr.co/lzAKNGdkXkz6ZCM9H6ml
/* OL3 */
var graphicOL3 = new ol.layer.Image({
source: new ol.source.ImageStatic({
url: 'https://raw.githubusercontent.com/VictorVelarde/ImagenEstuario/master/Composite.png',
imageSize: [864, 1024],
imageExtent: [-791350.472638389, 5376837.581117962, -778150.4726383891, 5398392.773800777]
})
});
var osm = new ol.layer.Tile({
source: new ol.source.OSM()
});
mapaOL3 = new ol.Map({
layers: [osm],
target: 'mapaOL3',
view: new ol.View({
center: [-784751.048, 5389384.957],
zoom: 13
})
});
mapaOL3.addLayer(graphicOL3);
(完整示例代码在这里 --> http://plnkr.co/edit/lzAKNGdkXkz6ZCM9H6ml?p=preview)
谢谢,
终于是OL3库的bug了。他们在这张票上解决了这个问题:https://github.com/openlayers/ol3/pull/4426 It´s not yet implemented on the last release version (3.11.2) so if you face this problem you have to point to the master: http://openlayers.org/en/master/build/ol.js
使用最新版本的 Openlayers 3,我无法在地图上正确加载静态图像。经过一些测试(类似配置),我发现图像在OL2上看起来很好,而在OL3上它有几公里的位移,如下图所示:
我已经用那个例子做了一个 plunker。可能是错误还是我遗漏了什么? http://plnkr.co/lzAKNGdkXkz6ZCM9H6ml
/* OL3 */
var graphicOL3 = new ol.layer.Image({
source: new ol.source.ImageStatic({
url: 'https://raw.githubusercontent.com/VictorVelarde/ImagenEstuario/master/Composite.png',
imageSize: [864, 1024],
imageExtent: [-791350.472638389, 5376837.581117962, -778150.4726383891, 5398392.773800777]
})
});
var osm = new ol.layer.Tile({
source: new ol.source.OSM()
});
mapaOL3 = new ol.Map({
layers: [osm],
target: 'mapaOL3',
view: new ol.View({
center: [-784751.048, 5389384.957],
zoom: 13
})
});
mapaOL3.addLayer(graphicOL3);
(完整示例代码在这里 --> http://plnkr.co/edit/lzAKNGdkXkz6ZCM9H6ml?p=preview)
谢谢,
终于是OL3库的bug了。他们在这张票上解决了这个问题:https://github.com/openlayers/ol3/pull/4426 It´s not yet implemented on the last release version (3.11.2) so if you face this problem you have to point to the master: http://openlayers.org/en/master/build/ol.js