Questions tagged [openlayers]

OpenLayers is an open source Javascript web mapping library for creating web map applications.

OpenLayers is a JavaScript library which implements an API for developing dynamic map widgets on the web. The library provides tools for presenting and editing geographic information using pure JavaScript with no server-side dependencies.

OpenLayers supports several different access methods for geographic data, including the OpenGIS Web Mapping Service (WMS) and Web Feature Service (WFS) protocols from the Open Geospatial Consortium. Other supported geographic data sources include OpenStreetMap, Bing Maps, and ArcGIS Server. See the OpenLayers live examples page or the documentation for more comprehensive details.

OpenLayers is a project of the Open Source Geospatial Foundation (OSGeo) and is released under a BSD-style license (also known as the BSD-2-clause).

Books

OpenLayers Cookbook

Tag Usage

When asking a question with the tag, please mention the OpenLayers version you are using - especially for coding related questions.

5064 questions
7
votes
3 answers

How to drag features in Open Layers 3?

In the OL3 examples I can drag objects and drop on the map, but I want to move/resize/rotate things that are already on the map like ol.geom.Point and other ol.geom objects. What is the OL3 way do do this? Example in OL2:…
more cowbell
  • 101
  • 1
  • 7
7
votes
2 answers

OL3: force redraw layer

i am currently upgrading OpenLayers client version 2.13.1 with the new version of OpenLayers, OL3. My setup consist of Mapserver as a WMS mapping server and previously mentioned OpenLayers client. In old system I made support for user interaction in…
user2473933
  • 71
  • 1
  • 1
  • 3
7
votes
2 answers

OpenLayers.Map change position of Attribution in JavaScript

I have included an OpenLayers.Map in my site per JavaScript: var map = new OpenLayers.Map(); var mapnik = new OpenLayers.Layer.OSM(); map.addLayer(mapnik); All works fine. Expect the position of the attribution (OpenStreetMap contributors). Are…
michael
  • 16,221
  • 7
  • 55
  • 60
7
votes
1 answer

PostGIS: Find closest geometry to given point

Say I have a number of geometries in my databases. I would like to create a function within PostgreSQL whereby I can pass in a lat/long and have it return the closest geometries by distance (linear, and by road) for a given radius. I am a newbie to…
John Smith
  • 165
  • 2
  • 10
7
votes
5 answers

Cannot set map's div height for openlayers map

This code make the map's div width max but height to 0 (the % value doesn't matter, it's always 0)
This works, as it sets the map's div to a fixed size, but is obviously not what I want.
MJB
  • 3,934
  • 10
  • 48
  • 72
7
votes
1 answer

Style Point vector as Marker in Openlayers?

It seems like getting onDrag for Markers on OpenLayers isn't possible (this and this, as examples) So I would like to use a vector layer, and then add points to it instead of markers. My problem is that the vector points doesn't look like the…
jperelli
  • 6,988
  • 5
  • 50
  • 85
6
votes
2 answers

Openlayers circle Polygon on OpenStreetMaps layer

I'm trying to create a circle with a defined center and put an icon marker on it. The code is working if I use images instead of OpenLayers.Geometry.Polygon.createRegularPolygon. I wasn't able to solve it. here you find my…
Lessfoe
  • 73
  • 1
  • 1
  • 6
6
votes
1 answer

Offline maps on PhoneGap using OpenLayers and TileCache

Is there a good tutorial on how to pre-cache a known part of a map using TileCache, store them on the PhoneGap mobile app database and load them up using OpenLayers? I went through many tutorials and still I haven't figured a way out to do all…
6
votes
2 answers

Apply hash pattern to polygon in openlayers

I am creating a vector layer comprised of polygons from a KML file using Openlayers and I need to apply a "hash" pattern (diagonal striping) to the polygons. I know Openlayers doesn't natively support adding a background image to a polygon in a…
TheOx
  • 2,208
  • 25
  • 28
6
votes
3 answers

How do I abort outstanding map tile request with OpenLayers when the zoom changes?

I have an OpenLayers map with a TMS layer. For each zoom change, my map makes about 56 requests for map tiles (depending on the map/screen size). If the user rapidly zooms in or out, all these map tile requests get queued up in order, and my…
Paul
  • 63
  • 5
6
votes
2 answers

OpenLayers, and GeoJSON, not multiply marker on same coordinates

My code is showing markers from GeoJSON, when I'm haved zoomed into zoom-level 10,it load the GeoJSON-file, but how do I avoid to reput out the same markers? Is there a way to check if there already exist a marker on a specific place? The…
Max Allan
  • 640
  • 5
  • 18
6
votes
1 answer

Make marker draggable and clickable

I have a vector-layer for displaying markers as features on my map, but now mather, what I do, they are eighter draggable or clickable. What can I do to get both? /*** Init Drag Marker */ var dragFeature = new…
madc
  • 1,674
  • 2
  • 26
  • 41
6
votes
1 answer

QGIS 2 web plugin and shape drawing option

I would like to be able to draw some features on the map generated by the QGIS2web plugin. I found some Openlayers drawing plugin here: https://cdn.rawgit.com/HamHamFonFon/ol3-drawFeatures/82f29a3f/examples/basic_use.html But I don't know how to…
Geographos
  • 827
  • 2
  • 23
  • 57
6
votes
2 answers

OpenLayers Cluster Recalculate

So, I have a number of items clustered in OpenLayers. I'm using a strategy that clusters the items based on their attributes. I change an item's attribute. How do I get the clustering strategy to recalculate the cluster?
Richard
  • 56,349
  • 34
  • 180
  • 251
6
votes
1 answer

Openlayers 3 select interaction unable to add event condition

So I'm trying to add a select interaction into my maps when I hover over any feature it's clearly highlighted. import Select from 'ol/interaction/select'; import pointerMove from 'ol/events/condition.js' this.selectPointerMove = new Select({ …
Munerz
  • 1,052
  • 1
  • 13
  • 26