Feature request #1780

Labels: Data defined position from geometry column

Added by Mike Taves over 15 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:nobody -
Category:Map Canvas
Pull Request or Patch supplied:No Resolution:fixed/implemented
Easy fix?:No Copied to github as #:11840

Description

I would like to use a geometry (POINT) attribute to position label, using the example postgres schema:

CREATE TABLE region
(
  gid serial NOT NULL,
  geometry geometry, -- SELECT [[AddGeometryColumn]]('public','region','geometry',26910,'POLYGON',2);
  label geometry, -- SELECT [[AddGeometryColumn]]('public','region','label',26910,'POINT',2);
  ...
);

Here, there are two geometry columns: a polygon for the shape in the map, and a point to specify and store the label location.

The present versions (1.0.1 to 1.2.0 unstable) support X/Y coordinates from two numeric columns. (This is found in Layer Properties > Labels > Data defined position).

The enchantment requested in this ticket is to add another pull-down for a data defined position, which would be a geometry column. This seems more natural than defining two numeric columns for X and Y coordinates.

I suggest first keeping it simple, supporting only POINT geometries. However, I can also envision enabling MULTIPOINT (for multiple places of the same label), and perhapps [MULTI]LINESTRING for text along a path (creeks, rivers) if the text fits the length. Furthermore, the centroid can easily be extracted from all other geometry types ([MULTI]POLYGONs, COLLECTIONs, etc.) to represent the coordinate for the label (i.e., this is the "else"/"default" case for other geometry types).

History

#1 Updated by Giovanni Manghi almost 13 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#2 Updated by Giovanni Manghi over 12 years ago

  • Target version changed from Version 1.7.4 to Version 2.0.0

#3 Updated by Pirmin Kalberer about 12 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#4 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No
  • Pull Request or Patch supplied set to No

#5 Updated by Regis Haubourg over 7 years ago

  • Description updated (diff)
  • Priority changed from Low to Normal
  • Status changed from Open to In Progress

A QEP is opened for a related requirement here [[https://github.com/qgis/QGIS-Enhancement-Proposals/issues/46]]

QGIS 3 API is currently gaining the ability to handle multiple geometries, so we can consider we are getting closer

#6 Updated by Alessandro Sarretta over 6 years ago

It seems to me that the way the new QGIS 3.0 handles labels already covers this issue.

#7 Updated by Regis Haubourg over 6 years ago

  • Resolution set to fixed/implemented
  • Status changed from In Progress to Closed

Alessandro Sarretta wrote:

It seems to me that the way the new QGIS 3.0 handles labels already covers this issue.

I think we can close that yes. QGIS 3 still uses XY data defined columns however, but it is almost transparent to users with the auxiliary data storage.

Anyway we still have opened QEP in that area to be able to use a "path" for custom labeling. That would mean being able to move a label and have a custom geometry to be able to draw curved labels anywhere for instance

Also available in: Atom PDF