[Qgis-user] Control symbol rendering in a way similar to label collision?
Andreas Neumann
a.neumann at carto.net
Tue Feb 2 09:44:32 PST 2021
Hi Cory,
Perhaps not exactly what you want - but did you also look at the point
cluster renderer?
If you use that, points are clustered at small map scales, but are shown
individually if you zoom in further.
It might help a bit in your situation.
Andreas
On 2021-02-02 17:20, Cory Albrecht wrote:
> Hello all,
>
> I am looking for a way to control symbol rendering in a way similar to
> how labels are omitted ot not to prevent collision.
>
> I want to use the GeoNames data to populating cities, towns, etc... on
> my maps, but there are still millions of points even after filtering
> for populated places. This is what a section of the map from
> Dakotas/Montana/Wyoming looks like now, with a confused mess of
> overlapping symbols. It's worse on the coasts. BTW, this layer is a
> points layer.
>
> First I thought maybe Scale-based rendering by population size, but
> that doesn't work, because farther out zoom levels there'd still be a
> mess of overlapping symbols in heavily populated places like NYC or LA,
> and in less populated places the smaller cities and towns that are
> important wouldn't even show (like that black dot, which is Rapid City,
> SD) even though there would be plenty of room for them.
>
> I can control the rendering order based on population size, so is there
> a way to control whether a not a symbol gets rendered based on what has
> already been drawn, but ignoring what has yet to be rendered?
>
> I'm imagining a set of stops similar to this:
>
> * iterate through all items in order of the population attribute
> * get the current item's location where it would potentially be
> rendered on the map
> * has anything been rendered already within 5mm (or whatever) of that
> location?
> * if yes, go to next item without rendering this one
> * if no, then render it's symbol
> * continue to next item
>
> So after that dot which is Rapid City gets rendered, but then those
> overlapping circles do not until you finally get to one with a centre
> 5mm away from the centre of the Rapid City dot.
>
> While googling I found the refFunctions plugin which adds some
> functions dealing with overlaps, but since the layer is composed of
> points, nothing really overlaps. Also, adding something like `_...AND
> (population >= array_max(geomoverlaps('cities','population')))_` to a
> rule in Symbology to exclude/include things for rendering looks at
> everything without distinguishing between already rendered and yet to
> be rendered, like I need.
>
> Am I thinking about this wrong and am thus missing something obvious? I
> know I only use a small portion of QGIS's capabilites, so maybe there's
> a tool/capability I haven't discovered yet because I haven't needed it
> until now?
>
> The layer is a PostGIS layer and this would seem to be a wholly QGIS
> problem, but maybe I am wrong on that, too? Maybe there's a way of
> passing the map scale in the SQL query ('SELECT *, 1.0 as map_scale
> FROM...') so that some weird WHERE clause would do the filtering there?
> That seems unlikely and a bit crazy, but who knows?
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210202/a5f17565/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 10844 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210202/a5f17565/attachment-0001.png>
More information about the Qgis-user
mailing list