我的代码显示了来自GeoJSON的标记,当我放大到10级时,它加载了GeoJSON文件,但是我如何避免重新输出相同的标记?有没有办法检查在特定的地方是否已经存在一个标记?代码
map.events.register("zoomend", null, function(){
if(map.zoom == 10)
{
var bounds = map.getExtent();
console.log(bounds);
var ne = new OpenLayers.LonLat(bounds.right,bo
目前,我正在尝试更改用户关注的矢量层的特定功能的图标。我将每个要素添加到地图中,如下所示:
var point = new OpenLayers.Geometry.Point(pt.lon, pt.lat);
var markerStyle = OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'], {
externalGraphic: iconURL
});
var marker = new OpenLayers.Feature.Vector(point, attributes, mark
我正在做https://openlayers.org/en/latest/examples/gpx.html上提供的openlayers 5.x的GPX源代码示例。 我能够成功地加载我的GPX文件并将其显示在地图上,但我无法获得其范围以了解最小/最大纬度和经度,以便在地图上动态地适应它。 这是我的代码(与示例相同): var GpxVector = new VectorLayer({
source: new VectorSource({
url: 'https://host.domain.com/filename.gpx',
format: ne
我有一个OpenLayers.Map (map),它有一个OpenLayers.Layer.Vector (map.addLayer(vectorLayer)),我使用vectorLayer.addFeatures将一系列OpenLayers.Feature.Vector对象添加到vectorLayer中。
这个过程有点像这样:
var map, vectorLayer;
function initialize()
{
map = new OpenLayers.Map(/*...*/);
vectorLayer = new OpenLayers.Layer.Vector(/*.
我在使用OpenLayers捕捉功能时遇到问题。我需要在我的地图上有几个图层,并在所有图层上使用捕捉。我尝试了一个创建集合的选项,但它不起作用。另一种选择确实有效,但我不知道它是否是最优的,我需要确认是否还有其他选择。 我已经创建了一个关于OpenLayers应用编程接口文档的集合,我有几个层 //Map layers added
var raster = new TileLayer({
source: new OSM()
});
var vectorLayer = new VectorLayer({
source: new VectorSource({
当我在Openlayers中加载大约500个矢量特征时,平板电脑和电话上的性能严重下降。我的解决方案是清除地图的moveend事件的源代码。这是可行的,但会导致恼人的闪光,大概是在清除和重新加载源代码之间。
这种“闪存”的早期解决方案不再有效,它会导致对WFS的递归调用。
下面是我当前的代码:
import {GeoJSON} from 'ol/format';
import {bbox as bboxStrategy} from 'ol/loadingstrategy.js';
import VectorSource from 'ol/source/V
我在地图上有一些要素,在我移动它们之后,使用
var point = new OpenLayers.LonLat(newlon, newlat);
point.transform(epsg4326, projectTo);
VectorLayer.features[0].geometry.move(point);
功能如预期的那样显示在新的位置,但只要我改变缩放级别,功能就会消失。有人知道为什么吗?
背景
规范
OpenLayers 4.4.1
OSM
我对OpenLayers相当陌生,以前从未使用过向量(主要是因为我发现自己使用的是OpenLayers版本1,必须重新学习一切)。
我的应用程序在地图上添加圆圈与特定半径的位置相关,表示位置精度。
在其操作中,在不同的时间将多个圆添加到映射中。
这是我加载地图的代码:
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: