3

In OpenLayers 6 the map div must have a size, such as <style> .map { height: 400px; width: 100%; } </style> in the quick start example https://openlayers.org/en/latest/doc/quickstart.html


2

newlayer is assigned to a string, the OpenLayers addLayer() method expects an OpenLayers layer object var newlayer = new ImageLayer({ source: new ImageWMS({ url: 'http://localhost:8080/geoserver/nis/wms', params: {'LAYERS': 'nis:test4733'}, ratio: 1, serverType: 'geoserver' }); see this example https://openlayers.org/en/...


1

You can update the element’s popover, when the moveend event fires. map.on("moveend", ()=>{ $(element).popover('update') })


1

Simple experiment show it's really question of projection. If you take coordinate [0, 0] as center of the circle and buffer, they match. If you calculate factor for diameter difference betwee buffer and circle at 45° of latitude, you get approximately 1.41, whch is exactly the value of Mercator projection length factor 1/Math.cos(latitude*Math.PI/180). This ...


1

Adding all the features in a single operation might help var features = []; for (stn in current_obs) { addMarker(current_obs[stn]); // pushes to features array } vectorSource.clear(); vectorSource.addFeatures(features);


1

Even a box would not work correctly if the view was rotated (see the box selection example which has been updated for version 6 https://openlayers.org/en/latest/examples/box-selection.html) If you are attempting to select Point features with a circle you could consider the initial result a shortlist and check each for intersection with the circle geometry: ...


1

If you look at the docs for intersectCoordinate method, description says: Returns true if this geometry includes the specified coordinate. If the coordinate is on the boundary of the geometry, returns false.. Since in the case of line geometry intersection is always on the boundary (there is no interior), you get false event if the point is on the line. The ...


1

You are setting a style on your features which overrides the layer style Instead of using setStyle on the features you could set a property called 'risk_style' if (tambon_code_i == tambon_code_j ){ if (data_risk_j<8.00){ //console.log('low',tambon_code_i); ...


1

Since you are using complete OpenLayers ol.js library, you have to use appropriate calls that start with ol. for all the modules. This is easy to forget when you copy code from OpenLayers official examples, which use import for individual modules. In your case this would be: ol.style.Style ol.style.Text ol.style.Fill ol.style.Stroke


1

Setting the feature styles is probably causing more change events on the source, so you get an endless chain of change events. When the source state is 'ready' you should turn off the event listener: var key = layer_source.on ('change', function(evt) { if (evt.target.getState() === 'ready') { ol.Observable....


1

Assuming you do not need any additional geodata this can be done with pure JavaScript and any Web-Mapping software as the base (for instance OpenLayers, Leaflet, Mapbox GL). It requires quite a bit of coding of course. Take a look at some of these very basic ol examples: https://openlayers.org/en/latest/examples/feature-move-animation.html?q=line https://...


1

Although @bartvde's solution works, it's a bit cumbersome to clone the Feature and create bring over ID and properties. Also, there's a risk that something else is missing in the cloned feature. I'd like to propose another solution: feature.unset("boundedBy"); // or "bbox", depending on name of the feature you want to get rid of That's all it takes! ...


Only top voted, non community-wiki answers of a minimum length are eligible