Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [openlayers-2]

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

0
votes
1answer
7 views

Error 43 using openlayers, Geoserver, and WMTS

When attempting to use the WMTS tile service with Geoserver and openlayers I keep getting error 43 (Expected layers to be an array or an ol.Collection.). I am new to openlayers so the issue is likely ...
0
votes
0answers
7 views

OpenLayers. External ArcGISCache layer has different zoom levels/scales than current map in use

Current map has 40 zoom levels. Map uses mostly internal layers but for this one special layer an external service is used and that is where ArcGISCache comes in. This ArcGISCache layer has its layer ...
1
vote
1answer
42 views

OpenLayers: How can I add multiple KML files to the same vector layer?

I'm trying to add some KML files to a vector layer using this code: var map = new OpenLayers.Map('map'); map.addLayer(new OpenLayers.Layer.OSM()); var kml = ['...
1
vote
1answer
27 views

Detecting click on map outside features in OpenLayers 2?

How to detect click on map outside features from two vector layers in OpenLayers 2? Here is a code that alerts on selecting feature: var layer1 = new OpenLayers.Layer.Vector("Vector Layer 1"); var ...
0
votes
1answer
21 views

Why is this happening? I show GeoJSON some coordinates with OpenLayers by request Ajax

I want to display a GeoJSON on OpenLayers with a request from Ajax from the database: I store in the geojson variable all the information and I icercated in two ways: 1. Directly from the already ...
0
votes
0answers
20 views

Complicated vector layer's style in OpenLayer 2

Is it possible to style vector layer so there would be picture and label with its own background color for a feature? Something like this:
3
votes
0answers
28 views

Testing a GeoServer “Scrolling” performance

I'm looking for a way to test the responsiveness of various layers when scrolling around the map. So after a layer is loaded and the user is moving around the map looking a specific area or whatever. ...
0
votes
2answers
48 views

OpenLayers - order of layering from a KML file

I have a set of KML files hosted on a webserver, which two applications use; one uses OpenLayers and one uses Google Maps. The problem is the order they render the KML. Google Maps (and Google Earth) ...
0
votes
1answer
28 views

Temporarily disable drag pan of map

I want to disable an OpenLayer map's draw pan during activation of a DrawFeature Control. What I am trying to do so far, is overwriting the dragstart method of OpenLayers.Handler.Drag.prototype in the ...
0
votes
0answers
21 views

Is it possible to set maxResolution for a layer after layer creation in OpenLayers 2?

var OsmLayer = new OpenLayers.Layer.OSM({ isBaseLayer: true }); _map.addLayer(OsmLayer); I tried, _map.layers[0].maxResolution = *some value*; & _map.baseLayer.maxResolution = *some value*;...
1
vote
1answer
79 views

How to truncate coordinates (LonLat) to decimal precision - OpenLayers 2

