Skip to main content

Questions tagged [mapcanvas]

Aggregate refers to the process of summarizing grouped data, commonly used in Statistics.

Filter by
Sorted by
Tagged with
0 votes
1 answer
68 views

Qgis2Web changing canvas size

I am using QGIS 3.28. I exported my project using Qgis2Web plugin. The base map is OSM. But it gives me the entire world map. Is there a way to limit the base map to specific country/area?
YuvalM's user avatar
  • 399
1 vote
1 answer
93 views

PyQGIS zoomscale freezes map canvas

I have a PyQGIS code made partially with graphical modeler and some personal completion. Basically, based on this code I want: Type any city from my point shapefile, select it by attribute. Zoom to ...
Marin Marian's user avatar
0 votes
0 answers
147 views

Callouts/annotation showing in map layout but not in map canvas

I need to modify a map layout to remove a couple of callouts. They appear in the Layout but are not showing in the main canvas. I'm not sure who or how they were created. Any ideas on what's going on ...
Carla's user avatar
  • 1
2 votes
2 answers
187 views

How to ensure a newly created layer displays on the canvas

I am trying to perform some categorization from an existing vector layer such that after performing the calculations, a new vector layer is created with just the new fields created. After running my ...
Beginner's user avatar
1 vote
1 answer
81 views

Storing Map Canvas (current view) so it may be recalled and restored later using QGIS

Is there any way in QGIS3 to save "settings" for the current map canvas/view so the very same view can be restored later?
quagmire's user avatar
  • 231
0 votes
0 answers
557 views

OpenLayers is blurring the ImageLayer (Raster Image)

I'm trying to use an 8192 x 4096px Image as a layer in OpenLayers and my code is as followed import Map from "ol/Map"; import View from "ol/View"; import TileLayer from "ol/...
Rahul Ahire's user avatar
4 votes
1 answer
53 views

Save an item at the MapCanvas

I am using PyQGIS to generate some polylines. The lines are shown at the MapCanvas. How do I save these lines to a vector layer? My PyQGIS : class LængdeBreddeGrader : from qgis.core import ...
Leif Birch's user avatar
1 vote
1 answer
186 views

How to eliminate the gap in OpenLayers within the canvas for EPSG:4326 projection

I'm using XYZ tiles with EPSG:4326 projection but tiles originally comes with EPSG:3857. For 3857 when I set the width and height to both 1000px there is no gaps and the tiles get filled up properly. ...
Rahul Ahire's user avatar
2 votes
1 answer
224 views

Get properties of QgsVertexMarker upon mouse click

I'm looking for a way to trigger an event upon clicking on a QgsVertexMarker object which is located on a mapCanvas. In the official docs, there is a mousePressEvent method which I actually re-...
druid's user avatar
  • 63
5 votes
1 answer
2k views

How to mask everything but a polygon in QGIS?

I am able to draw polygons over areas of interest in QGIS. For example via: Layer -> Create Layer -> New Temporary Scratch Layer, name the layer, select Polygon as Geometry type, OK, select the ...
zabop's user avatar
  • 2,692
1 vote
1 answer
336 views

Get extent of the current map canvas in a virtual layer query in QGIS

Is it possible to get the extent of the current map canvas in a virtual layer query? Something similar to the variable @map_extent in QGIS expressions that can be used to create a polygon covering the ...
Babel's user avatar
  • 74.9k
1 vote
1 answer
185 views

Redraw a Point in the lower left corner (QGIS)

I want to draw a point in the lower left corner of the QGIS map window (canvas). I tried the geometry genarator in the layer attributes: point_n(@map_extent, 1) This works, but I want the point ...
MarinT's user avatar
  • 75
1 vote
1 answer
134 views

Is there a functionality similar to ArcGIS' data driven pages for the QGIS map view?

I know how to create an atlas for a QGIS layout, but what I'm looking for is a functionality for the map view which lets me use the features of a vector layer to zoom/pan to the next/last feature - ...
Daniel Fuchs's user avatar
2 votes
1 answer
801 views

OpenLayers 6 print map with scale to pdf via jsPDF

