Skip to main content
27 votes
Accepted

Detecting zoom change in OpenLayers

To hook on zoom end event is fairly simple: listen to moveend event and compare old and new zoom: var currZoom = map.getView().getZoom(); map.on('moveend', function(e) { var newZoom = map.getView()....
TomazicM's user avatar
  • 26.2k
22 votes
Accepted

Show/hide markers depending on zoom-level

All right. I came up with a solution using a layer: var shelter1 = L.marker([55.08, 11.62], {icon: shelterIcon}); var shelterMarkers = new L.FeatureGroup(); shelterMarkers.addLayer(shelter1); map....
Saud 's user avatar
  • 711
17 votes

Leaflet mouse wheel zoom only after click on map

More of a comment/improvement on the toggle component of the accepted answer, which is great (thanks). But. When interacting with a map, for many use cases the user also needs to click the map to ...
danwild's user avatar
  • 725
15 votes
Accepted

Zooming/panning map in QGIS layout independently from frame?

You can pan the map by first selecting it. Then using the "Move item content" tool: While this tool is active as well you can also use the mouse wheel to zoom in and out on the map.
HeikkiVesanto's user avatar
14 votes
Accepted

Is it possible to set different scale dependent visibility for one layer classifications?

You need to use Rule based style to set the scale for primary, secondary and tertiary network, as you can see below (but with different data): You can double-click each styled label to get more ...
ahmadhanb's user avatar
  • 41k
14 votes
Accepted

Tying visibility of features to zoom level by attribute in QGIS

You can change the style to be rule-based (it will preserve the classes if a categorized style was previously set), and there you can control the display scale of each class/rule.
JGH's user avatar
  • 42.2k
13 votes

How to slow the zoom transition speed in Leaflet?

Your map.flyTo() has the options malformed, you want map.flyTo([lat, long], 14, { animate: true, duration: 1.5 }); See Doc's pan-options. The same parameters will work fine also ...
inc42's user avatar
  • 810
12 votes

Showing points as one big point

Use Point Cluster rendering style - where points are closer then a certain distance (7 Millimeters in the screenshot), it will not show individual points, but a separate symbol indicating the number ...
Babel's user avatar
  • 71.9k
11 votes
Accepted

Leaflet Basemap zoom to maximum

The Tile Layer maxZoom option default value is 18. The maximum zoom level up to which this layer will be displayed (inclusive). That is why it is automatically hidden when you zoom past level 18. ...
ghybs's user avatar
  • 7,203
11 votes

Tying visibility of features to zoom level by attribute in QGIS

Get ready for the probably most useful option when it comes to symbology: data defined override My suggestion: For each of your classes, set the line type based on your current scale, e.g. if(@...
Erik's user avatar
  • 16.5k
10 votes

Disable doubleclick zooming in OpenLayers 3

If you want to disable doubleClickZoom after map initialization, here is the way: var dblClickInteraction; // find DoubleClickZoom interaction map.getInteractions().getArray().forEach(function(...
Chase Choi's user avatar
  • 1,087
10 votes

Zooming to selected feature using PyQGIS

Zoom to selected features can also be performed by triggering the "Zoom to Selection" option of View menu. eMenu = self.iface.viewMenu() eMenu.actions() [12].trigger() Note: The index ...
Sjs's user avatar
  • 1,007
10 votes

Shapefile layers in QGIS don't display unless I zoom out

I had the same problem. In my case, the problematic shapefile had been created by ArcGIS. I fixed it by removing the useless extra files ESRI add to shapefiles (.cpg, .qpj, .sbx, and .shp.xml) ...
Bastien's user avatar
  • 639
10 votes

Zooming/panning map in QGIS layout independently from frame?

You just have to use the "Move item content" tool
J.R's user avatar
  • 16.4k
10 votes

Zooming/panning map in QGIS layout independently from frame?

There are a series of buttons under Item Properties that allow you to zoom in on data in map. I just had success using the leftmost button (in orange rectangle) "Set Map Extent to Match Main Canvas ...
deeproyalblue's user avatar
10 votes
Accepted

Zoom to feature by clicking cell in the Attribute Table

I've found a temporary solution: layer = QgsProject.instance().mapLayersByName("LAYER_NAME")[0] attr_table = iface.showAttributeTable(layer) table = attr_table.findChildren(QTableView)[0] def ...
Kadir Şahbaz's user avatar
9 votes

Shapefile layers in QGIS don't display unless I zoom out

My coworkers and I were all having this problem in versions of QGIS that range from 2.6.1 to the new 2.14. The solution we worked out is to run: Vector > Geometry Tools > Multiparts to Singlepart... ...
Benjamin Gappa's user avatar
9 votes

Zoom map to a scale in Leaflet

First, a note about map scales. A map scale represented as a unitless factor (e.g. 1:50000) means that a map unit represents X map units (e.g. a meter in the map = 50 km in reality). This kind of ...
IvanSanchez's user avatar
  • 10.3k
9 votes
Accepted

Leaflet: Resize markers in layer when zoom in

You have all your markers inside a L.GeoJSON, which is a subclass of L.LayerGroup, so you can use the eachLayer method, like... all_testptLayer.eachLayer(function(layer) { // Do something with ...
IvanSanchez's user avatar
  • 10.3k
9 votes
Accepted

QGIS: zoom further than threshold in WMTS

This specific WMTS source has a small problem: not all reported scales have available tiles. If you look at the capabilities document, the TileMatrix has 22 scales available (up to level 21) for the ...
jgrocha's user avatar
  • 5,405
9 votes
Accepted

Zooming to each vector layer extent, one at a time, using PyQGIS

You can solve your issue using QTimer which controls when to execute functions and it's asynchronous, i.e., it allows other functions to continue to run (think of a map.refresh()) while waiting some ...
Kadir Şahbaz's user avatar
8 votes

QGIS - Disable Mouse Wheel Zoom

In QGIS 2.14.7 LTR there is an option to completely disable zooming using the mouse wheel from Settings -> Options -> Map Tools -> Panning and Zooming, you need to change Mouse wheel action ...
ahmadhanb's user avatar
  • 41k
8 votes

Point from GeoPackage disappears when zooming in QGIS

I've seen this happen with a out of date Spatial index file. Have look in the directory where the shapefile is and if there is a file with the same name as the shape file with a .qix extension try ...
Andrew Jeffrey's user avatar
8 votes

Label font size and scale QGIS 3.0

Right-click on your layer -> Properties... -> Labels -> According to your CRS, you can use "Meters at scale" or "Map Units"
Christophe P.'s user avatar
8 votes

Detecting zoom change in OpenLayers

there is a simpler way for you to do it: map.getView().on('change:resolution', (event) => { console.log("zoom changed"); });
Pavel Pejšek's user avatar
7 votes
Accepted

change width of outline for leaflet map depending on zoomlevel

I slightly changed your code, and this is working for me: var myStyle = { fillColor: '#1c9099', color: 'white', weight: 3 }; var polygon = L.polygon( [[51.509, -0.08], [51.503, -0....
tallistroan's user avatar
  • 2,351
7 votes
Accepted

ZoomIn or ZoomOut on click

first you'll have to create your html elements ( buttons, radio, ... ) where you want to put + and -, here is an example using buttons : <button id="zoom-out">-</button> <button id="...
Hicham Zouarhi's user avatar
7 votes

Leaflet: Resize markers in layer when zoom in

Use setIcon() to change the markers icon in a layer: var layer = '';//define the layer that contains the markers map.on('zoomend', function() { var currentZoom = map.getZoom(); //Update X ...
Shiko's user avatar
  • 2,893
7 votes
Accepted

Disable double click zoom event in Leaflet for R

There is the option doubleClickZoom = FALSE : leaflet(data,options = leafletOptions(doubleClickZoom= FALSE)) %>% ... Other options can be found here : Disable leaflet interaction temporary
Pierre Rinder's user avatar
7 votes

Small features don't draw when zoomed out using Geoserver WMS

The PostGIS driver of GeoServer has a feature that is not documented at the moment in the PostGIS datastore manual http://docs.geoserver.org/stable/en/user/data/database/postgis.html. This feature is ...
user30184's user avatar
  • 66.8k

Only top scored, non community-wiki answers of a minimum length are eligible