For eg. if coordinates are 17.12345678, -82.12345678, And I want to convert them to 3 decimal digits Expected result: 17.123, -82.123 Is there any API in OpenLayers 2 to truncate coordinates (...
0
votes
1answer
57 views

GeoServer get native SRS of layer

I want to get the native SRS/EPSG-Code of a layer deployed in GeoServer. Maybe similar to this solution: https://stackoverflow.com/questions/32766126/get-the-epsg-code-from-openlayers-3-layer but with ...
1
vote
0answers
23 views

Openlayers 2: [In Touch] Pinch zoom action triggers click event at the end. How to prevent click on pinch zoom

Openlayers 2: [In Touch] Pinch zoom action triggers click event at the end. How to prevent click event registered on map getting triggered when pinch is done
1
vote
1answer
99 views

Openlayers get list of all layers in Geoserver

How can I get a list of all layers deployed in Geoserver separated by Vector/Raster? Similar to how Geoserver itself does this when one uses the WPS Request Builder (it then shows a complete list of ...
0
votes
1answer
25 views

Triggering Events on Drawing Geometries

Which events are triggered when I draw, for example, a polygon? Like when I define the vertices of the polygon by clicking? And how can I capture these events? Or, better: Is there any documentation ...
1
vote
0answers
15 views

Open Layers squished tiles until page zoomed

Upon initial load the map tiles are squished or sometimes do not appear properly as per image below. This is fixed when the page is zoomed in and out (not the map). This is when the page is viewed on ...
1
vote
0answers
36 views

Dynamic colouring of SVG-icons in OpenLayers 2

I've got an OpenLayers 2 map with a lot of point features that need to be represented using a number of different SVG-symbols. Unfortunately, the marker icons need to be displayed in different ...
0
votes
1answer
14 views

scale line distance openlayers 2

Is there a control in Openlayers 2 to show scale similar to the new Openlayers v3/4/5 which displays in ft or miles depending on zoom level? Eventually I will rewrite in OL5, but I'm maintaining ...
0
votes
1answer
45 views

Locating Basemaps in QGIS?

I've been attempting to download a usable basemap for USGS Topography for quite some time. Going through the USGS procedure to acquire the map has not worked to date. Quickmapservices and Openlayer ...
0
votes
0answers
20 views

OpenLayers 2 - Swap lines on deeper zoom for view port

Having two linestrings, one with overview path, which uses less points and draws incomplete line - Overview path. And then a detailed one where it loads a lot of points for correct route simulation. ...
0
votes
1answer
83 views

How realistic is it to be able to build a dynamic map with ~50k points that change colour depending on supplied data? [closed]

I'm a programmer, but I'm new to GIS. I want to build a map that displays the status of some IoT devices I work with. My ideal vision is a world map, which would fill the screen, but for now, ...
1
vote
2answers
124 views

Adding multiple layers in GeoServer WMS URL

I have a URL that I am passing into an API call to bring back a static image of a map. This URL currently works: http://computername:8080/geoserver/Packt/wms?service=WMS&version=1.1.0&...
1
vote
1answer
5k views

Google maps error in OpenLayers plugin in QGIS

I was using the Google maps on OpenLayers plugin in QGIS 2.16.3 successfully before but today when I tried it the page appears as shown in the figure; I tried re-installing the plugin but this keeps ...
0
votes
0answers
37 views

Openlayers 2 Vector Layer with BBox strategy too large

Currently, i'm building a REST service which will receive the bbox from front-end and then using that bbox to looking for appropriate Geometry Shape in MSSQL database. My Openlayer are setting up ...
0
votes
0answers
37 views

How to create a donut polygon in Openlayer 3

function Draw(coordinat, c) { var geojsonObject = { 'type': 'FeatureCollection', 'crs': { 'type': 'name', 'properties': { 'name': 'EPSG:3857' } }, '...
0
votes
1answer
28 views

Openlayers 2 aand Openlayers 3 Code convertion

I have an old Opanlayers 2 application. And I need to convert an Opanlayers3 code to Opnelayers2, but could not. Opanlaysrs 3 Code var epsg = "EPSG:900913"; var projection = ol.proj.get(epsg); ...
0
votes
1answer
130 views

GeoDjango raster field display on Leaflet

In the new Django version support raster field and I follow this manual for GeoDjango raster field and this question for add raster I have built a simple demo. here the code : settings.py postgis ...
0
votes
0answers
53 views

OpenLayers 2: zoomToExtent with scale

I need to zoom map to show some selected features from layer. So I am creating a temporary layer with features and zoom to this temporary layer. The problem - usually the scale is too small, so I ...
0
votes
0answers
69 views

Adjusting Overlay of Google Satellite Base map and Parcel Boundary

I'm fairly new to QGIS and have bounced back between version 2.18 and 3.2. I've been unable to fix my overlaying issue regardless of versions, openlayers plugin, quickmapservices, and using XYZ tiles. ...
1
vote
1answer
282 views

Basic WMTS example with GeoServer and OpenLayers

I want to set up a local WMTS with GeoServer. There are a couple of example data layers such as 'topp:states' which has the EPSG:4326 projection. I'm using the default configuration of GeoServer and ...
1
vote
1answer
87 views

View my osm file content on a layer

I'm trying to use OSM maps in a simple html page, just to learn the bases and evaluate if it will allow us to represent specific data on a map. Our needs are to have a web map of a specific highway ...
0
votes
0answers
32 views

Snapping another layer point with Create Circle Polygon in Openlayers 2

I want to create Circle polygon but i need to take point for my layer vertex point in using snapping.I don't know how to do it? When i am click on the map the create polygon circle has to be create ...
1
vote
0answers
31 views

Distance between points not consistent

I have an Openlayers application where I can input a centre point, width and height in meters from which I can generate a bounding box to display on the map. The problem I'm having is calculating the ...
0
votes
0answers
48 views

How to Take Circle Polygon Geometry to Line in openlayers 2

When user click on the map circle will be create based on user input radius values. I have to convert circle polygon Geometry to Line. When I am using new OpenLayers.Geometry.LinearRing(pGeometry....
0
votes
0answers
22 views

OSM and code not re-centering

I am modifying the codes from http://dev.openlayers.org/examples/getfeatureinfo-popup.html and https://www.e-education.psu.edu/geog585/node/783 integrating osm tiles as base map. The modified code ...
0
votes
0answers
24 views

GeoJSON data visible in browser but not showing on map [duplicate]

I am using OpenLayers, GeoServer and Shapefiles. I have published the shapefile to GeoServer and under layer preview I can see JSON data in browser when I select GeoJSON option from the dropdown for ...
0
votes
0answers
43 views

Openlayers 2 duplicates features

Yes, I know OpenLayers 2 it's too old... but no budget to change it for OL 3. My maps have been working perfectly fine til this month that it started to duplicate features when zooming in. The bug ...
0
votes
0answers
43 views

Clone Openlayers 2 baselayer from another map

var options = { theme: null, resolutions: this.map.resolutions, projection: new OpenLayers.Projection(this.map.getProjection()) }; var newMap = new OpenLayers.Map(div, options); var ...
0
votes
1answer
113 views

installing arc.js library in OpenLayers not working

I have project developed in Angular 5 with Node.js . Now in my project I want to have flight animation connections and used the example of OpenLayers called 'Flight Animation'. The problem is that ...
0
votes
1answer
118 views

OpenLayers, adding all layers from a WMTS GetCapabilities response?

If I have a WMTS URL, is it possible to feed in the URL and have it automatically add all the layers onto my map instance? Currently, I can replicate the demo, but only if I pass in options, etc. ...
1
vote
1answer
164 views

Drawing point not under mouse cursor

I'm trying to draw on a map using this OpenLayer tutorial. initDrawEvent() { var draw; var source = new VectorSource({ wrapX: false }); var vector = new VectorLayer({ source: source }); ...
0
votes
0answers
53 views

Adding popup on feature click in openlayers [duplicate]

All I am trying to do is add a popup on feature click in openlayers that will display feature information on click . I have 7 map layers as:- `var one = new ol.layer.Image({ source: new ...
1
vote
0answers
34 views

How to get WMS layer feature attribute name [duplicate]

Hereby i have included my WMS layer displaying code.I referred many sites i can't able to get WMS getfeature info.Please anyone help me how to get WMS layer feature info give source code please ...
1
vote
1answer
177 views

Web Map is not displayed in Openlayers with no errors

I want to display a map from a geojson file. Below are my codes. The map didn't show and there were no errors in the console. var urlModev ='maps/StaRita.geojson'; var styles = [ new ol....
0
votes
1answer
2k views

Adding markers using OpenLayers 4

adding markers works fine using OpenLayers 2 but now I need to add markers using OpenLayers 4, how can I do this? my code as follows: var markers = <?php echo json_encode($data)?>; var ...
0
votes
0answers
42 views

Iterating through all WMT layers in OpenLayers?

I want to hit a WMT getCapabilities endpoint and be able to iterate through all the map layers and add them to my openlayers map that has already been instantiated. Is it possible to do this in ...
0
votes
0answers
15 views

Buffer created around points. Now I want select the points out that interact with another layer

I have created a map with GPS data points that represents power plants. I have created buffers around those points that represents 25k a radius. I have added another layer to the map that represents ...
1
vote
1answer
126 views

gdal2tiles not referencing properly

I'm trying to overlay satellite images in a web page, images are properly georeferenced. When I use gdal2tiles by default it throws an error: gdal2tiles.py --zoom 0-5 --s_srs EPSG:4326 ...
1
vote
0answers
30 views

Did open layers replace the splitWith functionality or just remove it in v3?

I can't find any documentation on what happened to splitWith. It used to belong to ol.geom but was only implemented for linestrings. Does anyone know whether it was removed or replaced and why?
2
votes
1answer
28 views

Openlayers 2 projection different depending on how I ask for it

I have a map and am trying to see what projection is set, but, depending on how I ask, I get two different values, this is what I see in the console: > this.olMap.projection < "EPSG:4326" > ...