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.

4405 questions
170
votes
11 answers

OpenLayers vs Google Maps?

I have used Google Maps a couple of times, but what wondering about OpenLayers. Before starting any kind of coding, here are a couple of questions that come to my mind, Why would I use OpenLayers instead of Google Maps? Except for its OSS…
Pascal MARTIN
  • 374,560
  • 73
  • 631
  • 650
32
votes
3 answers

Drawing a path with a line in OpenLayers using JavaScript

I have seen the examples presented here of how to draw a line but the examples only show how to do it with the mouse, by clicking. What I want to do is draw the line manually using JavaScript given a list of Longitude and Latitude coordinates. The…
Andreas Grech
  • 98,643
  • 98
  • 284
  • 354
32
votes
2 answers

Simple label on a leaflet (geojson) polygon

I am attempting what I imagine to be a fairly common use-case with a leaflet multipolygon object. I create the MultiPolygon using geojson: var layer = L.GeoJSON(g, style_opts); What I'd like is to put a simple text label in the center of each…
Hoopes
  • 3,077
  • 4
  • 31
  • 50
31
votes
6 answers

CSS: position:fixed inside of position:absolute

I'm running into some extremely strange behaviors, and non-consistant across every browser i've tested. I've a pretty complex layout, but the main issue lies here:
#drop has position:absolute and…
Mikhail
  • 8,071
  • 6
  • 45
  • 78
25
votes
4 answers

Why examples don't work? (a struggle with imports)

On the page https://openlayers.org/en/latest/examples/image-vector-layer.html I copied the HTML code from under the map to /tmp/a.html and run firefox /tmp/a.html. At first two problems appeared easy to fix: SyntaxError: import declarations may…
xhancar
  • 617
  • 1
  • 6
  • 13
24
votes
2 answers

write png quickly

Summary I want to write a .png file as quickly as possible, without a concern for compression. That is, I don't care much about the file size, but I do care that the write happens as quickly as possible. Motivation I am making a web-based map…
M Katz
  • 4,604
  • 3
  • 36
  • 59
23
votes
6 answers

OpenLayers, nice marker clustering

Do you know how to have a nice clustering in OpenLayers such as this google example ?
apneadiving
  • 110,730
  • 25
  • 209
  • 207
23
votes
2 answers

OpenLayers - how do I draw a Polygon from existing lonLat points?

I have in my database longitude-latitude verticies from user-defined polygons. My questions is: how do I recreate and display them on a map now? This is quite easy to do with the Google Maps API, but I can't find any documentation or examples on how…
Scott
  • 2,317
  • 4
  • 25
  • 31
23
votes
6 answers

Good examples of MapServer / OpenLayers

I want to convince some clients to use MapServer and OpenLayers. Please can anyone suggest attractive websites to show off the possiblities! The clients will be impressed by: A density map (otherwise known as a heat map, colour-shaded grid…
MarkJ
  • 29,252
  • 4
  • 60
  • 104
21
votes
9 answers

Min/max zoom level in OpenLayers

I'm using OpenLayers to display a map in a web page. I am using tiles from CloudMade, but the same issues occur with the Mapnik tiles from OpenStreetMap. I'm trying to restrict the map so that the user cannot zoom all the way out to world view -- I…
David Pfeffer
  • 36,331
  • 28
  • 120
  • 198
21
votes
2 answers

How to convert Vector Layer coordinates into Map Latitude and Longitude in Openlayers

I'm pretty confused. I have a point: x= -12669114.702301 y= 5561132.6760608 That I got from drawing a square on a vector layer with the DrawFeature controller. The numbers seem...erm...awfull large, but they seem to work, because if I later draw a…
J.R.
  • 5,051
  • 10
  • 53
  • 78
21
votes
3 answers

ZoomToExtent OpenLayers 3

OpenLayers 2 had a very useful map.zoomToExtent(extent) feature. Is there something similar in OpenLayers 3? I can get the extent of interest with source.getExtent(), but I can't figure out how to apply that extent as a "zoom level".
Tyler DeWitt
  • 22,191
  • 36
  • 108
  • 189
21
votes
5 answers

OpenLayers 3 Extent of all features on a vector layer?

I have an OpenLayers 3 map with a base layer and a vector layer. this.topoLayer = new ol.layer.Vector({ source: new ol.source.Vector(), style: style }); var baseLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ url:…
SomeBdyElse
  • 305
  • 1
  • 2
  • 9
19
votes
8 answers

openlayers simple mouseover on marker

It sounds so simple but I can't find any newbie tutorial: Could anybody give me a simple example how I create (vektor)markers in OpenLayers that open an infowindow on mouseover and even close it on mouseout? I found parts of this explained but not…
user987875
  • 505
  • 1
  • 6
  • 18
19
votes
3 answers

Use OpenLayers 4 with Angular 5

I'm trying to use OpenLayers 4 in Angular 5. Basically I just want to implement the QuickStart example from the official OpenLayers Site. What I have done so far: npm install ol --save to download the ol package angular-cli.json added those lines…
Giuseppe
  • 353
  • 1
  • 2
  • 9
1
2 3
99 100