Comments (9)
I ran into exactly the same issue when I tried to upgrade OpenLayers to 9.0 on a hobby project. I have not investigated the root cause of this, but my guess is that it is z-index related.
I don't have a minimal example, but you can see it in action if you try to draw and edit geometries on https://65e0c1e274c18d0008ec2f89--orbat-mapper.netlify.app/scenario/demo-narvik40
It is not an issue when I have a simpler setup with no additional layers:
https://65e0c1e274c18d0008ec2f89--orbat-mapper.netlify.app/testgeo
from openlayers.
@eflowbeach @kjellmf It would be good to have a minimal standalone example (e.g. in a repository with code created with npm create ol-app my-app
, codesandbox or jsfiddle) to investigate this further.
from openlayers.
@ahocevar @kjellmf Ok, I think I figured it out! It's actually because I set declutter to true in a separate layer which causes the dot to disappear. Here's the bare bones code, sorry my organization doesn't allow npm...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Draw and Modify Features</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ol.css">
<style>
.map {
width: 100%;
height: 400px;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
<form>
<label for="type">Geometry type </label>
<select id="type">
<option value="Point">Point</option>
<option value="LineString">LineString</option>
<option value="Polygon">Polygon</option>
<option value="Circle">Circle</option>
</select>
</form>
<script>
const raster = new ol.layer.Tile({
source: new ol.source.OSM(),
});
const source = new ol.source.Vector();
const vector = new ol.layer.Vector({
source: source
});
const timeOfArrivalSource = new ol.source.Vector();
const timeOfArrivalLayer = new ol.layer.Vector({
source: timeOfArrivalSource,
visible: false,
declutter: true // <-------------------------- Adding this breaks it
});
// Limit multi-world panning to one world east and west of the real world.
// Geometry coordinates have to be within that range.
const map = new ol.Map({
layers: [raster, vector, timeOfArrivalLayer],
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],
zoom: 4,
// extent,
}),
});
const modify = new ol.interaction.Modify({ source: source });
map.addInteraction(modify);
let draw, snap; // global so we can remove them later
function addInteractions() {
draw = new ol.interaction.Draw({
source: source,
type: 'LineString'
});
map.addInteraction(draw);
snap = new ol.interaction.Snap({ source: source });
map.addInteraction(snap);
}
addInteractions();
</script>
</body>
</html>
from openlayers.
Thanks a lot @kjellmf. This is a good find and should be enough information to fix it.
from openlayers.
The problem is that array optimization is not as advanced as I thought in JavaScript - setting a very high zIndex on a style makes the ZIndexContext either extremely slow or break entierly. Working on a fix.
from openlayers.
Thank you @eflowbeach for investigating. I also have declutter=true
on a layer. If I change it to false
the editing styles reappear.
from openlayers.
I guess I also had to comment out zIndex for this to work.
styles['Point'] = [ new ol.style.Style({ image: new ol.style.Circle({ radius: width * 2, fill: new ol.style.Fill({ color: blue, }), stroke: new ol.style.Stroke({ color: white, width: width / 2, }), }), // zIndex: Infinity, }), ];
from openlayers.
Can this be seen in any of the examples from https://openlayers.org/en/latest/examples/ ? Or do you have any live example to reproduce this?
from openlayers.
@ahocevar I'll try to create a minimal example this weekend when I'll do another attempt to upgrade.
from openlayers.
Related Issues (20)
- Flaky WebGL style parsing test
- webgl - stroke-pattern-start-offset HOT 3
- Graticule ,set latLabelPosition to 0.5 ,not always in the middle
- Replace polyfills link to safe one HOT 1
- Issue with Drawing and Modifying Geodesic Lines in MultiWorld Mode HOT 4
- SVG performance issues in Firefox HOT 2
- Polyfill vulnerability issues HOT 4
- Zooming without loading tiles HOT 12
- Example of a COG with different projection of EPSG:3857 without setting the map view to the COG view HOT 2
- Slow map loading speed with 4k resolution and raster images HOT 3
- error when yarn run webpack HOT 10
- Graticule with showLabels: true makes map slow
- How to solve the problem of base map annotation and map road blurring in different sizes and resolutions of openlayers
- Is the tilePixelRatio attribute invalid in openlayers7.5.2 HOT 1
- `ol/sourec/VectorTile#getFeaturesInExtent` missing HOT 2
- openlayer modify features Programming HOT 5
- Too many requests when two vector tile source have minZoom and maxZoom HOT 13
- WebGLTileLayer setStyle uses band 1 instead of alpha band, different behavior than TileLayer({style: ...}) HOT 3
- Option to specify an anchor point for zoom interactions HOT 8
- Openlayers cannot be shared with a remote app in webpack's module-federation configuration.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openlayers.