Questions tagged [openlayers-2]

Use this tag when you are using the DEPRECATED version 2.x of the OpenLayers JavaScript client toolkit.

OpenLayers is a set of open source JavaScript libraries that allow developers to create web clients that provide maps and access to other geospatial data without the need for any server side programming.

OpenLayers 2.0 was released in August 2006 and continues to be supported. It is no longer actively maintained.

3293 questions
33
votes
8 answers

OpenLayers - redrawing map after container resize

In my web application, I want to enable users to set the size of the map container. Everything worked fine when the container was expanded slightly (apparently this is because the tiles that were just behind the border were already loaded). However,…
Imp
  • 878
  • 1
  • 10
  • 16
24
votes
7 answers

How do I get the coordinates of a click on vector feature/layer in OpenLayers2?

I need to get the coordinate of the click when the user clicks on a vector feature on the OpenLayers map. The SelectControl only gives the feature that was clicked and not the coordinates of the click. Anyway to get at the coordinates of the click…
Vish
  • 607
  • 2
  • 6
  • 11
16
votes
3 answers

Remove/Delete a feature from OpenLayers vector layer

I have an OpenLayers layer with several vectors on it. I know the OpenLayers Feature ID (e.g. OpenLayers.Feature.Vector_241) and I would like to know how to remove this feature and only this feature? I have considered deleting them all and then…
CatchingMonkey
  • 1,142
  • 2
  • 9
  • 24
13
votes
4 answers

Is it a good idea to migrate to OpenLayers 3 now

I wonder if OpenLayers 3 is trustable enough to start migrate application to it now. Is the difference between versions 2 and 3 are too much important that the old code wont works? Are the major improvements of OpenLayers 3 is tested enough like 3D?
Below the Radar
  • 3,593
  • 1
  • 31
  • 58
13
votes
2 answers

Switching baselayers as user zooms in to map in OpenLayers?

I have a map which overlays Open Street Map data on imagery for Pennsylvania. As a baselayer to the roads (and eventually other layers) I have two baselayers - Blue Marble NG and USGS EROS 1ft imagery. I would like to be able to combine these two…
Ian Turton
  • 81,417
  • 6
  • 84
  • 185
12
votes
1 answer

Understanding OpenLayers documentation

Within the openlayers documentation I’ve noticed that “options” is many times used to show that the constructor takes parameters. But where can I get the details for this parameter {object}? How does one know what parameters the constructors…
CaptDragon
  • 13,313
  • 6
  • 55
  • 96
11
votes
3 answers

In OpenLayers zoom to extent of all overlays

In Openlayers I can zoom to the bounding box of all layers like this: map.zoomToExtent(); I can also zoom to the bounding box of a single layer: map.zoomToExtent(layer_name.getDataExtent()); Is there an easy way of zooming to the extent of all…
Mr_Chimp
  • 3,773
  • 6
  • 37
  • 51
11
votes
3 answers

How to change color of a feature in openlayers?

I'm loading a geojson file into openlayers to show some polygons. From this file I also create a list of all names of these polygons. Now I want to change the color of a polygon when selected from the list (clicked on the name). What I've tried is…
jlai
  • 211
  • 1
  • 2
  • 4
11
votes
1 answer

Modifying the start/end points of a LineString and maintaining connectivity in OpenLayers

I'm developing an application where the user can view and edit a street grid of a city. The streets are presented as features on a vector layer, and the user has to be able to modify the elements (both the attributes and the geometry - which is…
mrLite
  • 399
  • 2
  • 11
10
votes
2 answers

Openlayers - Losing selection or style on layer redraw

When I zoom or move the map my layer is redrawn. This is what I want, because I have allot of features to load at once. This is the code: wfs = new OpenLayers.Layer.Vector("WFS", { strategies: [new OpenLayers.Strategy.BBOX({ …
Boedy
  • 447
  • 5
  • 13
8
votes
5 answers

Setting default zoom level in OpenLayers

With your help I was able get a shapefile from the CAD file of the previous question. Now the next step is the display the shapefile in OpenLayers... I wrote the script but the map being displayed in the browser is way too small... I need help…
ChrisJ
  • 1,129
  • 4
  • 18
  • 24
8
votes
5 answers

Deactivating Openlayers Cluster after a certain zoom level

I want to deactivate the cluster strategy after zoom level 16. The Cluster strategy gets deactivated and I also change the style of the original features and redraw the layer. But still it takes the styles defined for the clusters instead of taking…
user9685
  • 155
  • 3
  • 8
8
votes
3 answers

Resizing point on zoom out

I've added a point on map like this but it is static in size. How to resize that point on zooming? Map on zoom out
bios
  • 322
  • 1
  • 7
  • 16
8
votes
4 answers

Creating rectangle using OpenLayers

I want to use OpenLayers to draw a simple rectangle (based on 4 coordinates) on my map. I would also like to fill the rectangle with a color. For example (EPSG:4326): 13.40, 52.50 13.50, 52.50 13.50, 52.60 13.40, 52.60 The documentation tells me…
np00
  • 543
  • 1
  • 6
  • 12
8
votes
2 answers

How to change the default color used by openlayers hover?

It is possible to change the color of highlightCtrl when I use onselectedHover? Default is light blue. I want to change it to another one eg. red? Does anyone know where this value is defined?
Alex
  • 81
  • 1
  • 1
  • 2
1
2 3
26 27