Questions tagged [openlayers-2]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
65 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 ...
Amr's user avatar
  • 1
1 vote
2 answers
1k 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 ...
Heliodor's user avatar
0 votes
1 answer
152 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 ...
Paul Butler's user avatar
1 vote
0 answers
47 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: ...
Araviz's user avatar
  • 37
1 vote
0 answers
244 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 ...
user208869's user avatar
1 vote
0 answers
37 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 ...
user208869's user avatar
0 votes
0 answers
425 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); ...
user208869's user avatar
0 votes
0 answers
422 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 ...
Araviz's user avatar
  • 37
2 votes
1 answer
510 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 ...
Lokomotywa's user avatar
  • 1,181
0 votes
1 answer
363 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"); ...
The Crasher's user avatar
0 votes
0 answers
888 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 ...
maycca's user avatar
  • 3,376
1 vote
0 answers
476 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, ...
CoderCoder42's user avatar
0 votes
1 answer
353 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 ...
andzaOs's user avatar
  • 11
0 votes
1 answer
105 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" ...
andzaOs's user avatar
  • 11
0 votes
1 answer
243 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 ...
andzaOs's user avatar
  • 11
2 votes
1 answer
301 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 ...
Geographos's user avatar
  • 4,087
0 votes
1 answer
243 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 ...
Karthik Bhat's user avatar
0 votes
0 answers
77 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 ...
winston's user avatar
0 votes
0 answers
480 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 ...
vvofdcx's user avatar
  • 101
0 votes
1 answer
247 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( ...
Otmane's user avatar
  • 1
0 votes
1 answer
32 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: { ...
Lokomotywa's user avatar
  • 1,181
2 votes
1 answer
369 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 ...
Geographos's user avatar
  • 4,087
1 vote
1 answer
198 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 ...
Geographos's user avatar
  • 4,087
0 votes
0 answers
173 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 ...
Geographos's user avatar
  • 4,087
1 vote
0 answers
116 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 ...
Manard82's user avatar
  • 187
0 votes
0 answers
53 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. ...
Mukesh's user avatar
  • 1
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 ...
iLikeKFC's user avatar
0 votes
0 answers
100 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://...
Shavaiz Hussain's user avatar
1 vote
1 answer
388 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 ...
Mezzan's user avatar
  • 113
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 ...
Loki's user avatar
  • 103
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 ...
Jan Manak's user avatar
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 ...
Basile's user avatar
  • 617
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 =...
Elvin's user avatar
  • 231
2 votes
1 answer
2k 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 ...
Elvin's user avatar
  • 231
1 vote
0 answers
99 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]);" ...
hugo's user avatar
  • 69
2 votes
1 answer
254 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] - ...
Brian B's user avatar
  • 815
1 vote
0 answers
137 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 ...
Michael's user avatar
  • 23
0 votes
0 answers
751 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 ...
Amelia Nicodemus's user avatar
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 ...
Amelia Nicodemus's user avatar
1 vote
0 answers
437 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</...
Amelia Nicodemus's user avatar
1 vote
0 answers
4k 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&...
Amelia Nicodemus's user avatar
-1 votes
1 answer
649 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 ...
Amelia Nicodemus's user avatar
0 votes
0 answers
196 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 ...
hugo's user avatar
  • 69
0 votes
1 answer
108 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 ...
Lokomotywa's user avatar
  • 1,181
-2 votes
1 answer
143 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.
user3474541's user avatar
2 votes
0 answers
790 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. ...
user16548's user avatar
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.
Wejden's user avatar
  • 11
0 votes
0 answers
88 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 =...
serek's user avatar
  • 1
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({ ...
Elvin's user avatar
  • 231
0 votes
1 answer
636 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', ...
UzmakiAshim's user avatar

1
2 3 4 5
66