Questions tagged [openlayers-2]
Use this tag when you are using the DEPRECATED version 2.x of the OpenLayers JavaScript client toolkit.
3,298
questions
2
votes
1
answer
35
views
OpenLayers - pan map on pressing mouse wheel
In OpenLayers 2, it was possible to pan the map with either pressing the left button or the mouse wheel (middle button). In later Versions, the mouse wheel options seems to have disappeared.
Is it ...
0
votes
1
answer
45
views
OpenLayers trigger map click on specific coordinates
I am working with web map application Lizmap which unfortunately is working with OpenLayers 2.
I want to trigger map click programically on specific position:
let event = new Event("click");
...
1
vote
0
answers
51
views
Modify label size of the QGIS basemaps at layout map printing
I am trying to print out multiple maps in QGIS 3. Each map contains a few points, and should have context information from the basemap such as city names/road names, etc. somehow helpful to find ...
0
votes
0
answers
60
views
GeoServer is unable to read layer name, when GetMap uses external SLD
We are currently testing GeoServer 2.20.1 to be replaced for GeoServer 2.11.2.
One issue which we found is while getting prints from GeoServer 2.20.
When a request is sent to GetMap for layers whose ...
0
votes
0
answers
51
views
Google map integration with existing GIS Map using OpenLayers 2
I am using OpenLayers 2 to show the different layers on GIS map as TMS Layer. My projection is new OpenLayers.Projection("EPSG:32643"), units:"m",. Now my requirement is to show ...
1
vote
0
answers
36
views
Pop-Up position compared to the marker clicked in OpenLayers
I would like to center a pop-up on the marker where I click now it is moved to the right and above the marker.
I tried two methods:
Method 1:
var f = map.forEachFeatureAtPixel(
event.pixel,
...
0
votes
1
answer
43
views
OpenLayers: Wrap data around the globe
With my current implementation if I create a point it is visible only on the first map view. If I move around e.g. move to the right the new view without point is shown. Is there any posibility to add ...
0
votes
0
answers
36
views
Can OpenLayers detect "Map data not available"
With my current implementation I check if my map is on the zoom level where its data is not available, if yes than I switch to another map. But I wonder if there is some option e.g. event listener in ...
0
votes
1
answer
50
views
OpenLayers print Logo
I added a logo image for the map in this way:
<div id="map" class="map sidebar-map">
<div class="logo">
<img src="assets/img/logo.png" ...
0
votes
1
answer
59
views
OpenLayers: Export from / Import to KML - keeping the layer structure
I have following structure before export:
LayerGroup
LayerGroup
Layer
Feature
Is there any posibility to keep this structure when export/import KML?
I noticed in the KML file after I export ...
2
votes
1
answer
62
views
OpenLayers problem with adding features to custom drawings
I would like to export the features drawn on my OpenLayers map in GeoJSON format.
So far everything is working apart from the properties section, which keeps coming with nothing, as you see below.
I ...
0
votes
1
answer
88
views
Clicking on newly created Vector layer in unit testing (Jasmine)
I've created a component that attaches a new vector layer on the click of a polygon.
I've used custom interactions of openlayers to do so (using ol/pointer).
I need to click on a particular coordinate ...
0
votes
0
answers
61
views
Why are points from a MySQL WMS layer, displayed on a OpenLayers 2 map, reading out a lat/long location that is off by 500 meters,
I have a MySQL table containing MySQL point geometries (MySQL 5.7). I have configured a GeoServer WMS layer using this data. I cannot set the native srs (not enabled in config dialog), declared srs is ...
0
votes
0
answers
122
views
OpenLayers fit to extent doesn't work
I have the following example:
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<div id="mapdiv"></div>
<script>
map = new ...
0
votes
1
answer
135
views
Viewing Google Satellite on my web map
Please help me add "Google Satellite" to my web map by following the code below:
Ext.onReady(function() {
Ext.QuickTips.init();
var bounds = new OpenLayers.Bounds(
...
0
votes
1
answer
19
views
OpenLayers 2 - Capture failure of WFS HttpRequest
I have a WFS Layer whose HTTP Request might fail from time to time. How do I capture the failure?
var opt = {
url: widget.options.wfs.url,
params: {
...
2
votes
1
answer
234
views
Drawing new features with QGIS2web plugin
I would like to draw shapes with QGIS2web plugin
According to the query here:
Add OpenLayers3 controls to qgis2web project
I should be able to develop the qgis2web.js file further behind the ol.Map ...
1
vote
1
answer
75
views
QGIS2web label doesn't want to come out
I would like to have label visible for both cryterias in my layer.
One case works fine whereas the other one doesn't.
In the code everything is exactly the same...
function ...
0
votes
0
answers
76
views
QGIS2web struggling with labelling
I want to offset my label appearing in the interactive map generated by QGIS2web plugin.
Unfortunately the variables offsetX and offsetY don't work...
var size = 0;
var placement = 'point';
var ...
1
vote
0
answers
41
views
Search for the syntax to display an HTML link in an OpenLayers popup
I use a code found on the site : http://www.untourenvelo.ch/Carte_Plein_Ecran.html . It uses the Api Openlayers 2.13.1 .
In the development of this website it is possible to display GPX data that are ...
0
votes
0
answers
35
views
Unable to get output for WMSGetFeatureInfo in OpenLayers
Can anyone please help me on using the WMSGetFeatureInfo in OpenLayers. I am able to add WMS Layers on top of OpenStreetMap. But while using the FeatureInfo functionality I am not getting the results. ...
0
votes
0
answers
39
views
OpenLayers: given the same number of Features, is it better to have one big Layer or several small ones?
Given a certain amount of features that sometimes don't fit all together inside the current window, is it better to use one single/few big layer/s or it it better to split the features among more ...
0
votes
0
answers
67
views
OpenLayer2 Tween animation callback not working when the browser tab is inactive
I have data dumping in my db after some interval from resources.The geometry from the data then calling by JS interval function after every ten seconds.using this function to animate my feature http://...
1
vote
1
answer
186
views
OpenLayers styling lines between points
I drew a line between two points and would like to change the line styles but currently is not working as expected. Tried to add the style into the features. Am i missing something?
var ...
0
votes
0
answers
132
views
Points disappeared after changing CRS [duplicate]
I'm having a problem with CRS and layers in QGIS & on Geoserver
What I'm trying to accomplish to change CRS of layers in importing.
I'm importing 'test.geojson' file in QGIS, and when I open ...
1
vote
0
answers
19
views
Retrieving new data in the layer [closed]
I am solving the way of writing data to KML file using OpenLayers in map application. I want to ask if OpenLayers can insert new coordinates into a layer after 2 seconds, for example. So far I have ...
0
votes
0
answers
53
views
Is project more Leaflet or OpenLayers or Map Server friendly? [duplicate]
I have several tables in a database on PostGIS.
I want to create a website where the users can log-in, show the layers they want and filter the elements of the layers based on the fields of the ...
1
vote
1
answer
678
views
OpenLayers select.on event listener fires multiple times (renders multiple)
I am using hook React. How to render event only once instead multiple times useless?
When I am selecting a feature, it renders multiple times
var select = new ol.interaction.Select();
const translate =...
2
votes
1
answer
789
views
Resizing Map width and height (avoid distortion)
I am working with OpenLayers library on React
My first question is how to avoid distortion while resizing map width and height,
The second issue is when I am changing with/height each time it ...
1
vote
0
answers
37
views
OpenLayers zoom selected feature
In our OpenLayer.js we first call the maximum extent of the map:
"maxExtent: new OpenLayers.Bounds (X1, Y1, X2, Y2),".
After the layer definition follows
"map.addLayers ([lyr1, layer3, layer4]);" ...
2
votes
1
answer
132
views
Getting strange exception since switching to GeoServer 2.16 from 2.8 with WFS queries in OpenLayers 2
Here is the error in the GeoServer log (as it is returned to the caller):
2019-10-28 17:03:59,021 INFO [geoserver.wfs] -
Request: getServiceInfo
2019-10-28 17:03:59,053 ERROR [geoserver.ows] -
...
1
vote
0
answers
99
views
Migration from ol2 to ol6 fixed strategy missing
I try to migrate from ol2 to ol6.
My ol2 uses OpenLayers.Strategy abstract class with Fixed() and BBOX members:
var strategy = layerData.Strategy == "fixed" ? new OpenLayers.Strategy.Fixed() : new ...
0
votes
0
answers
422
views
How to add map.addControl, WMSLegend in OpenLayers 2
I am trying to get the categorized symbology for a single WMS layer in the layer switcher.
See my code below (I am getting error OpenLayers.Control.WMSLegend is not a constructor)
My OpenLayers ...
0
votes
0
answers
881
views
Unable to preventDefault inside passive event listener due to target being treated as passive: Openlayers 2
I am getting the following error messages: How do I define add control and prevent passive event listener?
Below is the code:
<!DOCTYPE html>
<html lang='en'>
<head>
<meta ...
1
vote
0
answers
361
views
No GetFeatureInfo response when clicking on a map in OpenLayers 2
I have the code below, however no response when clicking on the map.
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<title>My OpenLayers Map</...
1
vote
0
answers
2k
views
Uncaught Reference Error: init is not defined
I am getting the above error on my HTML file @ line number 22. I tried several attempts and was unable to resolve it.
Here is the HTML code:
<!DOCTYPE html>
<html lang="en">
<head&...
-1
votes
1
answer
418
views
Uncaught Reference Error: OSM is not defined Openlayers 2
I am trying to get the get feature info and popup to function. Currently, I face the above error. Not sure how to define OSM because all layers were loading fine before I added the getfeature part of ...
0
votes
0
answers
69
views
Attribute query OpenLayers server
As part of the MapServer polygons (district boundaries) are shown on the OpenLayers map. The script is in JavaScript. The polygons contain attributes.
Currently, a second window opens with the ...
0
votes
1
answer
52
views
Drag Vertices - ol2 Modify Control vs. ol3+ Modify Interaction
In OpenLayers 2, clicking a geometry with an active modify control running, created a drag vertice on every edge of the geometry which could be used to modify the geometry by dragging.
In OpenLayers ...
-2
votes
1
answer
104
views
Local coordinates in NoSql database
Is there any nosql database which supports the below
1) Should support local coordinates (spatial data which holds the coordinatesof door, Infra, etc.)
2)Integration with Geoserver.
2
votes
0
answers
278
views
Shapefile or GeoJSON? [closed]
I'm interested in understanding the relative merits of using GeoJSON or shapefile formats for handling geo-spatial data, particularly in an open-source, Python (CKAN project), web-development context.
...
1
vote
0
answers
31
views
Zoom to a selected feature with Openlayers 2
var cen = new OpenLayers.LonLat(lng,lat)
.transform(proj, map.getProjectionObject()); map.setCenter(cen,30);
I need to zoom into the feature selected.
0
votes
0
answers
67
views
OpenLayers 2.13.1 WMSGetFeatureInfo not working on mobile
I'm using OpenLayers in version 2.13.1. On desktops everything is OK, alert is showing when I click on route. But on mobiles it is not working, probably touch event is not triggered.
var infoControl =...
0
votes
0
answers
2k
views
How to render values onClick() event in componentDidMount()
I am using OpenLayer library and I need change values in ComponentDidMount() but when I am clicking it does not affect. I have used forceUpdate().
handleDisable = () => {
this.setState({ ...
0
votes
1
answer
341
views
How to change tileSize in XYZ from default([256,256]) to something else for openlayers?
I am trying to change the tile size and I have not been able. Below is the code.
var projection = get('EPSG:4326');
local_url = 'assets/tile/{z}/{x}/{y}.png';
map = new Map({
target: 'map',
...
0
votes
0
answers
177
views
Conversion from DXF to SVG
I want to convert a file from DXF to SVG and for that I am writing a python script. However, While converting from DXF to SVG there are certain features that are different such as xOffset, yOffset, ...
1
vote
2
answers
68
views
zoom set to 4 but on get zoom shows zero ,OpenLayers
var map1 = new OpenLayers.Map('firstmap');
var wms1;
var state1="<%=state%>";
var cql_filter1="st_nm='"+state1+ "'";
wms1 = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://localhost:...
0
votes
0
answers
179
views
Set center and zoom after CQL filter
I need to display map on the submenu li click with CQL filter which works for me but map displayed is as shown in screenshot. I am unable to adjust its center and zoom.
var map = new OpenLayers.Map('...
0
votes
0
answers
156
views
Get xy coordinates from latitude and longitude in OpenLayers 2
I'm trying to get the XY on layer but the values are wrong; the lat lon values are correct.
I need to convert lat/lon to xy values with OpenLayers 2.
0
votes
0
answers
120
views
How to get the color of pixel openlayes 2?
I'm trying to get the color of the pixel from the map in Openlayers 2.
Or is there is a function to get xyz values from rgb?