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()....
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....
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.
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.
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 ...
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.
...
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 ...
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(@...
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) ...
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(...
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 ...
10
votes
Zooming/panning map in QGIS layout independently from frame?
You just have to use the "Move item content" tool
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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"
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");
});
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 ...
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
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 ...
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> ...
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 ...
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- ...
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 ...
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....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
zoom × 442qgis × 95
leaflet × 72
openlayers × 59
scale × 37
arcgis-desktop × 24
openlayers-2 × 24
arcgis-maps-sdk-javascript × 24
javascript × 23
pyqgis × 22
extents × 21
arcpy × 20
wms × 20
layers × 18
tiles × 16
arcmap × 15
geojson × 15
geoserver × 14
arcgis-pro × 14
carto × 13
features × 13
pan × 13
qgis-3 × 11
raster × 10
labeling × 10