Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Use when the version you are using of the OpenLayers JavaScript client toolkit is 3 or later
1
vote
Accepted
OpenLayers3 get feature request for more than one point in the same place
text-decoration: underline;
}
.ol-popup-closer:after {
content: "✖";
}
<div id="map" tabindex="0"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.8.2/ol.min.js"></script>
<script>
/**
* OpenLayers …
22
votes
Accepted
Creating dashed lines in OpenLayers 3
Dashed lines can be done with:
new ol.style.Style({
stroke: new ol.style.Stroke({
width: 3,
color: 'rgba(255, 255, 255, 1)',
lineDash: [.1, 5] //or other combinations
} …
12
votes
Accepted
How can I select a feature in Openlayers 3 by right click it?
UPDATE:
I've ended up developing a custom contextmenu extension for OpenLayers. It has a lot of features like callbacks. …
2
votes
openlayers3 KeyboardPan not working
Make your map HTMLElement (div) focusable:
<div id="map" tabindex="0"></div>
1
vote
How to get a Line string in OpenLayers 3?
See API docs:
dragZoom.setActive(false);
1
vote
Calling function for minimum zoom in OpenLayers 3
You can watch to map view resolution changes and change the base layer, like:
map.getView().on('change:resolution', function(evt){
var zoom = map.getView().getZoom();
if (zoom < 18) {
layer_s …
1
vote
Accepted
OpenLayers 3, problem with GeoJSON file?
Update your layer_g code to:
var layer_g = new ol.layer.Vector({
style: new ol.style.Style({
fill: new ol.style.Fill({color: [0, 255, 0, 0.2]}),
stroke: new ol.style.Stroke({color: 'black', …
3
votes
Where is the drawn feature when the drawend is triggered in OL3
Try this:
lineStringdraw.on('drawstart', function(){
vector2.getSource().once('addfeature', handleAddFeature);
});
function handleAddFeature(evt) {
var feature = evt.feature;
// ...
}
…
10
votes
what is the rightclick handler in openlayers3
Just repeating/summarizing some other answers. You can add your own listener on viewport:
map.getViewport().addEventListener('contextmenu', function (evt) {
evt.preventDefault();
console.inf …
2
votes
Accepted
How to set the maxBound for the map in OL3
Get world extent for your projection:
var projection = ol.proj.get('EPSG:3857');
var world_extent = projection.getWorldExtent();
console.info(world_extent);
Then in your view:
view: new ol.View({
…
6
votes
Accepted
OSRM Routing in Openlayers 3
When you get your route response (this is an encoded polyline) add it like so:
// route is ol.geom.LineString
var route = new ol.format.Polyline({
factor: 1e6
}).readGeometry(polyline, {
data …
1
vote
Accepted
Openlayers 3 Select Interaction style function
UPDATE:
When a function is used on ol.Feature#setStyle your feature is referenced with the this keyword. Like:
var selectedStyle = function () {
console.info(this);
var feature = this;
v …
2
votes
Accepted
How can I get the popup value to change when I click on another feature, without clicking on...
Destroy it first, then show:
if (feature) {
$(element).popover('destroy');
popup.setPosition(coordinate);
// the keys are quoted to prevent renaming in ADVANCED mode.
$(ele …
1
vote
Accepted
StyleFunction Openlayers-3 - multiple callback variables?
No, no more variables on callback. To solve your question just store the layer name on feature and then get it back on callback.
//before you add ol.Feature to ol.source.Vector
feature.set('layer-nam …
1
vote
One source to create multiple layers?
UPDATE: Trying to formulate an answer:
Load you json file with some AJAX function (a custom one here), and add to a new ol.layer.Vector depending on some parameter, called here category:
function ge …