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
8
votes
5answers
23k views

OpenLayers 3: Cross-Origin Request Blocked: The Same Origin Policy disallows

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=...
2
votes
1answer
2k views

Clipping TileLayer with georeferenced polygon (clipping mask)

I would like to add a mask to clip layers (Tile) below in a way that only the part bounded by a ol.Feature (polygon or multipolygon) is visible and the rest is hidden (left white). The polygon is ...
27
votes
6answers
13k 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 ...
12
votes
4answers
17k 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/...
3
votes
2answers
1k views

Adding hyperlinks to pop-up data in qgis2web?

Does anyone know if it is possible to add hyperlinks to image fields etc. in the pop-up windows of Qgis2web? I've had a look in the layers javascript file, but the image source path isn't rendered ...
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 ...
2
votes
3answers
5k views

Force reload of Tiles in Layer

I want to display an indoor map. My problem is that when I change to another floor (the URL changes) the tiles are not refetched. The following code is used: var indoorSource = new ol.source.XYZ({ ...
9
votes
3answers
38k 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 ...
8
votes
1answer
3k 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. ...
6
votes
3answers
4k views

Undoing last point when drawing linestring in OpenLayers 3?

I would like to be able to draw a linestring and to be able to undo the last drawn point when the key ESC is pressed. I used that code when I first wrote my application : // create the interaction ...
4
votes
2answers
5k views

How to get map units to find current scale in OpenLayers?

I need my OpenLayers application to be able to determine the current scale. This is not for display (there is already the scale line for that). This is because I have a scale-dependent style ...
59
votes
7answers
12k 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 ...
15
votes
4answers
15k 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 ...
15
votes
1answer
50k 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, ...
5
votes
1answer
6k views

Sketch event in Openlayers 3 drawing interaction

For drawing Polygon in OpenLayers 2 we could use as follow: function drawEnd(){ ... } function putPoint(){ ... } function sketchModified(){ ... } function cancel(){ ... } var ...
2
votes
1answer
3k views

How to retrieve the tile URL in OpenLayers 3?

I have a question about Openlayers3 , I have the below code that initializes my map on my small demo application: var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: ...
8
votes
6answers
15k 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 ...
18
votes
5answers
21k 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.
4
votes
2answers
5k views

Restrict CQL filter to a specific BBOX

I need to filter an OpenLayers layer using a CQL filter to an specific Bounding Box. Is it possible? Something like this isn't working: igh > 5000 AND bbox(igh,20786691,22051867,-305577260,-...
2
votes
1answer
488 views

Clipping TileLayer with vector polygon (clipping mask)

I would like to add a mask to clip layer (Tile) in a way that only the part bounded by a ol.Feature (polygon or multipolygon or layer) is visible and the rest is hidden (left transparent). The ...
4
votes
1answer
11k views

OpenLayers 3 create bounding extent which includes two points

I'm working with openlayer3 in my ionic application and am stucked with the problem with creating a bounding extent to get a few points in the viewport. My code looks like this: var destLoc = [6....
3
votes
2answers
4k views

OpenLayers 3 WMS Styling Using SLD_BODY and POST request

I'm using OpenLayers 3 and GeoServer to create a spatial web application in which I want to enable users to choose a colour ramp (using Colorbrewer) and a number of breaks for styling an attribute in ...
3
votes
3answers
11k views

How to check for geometry intersection (point in polygon) using OpenLayers3?

For example, I have this vector (It will be a more complicate linestring, not just a rectangle). For a given coordinate (without clicks, just a latitude, longitude), how could I know (in an easy way, ...
3
votes
2answers
3k views

OpenLayers 3 - Feature Popup without Jquery/Bootstrap

How do you create tooltips (context) on OpenLayers 3 map, using standard Javascript and flat CSS. (No extra libraries)
2
votes
1answer
5k views

Openlayers drawing interaction geometryFunction

Can anyone help me to convert this function so that it is not dependant on the ol3-debug file as I don't know quite what is replaced upon build. The function works but only in debug mode. It is in ...
0
votes
2answers
4k views

Transform coordinates EPSG:32628 to EPSG:3857 Openlayers 3

I need to transform the example coordinates to a different projection in Openlayers3, the EPSG:32628 to EPSG:3857. I made a function to do it but the result is exactly the same numbers. function ...
7
votes
2answers
7k views

How to get layer type in OpenLayers 3?

I would like to iterate through all of the added layers in an ol.Map instance and only select the vector layers. So far I could get the individual layers with the a property of the resulting object of ...
6
votes
1answer
13k views

Using OpenLayers 3 forEachFeatureAtPixel to specify layer?

I must first state that my skills at javascript are about the same as my skills in Spanish. I know barely enough to get myself into trouble and then I go looking for help. anyway I have an application ...
6
votes
2answers
16k 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 ...
5
votes
1answer
18k views

OpenLayers: Get Coordinates of drawn features

Can someone help in finding coordinates of drawn features? I am using this example OpenLayers website. I need to be able to export drawn objects as set of coordinates. Posting the code from the ...
5
votes
1answer
4k views

How to find markers in selected dragbox openlayers 3?

Here is a part of code, draw = new ol.interaction.DragBox({ /* dragbox interaction is active only if alt key is pressed */ condition: ol.events.condition.altKeyOnly, ...
5
votes
1answer
4k views

Using local OpenStreetMap (*.OSM) map with Openlayers 3?

What do I need to load a .OSM map in a client side javascript app? (Imagine an offline webapp).
5
votes
2answers
9k views

Reproject GeoJSON in OpenLayers 3

I'm basically trying (and failing) to replicate this in OpenLayers 3. I've set up a fiddle here: http://jsfiddle.net/vu8ecy8v/5/ I'm under the impression that OpenLayers will reproject a GeoJSON ...
4
votes
1answer
1k views

how to pass value like 100,102,103 to view params

I am trying to zoom plot numbers.Plot numbers like 1 10-12 13/P road 20(A) 100&102 and etc.I am able to zoom to all combination plot numbers except 1,2,3.when I pass such value its trowing error: ...
2
votes
1answer
6k views

OpenLayers3 Redraw MAP/Refresh

I created a function to search for php to postgis and believe me that this function a file with the coordinates in the search GeoJSON format. The problem is that when I do rendering the map and add ...
2
votes
2answers
344 views

how to fix scale 1:4000 to export map in PDF ol3

This is my code to export map in pdf but i want to fix this map in 1:4000 scale the n export or print it to pdf. var dims = { a0: [1189, 841], a1: [841, 594], a2: [594, 420], a3: [420, 297], ...
2
votes
1answer
3k views

OpenLayers 3: Vector Layers not Drawing during animated panning or mouse-drag events

It appears that features on an ol.layer.Vector are not painted or drawn during panning animations or mouse-drag events (in OpenLayers v.3.1.1) Does anyone have a work-around? To see the problem, take ...
2
votes
1answer
4k views

Openlayers3 using custom EPSG:25832

I want to use EPSG:25832 as the default projection for all my layers. The projection is not working correctly because the Position (center point) should be in Germany but I end up in France. When I ...
1
vote
2answers
6k views

Using OpenLayers 3 or 2 to add layers from Google Maps and Mapserver?

I am beginner in OpenLayers and am starting with the www.openlayers.org documents, which use OpenLayers 3 to teach the basics of OpenLayers. Now, I would like to add layers from Google Maps and ...
1
vote
1answer
342 views

why doesn't show feature on map

this is fiddle Link.Feature doesn't show on map when it has been like this code : var featureVectorLayer = new ol.layer.Vector({ source: featureClusterSource, style: new ol.style.Style({ ...
1
vote
1answer
350 views

Error loading geoJSON into map using OpenLayers v4.2.0

I could not get my geoJSON loaded into the map. I used an example code from the web and replaced the coordinates from my geoJSON file. The geometries from the OpenLayers example are shown, but I ...
1
vote
1answer
4k views

Zoom in/out on click in OpenLayers 3?

How to zoom in map in OpenLayerss 3 on click of button? I want to zoom in and zoom out the map on custom buttons instead of + and - buttons which are on default map. I tried with: onclick="map....
1
vote
1answer
5k views

How to add a bounding box to OpenLayers 3 map

I have built a simple map using OpenLayers 3, have a look at the code below: JavaScript code: var map; function init(){ map = new ol.Map({ target:'map', renderer:'canvas', ...
1
vote
1answer
223 views

OpenLayers: transfer from custom projection to map projection

I am building a web application with OpenLayers that contains a map that allows insert, edit and remove points, my map is now using “EPSG:4326" projection. I have shapefiles and xlsx files that ...
1
vote
2answers
1k views

how can I specify a popup to show only for a specific layer in openLayers 3?

I am using the function to define popup contents in a map, and right now, it createa a popup for every feature I click on the map, no matter what layer it is in. I would like this popup to appear only ...
0
votes
2answers
16k views

OSM offline tiles — mbtiles in openlayers

I used tiledownloader to download offline tiles. Now with the new policy acces of mapquest this would be difficult. I found http://osm2vectortiles.org/downloads/ to download some files but they are ...
0
votes
1answer
601 views

Changing visibility of layers on project with OpenLayers and GeoServer?

I'm working on a proyect with openlayers and geoserver, the idea is to have a select menu where the user can choose which layer is visible, something like this <select id="format"> <...
0
votes
1answer
2k views

Request JSONP from Geoserver using AJAX request in Openlayers 3

I am creating a web application using OpenLayers 3 and I am looking to import my vector layers into this. I currently have my data in Geoserver and I am trying to use the following code, but when I ...
0
votes
1answer
97 views

OpenLayers 3 - display layer WFS in EPSG:4326

I have to display a layer from a WFS service (http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/Bacini_idrografici.map) using OpenLayers 3.x API (..there's a reason). The WFS service is exposed in ...
0
votes
0answers
47 views

Creating rectangle on centroid point by map click event ol5

I am trying to develop a web portal using ol5 API where user click on map and then it takes map click event coordinates as centroid of rectangle and create a rectangle of particular height and width. ...