Questions tagged [openlayers]
Use when the version you are using of the OpenLayers JavaScript client toolkit is 3 or later
3,012
questions
59
votes
7answers
13k views
Creating Vector Polygons with rendering performance like GISCloud?
I have been looking for a solid solution which would allow me to create a web map and overlay vector polygons without taking forever to load such data with the goal of allowing me to make each polygon ...
27
votes
6answers
15k views
Maximum number of point features in an OpenLayers vector layer
In your experience, how many point features can be added to an OpenLayers vector layer (new OpenLayers.Layer.Vector("Point Layer")) before it goes unusably slow?
My use case is to display points from ...
26
votes
6answers
6k views
Creating a small web-mapping/map-tiling service
I am looking for a small-scale and easy way to present one or more polygon shapefiles online (on a municipal website without any existing map-server infrastructure, to be precise). Right now, I'm ...
22
votes
7answers
10k views
Options for displaying PostGIS vectors in OpenLayers
I am very new to web-mapping, so this question may be a little misguided.
I want to have a very simple web interface using OpenLayers (or even Google Maps if that will be easier) which can display a ...
20
votes
5answers
24k views
Using layer loadstart & loadend events in OpenLayers 3?
OpenLayers 2 has these layer events "loadstart & loadend."
What is equivalent to them in OpenLayers 3?
While a vector layer loads and is rendered, I need to show a loading icon.
17
votes
3answers
51k views
Change OpenLayers 3 view center
I'm using OpenLayers 3 to interact with some maps. I first declare my map:
map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
...
16
votes
1answer
58k views
Add feature manually to a vector layer in ol3
I'm trying to add a layer manually to a vector layer with javascript. I can't seem to determine why this is failing:
http://jsfiddle.net/Kieveli/f4t6n6v1/4/
I've tried sane coordinates like 16,22, ...
15
votes
4answers
17k views
Openlayers 3 Max Extent
I want to restrict where the user can pan on the map, but I can't seem to find any resources that tell how to set the max extent of a map view in OpenLayers 3. I know there was a solution in ...
14
votes
1answer
14k views
How to resize a feature and prevent it from scaling when zooming in OpenLayers 3
I have initialized a custom OpenLayers 3 map (used to show houses for sale in the neighborhood) with an image as the map.
Then, I create additionnal features and layers dynamically for each house (...
14
votes
1answer
614 views
Pausing WMS layer auto refresh in OpenLayers 3?
I have an application which has to perform a HTTP request (which will handle some map transformations) before fetching WMS tiles from server.
Is there a way to pause TileWMS auto-refreshing after ...
13
votes
4answers
26k views
Get Center of Geometry in OpenLayers 3
Given a Geometry object in OpenLayers 3. How would one go about getting its center?
Older versions of OpenLayers provided a getCentroid method. There was also a getBounds workaround. But these appear ...
13
votes
1answer
28k views
How to get the feature location in OpenLayers v3
After I am using the drawing interaction or modify interaction I have a listener that returns the feature that modified or added.
Example
draw.on('drawend', function (event) {
// get the feature
...
13
votes
6answers
25k 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().
13
votes
5answers
19k views
Z-index in OpenLayers 3: layer ordering in OL3
Is there a method to change Z-indexes of layers in OpenLayers3 like it was in old version?
map.setLayerIndex(markers, 99); //set the marker layer to an arbitrarily high layer index
I need to change ...
13
votes
1answer
11k 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({
...
13
votes
4answers
18k views
Missing LayerSwitcher in OpenLayers3?
I was wondering if there is a LayerSwitcher control in OpenLayers 3?
I read that ol3 is a complete rewrite. But I can't seem to find the equivalent of LayerSwitcher from http://openlayers.org/en/...
12
votes
4answers
18k views
Hosting GeoServer+Openlayers web mapping application on internet? [closed]
I have created a web mapping application prototype using GeoServer (running on Tomcat as the servlet), Openlayers and PostGIS. Since it was a prototype, at that time, i did not bother about the ...
11
votes
6answers
22k views
Openlayers v4.0.1 support Google Maps Javascript API?
I want to know if the latest version of Openlayers (v4.0.1) supports Google Maps as a Tile Layer. I can't find any document ion about this. If Openlayers doesn't support Google Maps, could someone ...
11
votes
3answers
22k views
Refreshing map after changing Feature's style in OpenLayers 3
I have an OpenLayers 3.2.0 map that features some vector sources (ol.source.Vector) and associated vector layers (ol.layer.Vector)
When Features (ol.Feature) are added to the vector sources, they are ...
11
votes
1answer
21k views
OpenLayers Hide/Show Layers from external checkboxes
I'm using OpenLayers with mapserver to display a lot of raster images and queryable wms layers. Everything works fine, the layers can be turned on/off in the OpenLayers layer switcher...But now I want ...
10
votes
2answers
20k views
Openlayers simple custom control example
On the official openlayers site there is a custom control example which demonstration a class base control.
Can anyone give an example of a simple custom control without class usage?
According to ...
10
votes
1answer
9k views
How to detect zoom change in OpenLayers
There is no appropriate zoom event listener in OpenLayers v5.3 yet, but there is a workaround suggested in this ticket:
You can use this.view.instance.on('change:zoom', evt =>
console.log(this....
10
votes
1answer
20k views
OpenLayers 3 - draw multiple lines/paths based on coordinates
I am trying to draw a line(s) based on give coordinates (starting and ending point).
Googled , found few examples but non of them seem to work probably because they are for OL2, so this is my last ...
10
votes
2answers
14k views
How to create circular polygon in openlayers 3?
So i would really like to modify this example:
http://openlayers.org/en/v3.0.0/examples/tissot.html?q=circle
Problem is that when I try to apply it to my map it doesn't work, probably because I use ...
10
votes
2answers
2k views
What's the best way to display thousands of polygons in Openlayers?
I am trying to create an Openlayers map that will display thousands of polygons. And when the user clicks on each, I want some of the metadata to display. Working with this large of a dataset seems ...
9
votes
1answer
26k views
Getting extent in OpenLayers 3?
I am using openlayers3 and i am initializing my map like so:
var view = new ol.View({
center: ol.proj.fromLonLat([5.8713, 45.6452]),
zoom: 12,
});
var map = new ol.Map({
layers: [
...
9
votes
3answers
44k views
Add GeoJSON layer to OpenLayers 3
I have a GeoJSON file called mygeojson.json and I want to add it as a layer in OpenLayers 3 on top of an openstreetmap layer. So far I could display the openstreetmap world including zoom etc. but for ...
9
votes
3answers
13k views
How to get names of all layers in a store in GeoServer using OpenLayers
I have strict requirement to retrieve names of all layers in a GeoServer store using OpenLayers. I've gone through the post here, but it doesn't answer my question. I've also gone through GeoServer's ...
9
votes
3answers
10k views
How to unlisten an event in OpenLayers 4?
I am trying to suppress the single click event that adds popups to the map. I have the following function:
function addFullScreenPopups(){
map.on('singleclick', function(evt) {
var ...
9
votes
4answers
3k views
Implementing WPS client in OpenLayers 3?
Is it possible (and what is the recommended way) to use OpenLayers 3 to do the work of theOpenLayers.WPSClient?
As shown in the old WPS client example, OpenLayers 2 can be used to operate WPS.
...
9
votes
3answers
20k views
Setting OpenLayers 3 Layer Visibility
I'm trying to upgrade my Openlayers 2.12 map to Openlayers 3 to take advantage of the fantastic transition effects on transparent layers (Something OL2 and Leaflet can't do attractively). This and I ...
9
votes
5answers
6k views
Show/hide features on layer in OpenLayers?
In previous versions of OpenLayers, features on a layer could be hidden by changing visibility to 'hidden' but that does not seem to work on OpenLayers 4. How can features be modified so that we can ...
9
votes
1answer
6k views
what is the rightclick handler in openlayers3
I used rightclick handler with openlayers2 and now I am upgrading my website to openlayers3 and I cannot find this handler in ol3
9
votes
1answer
10k views
OpenLayers 3 modify end event
I want to save the geometry data after I modify it, so I need an event that fire after I finish to modify the feature.
I use the following from this post:
listener modify interaction
var ...
9
votes
6answers
27k views
OpenLayers 3: Cross-Origin Request Blocked: The Same Origin Policy disallows [duplicate]
Using OpenLayers 3, I cannot get this message to go away:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://myserver:8085/geoserver/sf/ows?service=...
9
votes
1answer
3k views
Tile WMS vs Image WMS
In OpenLayers 3, there is is ol.source.TileWMS and ol.source.ImageWMS. I don't know if this is specific to OpenLayers, but what are the trade-offs between tileWMS and imageWMS? Is there a performance ...
9
votes
1answer
7k views
OpenLayers 4 differences from 3.x [closed]
In OpenLayers 4 changelogs, it explains:
Unlike the switch from v2.x to v3.x, which marked a complete rewrite
of the library with an entirely new API, major version increments now
simply mean ...
9
votes
1answer
2k views
OpenLayers 3: getting rid of 'blue dot' selection icon
I am working on a digitizing tool.
There are four buttons as of now:
add point
add line
add polygon
remove geometry
The user always starts by first drawing some geometries. I am using the Draw ...
8
votes
2answers
12k views
How do I disable mouse scroll zoom in OpenLayers 3?
I'm trying to override it 'cause it's so dang sensitive. Bonus points if you can also demonstrate a elegant way to override, but, well, I can probably figure that out.
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 ...
8
votes
3answers
18k views
Is there a On Map Move event in OpenLayers?
In my OpenLayers web app I have registered an onmousemove event which performs certain functions. What I am really after though is a way to register and handle the user panning or zooming the map.
8
votes
2answers
32k views
OpenLayers 3 creating popups on a click
I have an OSM map on which I display a GeoJSON file (point). I'd like to create a popup on click for each point to show attributes.
I can't find a sort of very basic step by step tutorial to do ...
8
votes
1answer
14k views
Add properties name label or id to a feature
I'm new to OpenLayers 3 and I'm trying to add a property (id, name or label) to a feature to get it back on click later, to identify that particular feature.
Is it possible?
I haven't found any ...
8
votes
3answers
9k views
OpenLayers 3: How to check if vector source is ready?
ol.source.getState() doesn't seem to be reliable. When I call it on a vector source it returns ready, but the features are not available yet. Code looks like this:
var vectorSource = new ol.source....
8
votes
2answers
24k views
OpenLayers 3 capturing various click events
I would like my KML layer in OpenLayers 3 (OL3) to respond to different types of click events.
I have a single click method working nicely. But how do I get it working for "shift-clicks" "double ...
8
votes
1answer
10k views
OpenLayers 3 get current center
Is it possible to get the current position (lat/lng/zoom) in OpenLayers 3 (Like map.getCenter() in Leaflet)? I couldn't find anything in the docs.
8
votes
2answers
8k views
Disable doubleclick zooming in OpenLayers 3
I've searched for it on the entire web and finally I found on artamstrong.com how to disable a single feature like "mouseWheelZoom".
Here is how doubleclick zooming in OpenLayers 3 can be disabled:
...
8
votes
2answers
22k views
Remove selected feature Openlayers 3
I'm using openlayers 3 to create web application that allow to user to draw LineString features in the map.
this is the code:
var raster = new ol.layer.Tile({
source: new ol.source.MapQuest({ layer: '...
8
votes
1answer
4k views
Is there an easy way to use Postgis GeoJSON in Openlayers 3
I was using google-vector-layers and leaflet-vector-layers from Jason Sanford (https://github.com/JasonSanford) to easily display, style and add customized popups for data from Postgis-databases. ...
8
votes
3answers
5k views
How to get WFS GetCapabilities information as JSON
I can get a WMS GetCapabilities response via AJAX call and I can convert response to JSON using ol.format.WMSCapabilities tool.
But I need to make a WFS GetCapabilities query via a AJAX request and ...