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
  • 27k
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
16 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
  • 16.9k
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
  • 43.1k
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
  • 830
12 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,253
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
  • 74.9k
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
  • 17.1k
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
  • 649
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

Zooming/panning map in QGIS layout independently from frame?

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

Zooming/panning map in QGIS layout independently from frame?

There is a series of buttons under Item Properties that allow you to zoom the map extent shown in the data frame.* I just had success using the leftmost button seen the in orange rectangle in the ...
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
10 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
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,515
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
  • 41.4k
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

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
  • 69k
7 votes

How to slow the zoom transition speed in Leaflet?

After looking closer at the documentation, I found it's better to use: flyTo(<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options? ) Instead of: setView(<LatLng> ...
ianbroad's user avatar
  • 9,141
7 votes

QGIS hotkey assign: "select next feature and zoom to feature"

In QGIS 3.10 you can now setup a keyboard shortcut to Edit previous/next feature in attribute table. In my system it is set to Ctrl+Alt+[ and Ctrl+Alt+] respectively by default. See also this answer ...
onietosi's user avatar
  • 559
7 votes

Zoom automatically in the feature after clicking on it in QGIS

I think a layer Action might work well for your use case. Open the layer properties dialog, click the Actions tab then click the green plus sign to add a new action: Configure the action as below- ...
Ben W's user avatar
  • 23.1k
7 votes
Accepted

Is it possible to extract tiles layer as raster in QGIS?

You can export OSM XYT Tiles background map as raster file: right click on the OpenStreetMap layer and select Export / Save as... to save a copy of the background tiled map as raster file. Be sure to ...
Babel's user avatar
  • 74.9k
7 votes
Accepted

Zooming feature without selecting it using PyQGIS

You can use setExtent to the bounding box of the feature: layer = iface.activeLayer() feats = {f.id():f.geometry().boundingBox() for f in layer.getFeatures()} canvas = iface.mapCanvas() canvas....
Bera's user avatar
  • 77.7k

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