我有个问题.我需要知道开放图层地图的实际缩放
$scope.refreshMap = function (lat, long) {
map.setView(new ol.View({
projection: 'EPSG:4326',
center: [long, lat],
zoom: "here I do not know what to put"
}));
};
Run Code Online (Sandbox Code Playgroud)
我尝试map.getZoom()但它不起作用.logcat会让我失望
Uncaught TypeError: Object #<S> has no method 'getZoom'
Run Code Online (Sandbox Code Playgroud)
我正在使用openlayers版本:v3.16.0
我正在开发一个openlayers 3项目,使用typescript开发,因此:
let ol = require("openlayers");
Run Code Online (Sandbox Code Playgroud)
我想使用转换扩展插件,它不在NPM上发布(http://viglino.github.io/ol3-ext/interaction/transforminteraction.js)
我尝试了以下方法:
let ol = require("openlayers");
require("<path>/ol/transforminteraction");
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
错误TypeError:ol.interaction.Transform不是构造函数
和
未捕获的ReferenceError:ol未定义
我如何才能正确包含/整合此资源?
我正在使用OpenLayers 3在Angular/Ionic移动应用程序中显示室内地图.这些地图是静态图像,我将其置于OpenLayers地图之上.
我正在创建地图并添加如下图像层.
var extent = ol.proj.transformExtent([-79.180360, 37.351251, -79.179148, 37.349640], 'EPSG:4326', 'EPSG:3857');
var layer = new ol.layer.Tile({
source: new ol.source.OSM()
});
var view = new ol.View({
center: ol.extent.getCenter(extent),
zoom: 18,
rotation: 0
});
// Setting the Overlay Image
var image = new ol.layer.Image({
source: new ol.sourceImageStatic({
url: 'http://www.exampleimageurl.png'
imageExtent: extent
})
});
var map = new ol.Map({
target: 'indoor-map',
layers: [layer, image],
view: view
});
Run Code Online (Sandbox Code Playgroud)
上面的代码确实在地图上显示了一个图像,但它没有正确定位.
我正在假设在OpenLayers中,我们需要设置包含图像的范围,从而确定图像在地图上的位置.
基于此:
如果我们有图像的4个角的坐标,我们如何确定图像的真实范围?
我们如何获得建筑楼层地图以实际覆盖建筑物.
建筑物实际上向左旋转.查看Google地图截图.
我是 openlayer 地图的新手,当您单击复选框时,它将以完全放大的方式在屏幕上显示制造商,但我想以 11 级的缩放级别在屏幕上显示制造商。
map.getView().fit(source.getExtent(), map.getSize());
Run Code Online (Sandbox Code Playgroud) 有没有办法为 openlayers 4+ 的 ol.style.Text 类设置多种字体颜色?
我正在尝试做类似的事情
const label = new ol.style.Style({
text: new ol.style.Text({
text: '<color1>X</color1> other text',
textAlign: 'center',
font: '11px roboto,sans-serif',
fill: new ol.style.Fill({
color: 'white'
}),
stroke: new ol.style.Stroke({
color: 'black',
lineCap: 'butt',
width: 4
}),
offsetX: 0,
offsetY: 25.5,
})
Run Code Online (Sandbox Code Playgroud)
由于“其他文本”的长度或宽度未知且 textAlign 必须设置为居中,因此我无法添加两个 ol.style.Text 类并将它们并排放置。
提前致谢
我有一张地图,上面有一些功能,当我缩放到这些功能时,用户可以设置缩放缓冲区的首选项。
我不确定 OL 中是否有内置的方法来执行此操作...我查看了文档,但看不到任何内容...不确定我是否错过了它?
zoomToSelectedFeatures() {
view.extent = MapOverlay.getSource().getExtent();
map.getView().fit(view.extent, MapValues.map.getSize());
}
Run Code Online (Sandbox Code Playgroud)
想知道是否有一种方法可以插入一个数字(例如 20%),从而使变焦放大 20%?
openlayers ×4
openlayers-3 ×3
angularjs ×1
javascript ×1
openlayers-5 ×1
openlayers-6 ×1
typescript ×1