Questions tagged [openlayers]

Use when the version you are using of the OpenLayers JavaScript client toolkit is 3 or later

Filter by
Sorted by
Tagged with
2
votes
1answer
10k views

OpenLayers 3 restrict map to an area

I want to restrict the OpenLayers 3 heatmap-earthquakes examle to show only Europe. I have: var raster = new ol.layer.Tile({ source: new ol.source.Stamen({ layer: 'toner-background' }) }); ...
2
votes
3answers
8k views

Applying multiple CQL_FILTER to single GeoServer LayerGroup?

I've created a page with OpenLayers 3 that adds a WMS Tile layer to the map served up by a local GeoServer (v2.6) instance. As it stands adding layer by layer things work just fine: var dynamicMap = ...
2
votes
2answers
5k views

Access-Control-Allow-Origin in geoserver and ol3

I am using OL3, Geoserver. I made a website with Asp.net and add map with OL3. which is get data from geoserver with WFS. my website is located in C:\programfile\geoserver\www\mysite. Also config IIS ...
1
vote
1answer
4k views

How to set the URL from an icon in OpenLayers 3?

I've tried to set the URL from an icon but without success. In fact, I've been searching in OpenLayers API but I haven't seen any method to set it. In OpenLayers 2 I've seen that It's possible. I ...
1
vote
2answers
5k views

wmts layer in Openlayers from Geoserver

I have some layers in Geoserver(latest stable) that came from PostGIS data (they belong to a store with PostGIS type and gets data from a PostGIS database) In those layers there are only WMS settings,...
1
vote
2answers
1k views

OpenLayers 3 doesn't want to draw programmatically a polygon

I am using OpenLayers 3 and I am trying to draw a polygon using given coordinates, but it doesn't want to draw it. var source = new ol.source.Vector(); var ring = [ [3139880....
1
vote
2answers
2k views

OpenLayers 3 and Three.js

I have asked this question in StackOverflow, but got no useful answer - So perhaps I could get some help here. I would like to generate a 3d Terrain using THREE.js, and I would like to overlay ...
1
vote
2answers
976 views

How can I get a QGIS2Web project to display info for multiple layers in a popup?

I have built a project in QGIS and QGIS2 Web that has multiple polygon layers that overlap each other. I am trying to get the info pop up to display the data for all of the overlapping layers at a ...
1
vote
1answer
1k views

How to immediately refresh ol.source.TileWMS

How can I immediately update or refresh or redraw the ol.source.TileWMS ?
0
votes
1answer
904 views

GetFeatureInfo on mouse hover on feature in OpenLayers 3

I am able to get popup onclick on the feature but want to get popup also on mouse hover on the feature (polygon,point). Can anyone help me out. For onclick I used below code - var feature_onClick; ...
0
votes
1answer
1k views

How to arrange own tiles without projection in OpenLayers 3?

I have own tiles (.png) of 512x512 pixels and I would like to display them in OpenLayers 3 without projection (for now). Therefore I found a way to use the ZOOMIFY projection but with a "ol.layer.Tile"...
0
votes
1answer
1k views

openlayers3 Draw interaction vertexadd event

I am trying to implement an undo/redo functionality during drawing a fetaure using the draw interaction. For the modify interaction I was able to to do it using the 'modifyend' event. like so: ...
13
votes
6answers
21k views

Equivalent of layer.redraw(true) in OpenLayers 3?

I have a geojson layer in my OL3 app which I want to redraw every 5 seconds (to show movement on map) . How do I do it ? Couldn't find the equivalent of Layer.redraw().
11
votes
1answer
9k views

Dashed lines in OL3?

