Opened 13 years ago

Last modified 9 years ago

#159 new bug

SVG export doesn't crop layers to page size

Reported by: yajcolin-nospam@… Owned by: g_j_m
Priority: minor: annoyance Milestone: Version 1.7.0
Component: Printing Version: Trunk
Keywords: svg export Cc: yajcolin@…, pcav
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no


if I export a map in svg and if I zoomed in this map, svg export wil export all the map, not only the extended zoom. E.g. : I get a map of my country. I zoom in a county (to get only the north of my country for instance). The svg export get all the map, not just the county ! It can be good to "crop" all the rest of the map unnecessary.


Attachments (1)

bug_qgis_svg.jpg (219.0 KB) - added by yjacoli-nospam@… 13 years ago.
description of the problem when exporting in svg

Download all attachments as: .zip

Change History (14)

Changed 13 years ago by yjacoli-nospam@…

Attachment: bug_qgis_svg.jpg added

description of the problem when exporting in svg

comment:1 Changed 13 years ago by g_j_m

Owner: changed from rblazek to g_j_m
Type: enhancementdefect

comment:2 Changed 13 years ago by g_j_m

Milestone: Version 0.8 ReleaseVersion 0.9 Release

I can explain why this is happening, but don't have a solution for 0.8.

If an item is visible on the map, even just a small part of it, qgis draws the whole item. The svg writing part of Qt does the same, and uses a clip rectangle in svg to trim away the unwanted bits. From your example it looks like the large red shape is a single polygon, and a small part of that is included in the visible area.

It could be possible to use the existing trimming ability of qgis (originally there to work-around a problem X11 displays) to trim the svg output, but this would be a significant change that we wouldn't like to put in 0.8 - perhaps 0.9, hence I'll move this bug's milestone to 0.9

comment:3 Changed 12 years ago by StevenB

Awaiting user input: unset
Must Fix for Release: No
Summary: SVG exportSVG export doesn't crop layers to page size

comment:4 Changed 12 years ago by timlinux

Priority: majorminor

Changed to minor under the following scheme:

  • blocker - bugs that should block the release. Since we are going to release pretty much 'come what may' I would like no bugs
  • allocated to this category without consultation with me and / or PSC
  • critical - bugs that cause the application to crash or corrupt data
  • major - application features that do not function at all
  • minor - features that function but imerfectly e.g. labels placing incorrectly
  • trivial - gui useability issues or small issues with the documentation, install notes etc.

comment:5 Changed 11 years ago by gjm

Version: 0.8HEAD

An update on this bug:

The svg implementation in Qt (v4.4.0 when I last checked) only supports the static features of SVG 1.2 Tiny. This doesn't include clipping of shapes, which is the subject of this ticket. There is a Qt bug filed for this (204966), but no indication of when it will be resolved.

comment:6 Changed 11 years ago by brendonwp

Checked this in QGIS 1.0.0 Preview II. Confirmed this problem still exists.

comment:7 Changed 10 years ago by pcav

The bus seems still open upstream. Could someone check with Qt 4.5? The QGIS version should have little relevance. Thanks.

comment:8 Changed 10 years ago by lutra

Since version 1.1 qgis shows this message:

"The SVG export function in Qgis has several problems due to bugs and deficiencies in the Qt4 svg code. In particular, there are problems with layers not being clipped to the map bounding box. If you require a vector-based output file from Qgis it is suggested that you try printing to PostScript? if the SVG output is not satisfactory."

Not a qgis issue. Closing?

comment:9 Changed 10 years ago by StevenB

Personally, I would suggest leaving it open. Although the problem stems from a Qt deficiency, it's possible to work around it with code in QGIS. I vaguely recall that there may have been code to do this which was removed in the port to Qt 4.

comment:10 Changed 10 years ago by gjm

I'd also suggest leaving it open. It falls under the category of 'not our fault', but I think it's useful to have it flagged here, if only to remind us of the problem (and someone might fix it if it remains open in trac).

comment:11 Changed 10 years ago by lutra

Cc: pcav added
Milestone: Version 1.0.3Version 1.2.0

Ok, for me, pushing milestone to 1.2.0

comment:12 Changed 9 years ago by pcav

Milestone: Version 1.5.0Version 1.6.0

comment:13 Changed 9 years ago by pcav

Type: defectbug
Note: See TracTickets for help on using tickets.