I am using: angular 8V, Open Layers 6.4 V I would like to save my OpenLayers map as PDF. I am able to Print map smoothly using this example. OpenLayer Example. input Form is: selection of pdfType(...
developer g's user avatar
3 votes
0 answers
71 views

Docked attribute table not displayed when reopening a QGIS project

I have created a project with multiple map views (canvases). I have also opened vertically in the project an attribute table. When I save and reopen the project, the layout is lost. What can I do to ...
N_S's user avatar
  • 313
5 votes
2 answers
573 views

Displaying only visible in canvas features in attribute table using PyQGIS

As explained by @xunilk in Getting attribute values from vector features visible in QGIS canvas using PyQGIS we can easily access to the attribute values of the features visible in the QGIS canvas (...
wanderzen's user avatar
  • 2,150
1 vote
1 answer
207 views

Custom map pan tool freezes map canvas extent, cuts off map tiles (QGIS 3.18)

I've written my own QGIS map tool class to access the protected member functions (canvasPressEvent, canvasReleaseEvent, etc) as well as to be able to limit the distance panned. Specifically I've ...
skew_t_pie's user avatar
3 votes
1 answer
664 views

Using QgsMapCanvas on a QGIS Processing script

I am writing an QGIS Python processing script, the result of this script is a formatted PDF. In one of the steps, I need to set map canvas extent to my shapefile extent, but it is not working. What is ...
ConsalterR-1988's user avatar
1 vote
0 answers
60 views

Accessing scene item list without crashing QGIS?

Temporary graphics items can be added to the canvas, e.g with. canvas = iface.mapCanvas() point = QgsPointXY(10, 55) vm = QgsVertexMarker(canvas) vm.setCenter(point) and can be removed by using iface....
mins's user avatar
  • 267
5 votes
1 answer
2k views

Locking the scale while resizing the panels in QGIS

QGIS changes map canvas scale while resizing the panels. I use iface.mapCanvas().setScaleLocked(True) to lock the scale. Is there a manual option to lock the scale in "Settings"?
Kadir Şahbaz's user avatar
0 votes
2 answers
535 views

Canvas refresh not Working in QGIS

The canvas is not showing the changes after 1 second. The point is visible only after the whole script gets executed. Here is the Script: import time def refresh(): cachingEnabled = iface....
Abhinivesh's user avatar
1 vote
0 answers
740 views

Setting default project view extent in QGIS

I'm trying to find a setting in QGIS that will allow me to save a default view extent - so that when I open a saved project file, it opens on the area of interest. Currently the map loads at some ...
ActionEcologist's user avatar
2 votes
0 answers
199 views

Remove Yellow Squares Created by the LRS Plug-in

Does anyone know how I can remove the yellow squares which appear in my QGIS project when using the "Locate" tool within the "LRS" Plug-in? I have refreshed the Project and also ...
Tim W's user avatar
  • 101
6 votes
1 answer
1k views

Getting X,Y coordinate with mouse click on vertex of line feature using PyQGIS

How do I get X,Y coordinate with mouse click with enabling snapping so that only line's vertex point coordinates will be selected? By using following code I can get latitude longitude of clicked ...
Devenepali's user avatar
0 votes
0 answers
643 views

Dragging multiple polygons on Canvas rerender in React Leaflet

I am using React Leaflet to render Leaflet map and Leaflet.Path.Drag to drag multiple polygons together. Here is a demo. I have a lot of polygons and would like to drag multiple polygons with ...
Matt's user avatar
  • 95
2 votes
1 answer
856 views

Correcting canvas DPI in QGIS Windows

I'd like my QGIS map canvas scale to be accurate, e.g. so if the scale is 1:10000, then 100m on the ground should show in 1 cm of screen. My Windows laptop screen has 157 ppi (dpi) based on its ...
Houska's user avatar
  • 8,406
6 votes
1 answer
930 views

QgsMapToolEmitPoint - output coordinate to QGIS python console

I'm trying to output points to the QGIS Python Console with the following code which works: canvas = iface.mapCanvas() emit = QgsMapToolEmitPoint(canvas) canvas.setMapTool(emit) def display(pt, e): ...
user1655130's user avatar
2 votes
1 answer
568 views

Writing Custom Map Tools using RectangleMapTool

I am creating a plugin with a preview window where the user must select a rectangle to define the study zone. I see in this https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/canvas.html ...
Bárbara Duarte's user avatar
3 votes
1 answer
453 views

Export map in OpenLayers with toJPEG

Recently, we set up a web app with OpenLayers that allows exporting a map as a jpeg image. The map contains XYZ, WMS and/or WFS layers. We used the toJpeg function of the html-to-image library, as it ...
juminet's user avatar
  • 1,285
1 vote
2 answers
707 views

How to add shape file directly to the print composer/Layout view in QGIS?

We can easily add the map from map canvas to print composer but is there any possible way to add vector layer directly to the print composer in QGIS either by PyQGIS script or by using some plugin or ...
Devenepali's user avatar
8 votes
1 answer
1k views

QGIS: Is there a way to make the "Python Console" a separate window?

QGIS 3.10; Ubuntu 18.04 When Plugins->PythonConsole is accessed, it opens as a panel, changing the shape of the map canvas. Can it be a separate window instead? Alternatively, is there a way to run ...
quagmire's user avatar
  • 231
1 vote
0 answers
159 views

How can i save and load items in canvas format in leaflet?

I've created a leaflet map and added draw control. I can draw lines, polygons, and markers but I need to add a canvas and draw my favorite drawing items like this : I want to save these items and ...
hamed's user avatar
  • 101
4 votes
1 answer
14k views

Hiding a layer in Layers panel, but showing in Map Canvas [duplicate]

When a layer is added to QGIS, it is ordinarily added to "Layers" panel and "Map Canvas". The same thing happens when a memory layer (loaded/created by QgsVectorLayer) is added using QgsProject....
Kadir Şahbaz's user avatar
3 votes
2 answers
216 views

Shortcut to activate and deactivate a layer filter

I'm looking for the fastest way to filter and unfilter a layer in qgis 3. My current workflow is too tedious: right click on layer / filter / write filter or delete filter My final goal is to see ...
César Arquero Cabral's user avatar
0 votes
1 answer
493 views

Adding layer to canvas crashes QGIS

I am having some difficulties in adding a layer to my canvas or even to main project. I create a plugin in QGIS 3.10. This plugin has a table of contents and a canvas to open some maps. I search and ...
Bárbara Duarte's user avatar
2 votes
0 answers
302 views

2D canvas library for OpenLayers. Drawing custom interactive objects

I am looking for the 2D canvas library like Konva.js that I can use above OpenLayers 5.x. I need to draw shapes with font inside that are interactive - can be dragged over the map to the appropriate ...
nickolay's user avatar
  • 121
2 votes
0 answers
557 views

PyQGIS (3.6.3 Noosa) Why is self.iface.mapCanvas().setExtent() being overridden in plugin?

I am writing a plugin that first adds the Google Imagery XYZ tile layer and then adds various other layers - some from a GeoPackage and others by creating their geometry in PyQGIS. The last function ...
Matt's user avatar
  • 17.9k
1 vote
0 answers
7k views

Increasing size/height of OpenLayers map/canvas?

I'm trying to let the Map/Canvas height of OpenLayers 100%, but I'm not able to do it. I've already tried putting in several places the "height: 100%;" and used the "map.updateSize()" function, but ...
rmmariano's user avatar
  • 267
8 votes
0 answers
236 views

Rendering features that are just outside the map canvas extent in QGIS

In QGIS 3.4 I am trying to generate a cloudy mask, following the recipe in "Qgis Map Design 2nd ed. Edition". For the most part, I have it working. But when panning around, the mask changes. ...
Jay Cummins's user avatar
  • 14.7k
4 votes
1 answer
1k views

Unable to delete certain elements from my map in QGIS

Can anyone help me get rid of these 2 boxes? I can't figure out how they showed up in the first place. I've removed the check marks next to all my layers and the boxes won't go away. I would rather ...
Pascal Dubé's user avatar
3 votes
2 answers
2k views

Get QgsLayoutItemMap from existing QPT Layout

I created a QPT model with a map inside QGIS. The problem is when I try to select the map under pyQGIS : qpt = QDomDocument() qpt.setContent(content) layout = QgsLayout(QgsProject().instance()) ...
dmjf08's user avatar
  • 1,313
4 votes
0 answers
817 views

Add OpenLayers map on map canvas with PyQGIS

I have map canvas with two shapesfiles, and I want to add OSM map behind. My code for this is: from PyQt5.QtGui import * from PyQt5.QtWidgets import QHBoxLayout, QDockWidget, QWidget from osgeo ...
Neven's user avatar
  • 546
0 votes
1 answer
421 views

How to set 2 vector layers into map canvas, pyqgis 3.0

I have 2 shapefiles which I need to lap. The first one is city grid, and the second one representing borders of the city. Anyway, my code is: extent = QgsRectangle() layers = [] QgsProject.instance()...
Neven's user avatar
  • 546
3 votes
2 answers
2k views

Export Map Error from OpenLayers 3 in Chrome?

Im using this js file to export map in Openlayers 3 in Google Chrome but i'm getting en error saying that Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases ...
Satya Chandra's user avatar
2 votes
1 answer
2k views

Use a second canvas for drawing an animation in Openlayers

I want to implement an animation of flowing rivers on top of an Openlayers map. My doubts are if I simply should make a new canvas and position it on top of the map or if there is a more elegant way ...
geraldo's user avatar
  • 1,000
14 votes
2 answers
818 views

Displaying generated lines out of map extent using QGIS?

I have drawn an OD flow map using QGIS geometry generator, using the following expression : make_line( centroid( $geometry ), centroid( geometry( get_feature( 'Layer2', 'Attribute1', attribute( ...
mamouthautapis's user avatar
1 vote
0 answers
480 views

Implementing 'Add feature' functionality programmatically to QGIS?

I have a script that is adapted from the book Menke - Mastering QGIS and used to draw a polygon directly on the map canvas. Now I want to expand upon that script and mirror the 'add feature' ...
dreks's user avatar
  • 103
8 votes
1 answer
629 views

Accessing QGIS map canvas as a variable for expressions

Is it possible to access the QGIS Map Canvas as a variable or expression value to be used in the field calculator or labelling engine? (i.e. so that you can create an expression that selects/...
guestagain's user avatar
2 votes
0 answers
701 views

Label only one polygon in canvas/map view per category/value in attribute table

Question: In QGIS (2.18), how do you show only one label per field of view in the map canvas for each visible category (that is displayed in the map view/canvas at any given scale/focus) of a multi-...
guestagain's user avatar
4 votes
1 answer
423 views

Recursive loop to modify vector layer and refresh mapcanvas

I'm trying to plot one point "jumping" each second in the canvas (like a gps tracking). I need to take points from a .csv file. This functionality is made in a QWidget of my application, so the code ...
Nacho F.'s user avatar