Questions tagged [mapcanvas]
The mapcanvas tag has no usage guidance.
57
questions
0
votes
1
answer
49
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(...
0
votes
0
answers
25
views
Can't zoom to current layer from reprojecting geometry
We have developed GIS software based on QGIS
and PostGIS. The geometry has been stored in the projection
29702 and all functions work wonders
zoomToCurrentLayer
Now we have imported geometric data ...
3
votes
0
answers
42
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 ...
5
votes
2
answers
195
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 (...
1
vote
1
answer
41
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 ...
3
votes
1
answer
52
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 ...
1
vote
0
answers
33
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....
5
votes
1
answer
105
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"?
0
votes
2
answers
110
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....
1
vote
0
answers
137
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 ...
1
vote
0
answers
58
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 ...
5
votes
1
answer
627
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 ...
0
votes
0
answers
180
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 ...
2
votes
1
answer
334
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 ...
6
votes
1
answer
353
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):
...
2
votes
1
answer
182
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 ...
2
votes
1
answer
199
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 ...
1
vote
2
answers
282
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 ...
1
vote
0
answers
142
views
Stop QGIS from auto-resizing canvas?
Can the automatic resizing of the "canvas" be disabled in QGIS 3.10?
I have manually framed an area of interest, set and locked the scale, and set the magnification in order to be able to ...
8
votes
1
answer
639
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 ...
1
vote
0
answers
43
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 ...
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....
2
votes
1
answer
70
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 ...
0
votes
1
answer
304
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 ...
2
votes
0
answers
114
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 ...
2
votes
0
answers
453
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 ...
1
vote
0
answers
5k
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 ...
2
votes
1
answer
233
views
Unable to delete certain elements from my map
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 remove the check marks next to all my layers and the boxes won't go away.
I'm getting ...
2
votes
2
answers
1k
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())
...
3
votes
0
answers
663
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 ...
0
votes
1
answer
355
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()...
2
votes
2
answers
1k
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 ...
2
votes
1
answer
1k
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 ...
13
votes
2
answers
669
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(
...
1
vote
0
answers
404
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' ...
8
votes
1
answer
467
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/...
2
votes
0
answers
601
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-...
4
votes
1
answer
361
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 ...
5
votes
1
answer
2k
views
How to set QGIS map canvas size programmatically
I need my map canvas to be exactly 1920x1080. So the Save as image would save a png exactly this size.
I've tried setting it with
iface.mapCanvas.resize(QSize(1920,1080))
But no luck, resize() ...
2
votes
2
answers
942
views
How to determine when the map has finished rendering
I have written a few functions to compare QGIS performance to MapInfo. Most of them involve doing some analysis then dumping the results on the map, as such the process would be considered 'finished' ...
5
votes
1
answer
2k
views
Dynamically move map canvas and main window using PyQGIS
I am trying to create plugin that will open new window with some layer, Dynamically "pan" my window, when main window is pan. So boundingbox coordinates should be the same in both windows.
I need new ...
6
votes
1
answer
2k
views
Getting attribute values from vector features visible in QGIS canvas using PyQGIS
I have a vector layer (grid). Currently I select some tiles with the select tool and paste some Python code to get information about these features.
layer = qgis.utils.iface.activeLayer()
...
1
vote
0
answers
156
views
Qgis python: no interaction with Map Canvas
I've created a simple python script to load and show two layers and zoom to the first one. It looks like the script doesn't run the last 4 lines after I uncomment'print lyr1'. Anyway the map canvas is ...
11
votes
3
answers
6k
views
Refreshing MapCanvas while PyQGIS-script is running
I try to write a PyQGIS script similar to this:
Use of python console to prepare offline map from WMS (tile downloader).
Basically there are two loops to pan the mapCanvas, refresh the mapCanvas and ...
6
votes
1
answer
1k
views
How can I optimize layer filtering using setSubsetString or QgsFeatureRequest().setFilterFids(my_indexes)
I'm developing a plugin (QGIS 2.8.1) for a traffic assignment where I want to show the results of my simulation at each time step. Right now I'm using Time Manager plugin but it gets very slow when my ...
1
vote
0
answers
126
views
Mapcanvas not showing layers features
usually when i load an osm file with lots of features (>10000) the qgis will go not responding,
when the files loaded, layers will show up, but not the features on the map canvas, its just blank
...
3
votes
1
answer
798
views
zooming map in QGIS map canvas without changing the scale
I use QGIS to create maps mainly for printing in scale 1:100.000 to 1:25.000. It would be great, if the map in the canvas could be zoomed without changing the scale of the canvas.
The only way to get "...
1
vote
1
answer
809
views
Add a canvas on the map that can pan and zoom along with it
I want to know if it's possible to add a canvas on a ArcGIS map that can pan and zoom along with it.
The reason I ask that it's because we have different workflows where we have a lot of entities (+...
2
votes
1
answer
53
views
the renderering of mapcanvas is still active
i am working with qgis c++ api 2.8.2 and qt4.8.5
i want to disable the rendering during zoom in or zoom out fonction in order to have a fast zoom
i try to use :
MyMapCanvas->stopRendering();
and ...
4
votes
1
answer
2k
views
Drawing polygon in QGIS map canvas
I want to make a custom application which includes an option just like the "Select Features by Polygon" feature in the QGIS. I am able to draw the polygon using following code:
self.rb = ...