I know Line dash not working OL3 (Openlayers 3) has been asked earlier but the solution proposed is not working. My code is : var calculateStyle= new ol.style.Style({ fill: new ol.style.Fill({ ...
8
votes
3answers
3k views

Suggestion about the database to be used with OpenLayers

Can anyone suggest me which database to be used with OpenLayers? I have to store the values in a database table and retrieve them (trivial tasks). Which is better MySQL or PostGIS? Can anybody give ...
7
votes
4answers
7k views

Reloading OpenLayers layer from GeoServer when underlying data changes?

I have a webpage that displays a GeoTIFF served via GeoServer as an OpenLayers3 ImageWMS layer. What I need is to (via a button) reload the OL3 layer after the underlying GeoTIFF changes. I searched ...
6
votes
3answers
27k views

OpenLayers-3 setting zoom so layers fit in map window

Is there a way to dynamically set the zoom level so that the current layers always fit within the width of the map frame on page load? Currently the zoom level is set statically such that when using ...
5
votes
2answers
10k views

Creating new buttons and removing default ones - Openlayers-3

I am trying to create new buttons but I seem to use the wrong function. To delete the default buttons I added the following code: var map = new ol.Map({ target: 'map', controls: [], layers: [ ...
5
votes
1answer
5k views

Line dash not working OL3 (Openlayers 3)

I want to display a dashed line in a vector layer, as the it's shown in the Documentation there is a propriety called lineDash , but it didn't work for me here my code : var iconStyle_line = new ...
5
votes
1answer
11k views

Layer name in OpenLayers 3.0

I'm looping through all the layers in my map using map.getLayers().forEach(function(layer, i) { ... }); I'd like to get the name of each layer but I haven't been able to find anything in the ...
5
votes
1answer
2k views

Loading older google satellite image with OpenLayers plugin in QGIS?

I am using the OpenLayers plugin in QGIS. I want to use the google satellite layer, but there is a cloud on the specific image. Is it possible to load one of the older google satellite images? ...
4
votes
1answer
5k views

Query WMS in OpenLayers3

In previous versions of OpenLayers, we could filter WMS services with CQL. However, I can't filter my WMS services using CQL or other. How do I do that in OpenLayers 3? var wmsLayer = new ol.layer....
4
votes
2answers
11k views

Openlayers 3 Select Interaction style function

I have a style function for LineStrings which will place a circle at each vertex of a feature. When I select the feature it reverts to using the default style even though I have replicated my style ...
4
votes
1answer
3k views

OpenLayers 3: Change drawing style, but keep style of previously drawn features

I created a vector and a drawing interaction: // Create feature collection and vector var featureCollection = new ol.Collection(); var vectorSource = new ol.source.Vector({ features: ...
4
votes
3answers
4k views

How to force a ol.source.Vector to reload data from server?

I have a ol.source.Vector like this: var geoJSONFormat = new ol.format.GeoJSON(); vectorSource = new ol.source.Vector({ strategy: ol.loadingstrategy.bbox, loader: function(extent, resolution,...
4
votes
2answers
9k views

How to get the coordinates of the starting and ending points of a line in ol.interaction.Draw in OL3

I'm using Openlayers3 for drawing and storing lines, and then doing some processes on the inputs. Now I want to get the coordinates of the starting and ending points of the line while the line is ...
4
votes
1answer
2k views

Adding CartoDB basemap in OpenLayers 3?

I'm trying to add a CartoDB basemap to my OpenLayers map but I can't get it to work. Here is the code I use to declare the basemap variable: var carto = new ol.layer.Tile({ source: new ol.source....
3
votes
1answer
2k views

Styling WMS layers in OL3

I have managed to get my WMS layers working in OL3. Now I want to style them, as they are all set as blue on the server side and I can't change that. I know the common answer seems to be WMS is an ...
3
votes
2answers
8k views

How to label GeoJSON polygons from properties using OpenLayers 3?

I have a working script to show GeoJSON feature and style them by properties/attributes. But when I tried label the feature browser said 'feature is not defined'. Can anyone help with a working label ...
3
votes
1answer
12k views

OpenLayers 3: Access feature by ID

I want to create a map with openlayers, add feature points, let people move the points and retrieve the new coordinates later. I have searched the net for two days but all I found was an example where ...
3
votes
2answers
2k views

Create Blue Marble XYZ tiles

I am trying to create my own XYZ tiles to use them with OpenLayers 3 as my local tiles. On this example you can see the objective/idea. I want to use the NASA Blue Marble Earth Visible maps, as an ...
3
votes
1answer
2k views

Open Layers 4 fit to extent zoom too much out

Working with OpenLayers 4.2.0, I have the extent [-45930163.095729224, -3380418.677804029, -5390354.729126186, -3011487.2342575104] which is a box around Santa Catarina state, Brazil. But instead of ...
3
votes
3answers
13k views

Reading in local GeoJSON file for OpenLayers

I am kinda new to OpenLayers and not (yet) very experienced in JavaScript. I have a WordPress blog and I want to replicate and adjust the following script to my needs: http://jsfiddle.net/eqsrnjos/1/ ...
3
votes
2answers
2k views

reload ServerVector with different zoom levels in openlaers3

how to reload ServerVector with different zoom levels ? I don't want to use ol.loadingstrategy.createTile strategy because it sends many requests with each zoom -one request with each tile - which ...
3
votes
1answer
861 views

Styling multiple WFS with OpenLayers 3

Been stuck on this one a while. Let me know if you can help. In the application I am building, I am importing two GeoServer WFS vector layers and trying to set a different style to each of them. Here ...
3
votes
2answers
460 views

How to use geowebcache seeded tiles with a custom projection (EPSG: 27700) in openlayers

I have been using Geowebcache inside Geoserver to seed tiles to improve wms performance when using Openlayers to great effect. This has been working well with EPSG:4326 layers, I use the EPSG:4326 ...
3
votes
1answer
4k views

Loading tile zoom level 20

I have local tile also 20 level. I found out that OSM tile level 20 don't loading. map code: map = new ol.Map({ target:'map', renderer:'canvas', view: new ol.View({ projection: 'EPSG:3857', ...
2
votes
1answer
673 views

How to indicate polygon vertices with small circles using OpenLayers?

I am using OpenLayers 3 and have more or less implemented everything in my requirements list, except one thing: I am asked to somehow make the polygon rendering indicate the polygon vertices with ...
2
votes
2answers
3k views

How to get getGetFeatureInfoUrl from multiple layers in OpenLayers 3

I have multiple layers in a map with layer group now onclick I want to get the getGetFeatureInfoUrl for the different layers on which I am clicking but the problem is that I am getting only the Info ...
2
votes
1answer
972 views

Add image along the LineString

I am wondering how to place images on a line. For example, instead of a dotted or dashed line. I could include a symbol of a cloud a character (e.g. |) repeated along the line. it cannot show the ...
2
votes
1answer
101 views

Reproject xyz-tilelayer to Mollweide

As OpenLayers supports raster reprojection I would like to make it reproject xyz-tilelayers e.g. from OSM, Mercator projection to Mollweide projection (ESRI:53009). From this example I took the ...
2
votes
1answer
1k views

Save features and attributes as WFS in GeoServer

I want to create some squared features with OpenLayers 4, add attributes to each feature and want to save them on the GeoServer to load them later on to another map. I am able to create the features, ...
2
votes
2answers
1k views

Overlaying Raster image with Google Maps in OpenLayers3

I am trying to overlay Google Maps with a raster image layer in Openlayers3 and am new to this. Can anyone help by providing the steps involved in performing this task?
2
votes
1answer
43 views

Display ESRI MapService (WMTS) with EPSG:28992 coordinate system in OpenLayers web map with OpenStreetMap base layer

ESRI MapService https://tiles.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Historische_tijdreis_1870/MapServer have EPSG:28992 coordinate system. In QGIS I can add this layer via WMTS https:/...
2
votes
4answers
6k views

Disabling map drag and zoom in OpenLayers 3?

I need to disable all map interactions, like map zoom, drag, scroll zoom, any kind of interaction. Is there some easy way to do it?
2
votes
0answers
694 views

Style GeoJSON layers depending on attributes in Openlayers 3

I'm trying to mimic most of the great google-vector-layers and leaflet-vector-layers from Jason Sanford (https://github.com/JasonSanford) to easily display, style and add customized popups for data ...
2
votes
1answer
12k views

Placing GeoServer WMS layer within OpenLayers 3

I have the following basic OpenLayers 3 code that opens a OSM background mapping and this works fine: <!doctype html> <html> <head> <title>Hello PMS</title> ...
2
votes
1answer
2k views

Openlayers 3 Circle Vectors Not Visible

I have two coordinates which are projected in EPSG: 3857 coord1 = [-10399758.486973494, 5604341.818491254] coord2 = [-10402629.416641055, 5593700.936383396] I'm trying to get them to appear, ...
2
votes
1answer
138 views

Openlayers 3 equivalent of render intents of OpenLayers.Stylemap?

I want to convert my openlayers 2 features to openlayers 3. I have following part in openlayers 2. I need an equivalent of StyleMap in openlayers 3 so that I can distinguish the default action and ...
2
votes
0answers
275 views

How to get extent from current resolution in OpenLayers 3 for printing

I need to print a map with a fixed scale of 1:500 horizontally on a A4 paper (297x210mm). The map is done with Openlayers, the print request is sent to QGIS server using WMS getPrint function. Till ...