Questions tagged [openlayers-2]
Use this tag when you are using the DEPRECATED version 2.x of the OpenLayers JavaScript client toolkit.
3,295
questions
0
votes
0
answers
22
views
How to remove interaction from a map
as shown in the below posted code, when digitize() is called, the mouse cursor figure changes inidicating the i can start drawing a polyogn or a geometry on the map.
what i want to do, is when ...
1
vote
2
answers
971
views
OpenLayers with react and react-router
I am developing an application that has navigation on various maps, everything works well when a certain map is rendered for the first time, but if you go back to this tab again, the map either does ...
0
votes
1
answer
129
views
Openlayers H3 Binning works but map only displays on page load
I focused on an example of H3-JS binning work on Mapbox map canvas.
https://gis.utah.gov/developer/applications/suitability/
However, I wanted to work with Openlayers map. With some help I was able to ...
1
vote
0
answers
39
views
How to set click whole area of point icon?
I use cluster for points:
const clusterSource = new Cluster({
distance: this.configService.config.distanceCluster || 100,
source,
});
const clusterVector = new VectorLayer({
source: ...
1
vote
0
answers
175
views
How to add a hole into passed polygon?
I use the common source and vector layer to draw polygon and cutouts inside polygons:
public features: any[] = [];
addHole(type = "Polygon", feature: Feature) {
const modify = new ...
1
vote
0
answers
35
views
How to rewrite pointer after click OpenLayers?
I have a feature as point (icon). I try to modify it and recreate a point on the map with a new coordinates position by click.
this.modify = new Modify({
hitDetection: this.vector,
features: new ...
0
votes
0
answers
271
views
How to modify pointer in OpenLayers
I get feature as point geometry:
Then I try to modify this geometry (move point):
this.modify = new Modify({
features: new Collection([feature])
});
this.mapService.map.addInteraction(this.modify);
...
0
votes
0
answers
347
views
How to drag icon by image not by point modify?
I use Modify object and Translate object for moving point layer:
this.source = new VectorSource();
this.vector = new VectorLayer({
source: this.source,
zIndex: 900,
style: new ...
2
votes
1
answer
356
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
277
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
591
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 ...
1
vote
0
answers
397
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
262
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
1
answer
83
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
182
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
225
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
215
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
71
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
429
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
225
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
28
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
335
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
166
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
132
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
105
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
46
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
60
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
94
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
338
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
133
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
20
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
57
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
1k
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
1k
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
89
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
215
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
131
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
717
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
1k
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
431
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
3k
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
592
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
167
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
95
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
137
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
602
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
38
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
83
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
545
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',
...