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
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().
10
votes
1answer
8k 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

OpenLayers3: How to reload a layer from GeoServer when underlying data change?

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
26k 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
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? ...
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
2answers
9k 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: [ ...
4
votes
1answer
3k views

OpenLayers 3 how to get only the modified feature?

I have a problem with OL3 and it's ol.interaction.Modify Event. Whenever I modify a feature, just one, it returns all features inside the layer. Currently I have 77 features (polygons) and I can ...
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

Draw Rectangle using OpenLayers 4?

I just want to draw rectangle for style. if I do this image: new ol.style.RegularShape({ fill: fill, //stroke: stroke, // offsetY: -25, points: 4, radius1: 30,...
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....
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....
3
votes
2answers
360 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', ...
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
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
2answers
1k 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
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: ...
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
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,...
3
votes
3answers
12k 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
1answer
832 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 ...
2
votes
2answers
1k views

Unexpected token Identifier error - Import OpenLayers

I'm trying to use some OpenLayers libraries in my code, and called him in JavaScript like this: import Map from 'ol/Map.js'; import Overlay from 'ol/Overlay.js'; import View from 'ol/View.js'; ...
2
votes
1answer
4k views

OpenLayers 3 how to keep original image extent

I'm new at ol3, I'm trying to display my GIS view by updating my ol2 code. I created the projection and I can display my static image but I'm obliged to use local extent [0, 0, 1024, 968] instead of ...
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
0answers
256 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 ...
2
votes
2answers
479 views

OpenLayers 3 not recognising proj4 custom projection

I'm trying to create a proj4 custom projection for use with my openlayers map. However, when after creating the projection with proj4 I am unable to use it with openlayers projections because ol.proj....
2
votes
2answers
1k views

How to find feature in OpenLayers exsisting layer

I have a vector layer in my OpenLayers applicaiton. var layer = new ol.layer.Vector({ source: new ol.source.Vector({ url: "my geojson url" }) }) my GeoJSON data fills 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
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
1answer
135 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
1answer
86 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
2answers
5k views

Using wfs-t in OpenLayers 3?

I'm using OpenLayers-3.6.0 in a web application. I have wfs layer as follow: var url="http://localhost:8080/geoserver/wfs?&" + "service=wfs&version=1.1.0&request=GetFeature&...
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
387 views

Ol3 Boundless - layer selector placement

I recently started playing around with ol3 + boundless. I created the edit application using > suite-sdk create myApp ol3edit. I am trying to move the layer view/selector from the map to a .col-md-...
2
votes
1answer
750 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
703 views

Openlayers 3 getting 401 error from geoserver with secured layers

I have an OL3 webmap that is attempting to access services from Geoserver that is running on a server on our internal network that uses LDAP logins using windows credentials. I found this link (...
2
votes
2answers
4k views

Change OL3 drawing cursor (blue circle)

i'm looking to change the cursor of ol3 during drawing from blue circle to crosshair, i've tried this answer, but it changes only OS cursor not ol3 cursor, is there any idea ?
2
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 ...
2
votes
0answers
675 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
0answers
157 views

Bind Vector Geometry to ViewModel or How to keep track of modified points?

I'm trying to create a viewModel for my application and the data is typically populated by a call to a database. I can retrieve the coordinates and convert this to geometry which can be displayed on a ...
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
354 views

Not displaying any layers in OpenLayers

I am creating a map that contains some layers, all defined in an array called basemapsArray var map = new ol.Map({ layers: basemapsArray, controls : ol.control.defaults({ zoom : false ...
2
votes
1answer
1k views

Is ServerVector broken in OpenLayers 3.5?

Is ServerVector broken in OpenLayers 3.5? Just running the following gives an error: var wfsTest = new ol.source.ServerVector({ format: new ol.format.GeoJSON() }); The error is: "Object doesn't ...