[Qgis-user] question
Brent Wood
Brent.Wood at niwa.co.nz
Fri Mar 14 14:35:00 PDT 2025
Postgis generated hexagons are NOT H3 hexagons - unless you very carefully generate them to fit.
Use the Postgres h3 extension for h3 hexagon support:
https://blog.rustprooflabs.com/2022/04/postgis-h3-intro
Brent Wood
Principal Technician, Fisheries
NIWA
DDI: +64 (4) 3860529
________________________________
From: Sylvain Ard <sylvain.ard at gmail.com>
Sent: Saturday, March 15, 2025 08:49
To: Brent Wood <Brent.Wood at niwa.co.nz>
Cc: qgis-user at lists.osgeo.org <qgis-user at lists.osgeo.org>
Subject: Re: [Qgis-user] question
yes but H3 can't simplify the job ?
Sylvain Ard
0549507724
0778380991
sylvain.ard at gmail.com<mailto:sylvain.ard at gmail.com>
https://www.sylvain-ard.fr<http://sylvain-ard.fr/>
Entreprise individuelle SIRET : 80079243400022
Appt 26 Bât A Résidence Le Patio
83 rue de la Bugellerie
86000 Poitiers
Le ven. 14 mars 2025 à 20:48, Brent Wood <Brent.Wood at niwa.co.nz<mailto:Brent.Wood at niwa.co.nz>> a écrit :
Hi,
Off the top of my head...
Postgis can easily cope with millions of records. Given the points are there, use that to create the hexagons as required - this can be done using https://postgis.net/docs/ST_HexagonGrid.html
If you set up your QGIS project with preset zoom levels, and create a set of appropriately sized hexagons for each zoom level, then populate a column with the number of points it contains.
There will be some devilish details - as you zoom in, the polygon's real area will get smaller, so will contain less points. A fixed symbology will therefore change the colour range with the scale.
Calculating a normalised value, perhaps something like instead of the no of points, you calculate a normalised value - the hex at each scale with the most points gets 100, the rest get a value based on the no of points/the max for that scale, so all polygon datasets will have colours set to values between 0 and 100. All doable with SQL.
Do all the data stuff in Postgis, then just plot in QGIS.
There are various ways to set QGIS up for this, but one reasonably straightforward way that should work is having a separate hexagon layer for each scale, with a scale limit on displaying it so that all map scales are represented by one of the hexagon layers, with the fixed zoom levels/scales, set the same symbology for each layer, then group them into a single group.
Something to consider anyway...
Cheers
Brent Wood
Principal Technician, Fisheries
NIWA
DDI: +64 (4) 3860529
________________________________
From: QGIS-User <qgis-user-bounces at lists.osgeo.org<mailto:qgis-user-bounces at lists.osgeo.org>> on behalf of Sylvain Ard via QGIS-User <qgis-user at lists.osgeo.org<mailto:qgis-user at lists.osgeo.org>>
Sent: Friday, March 14, 2025 23:35
To: qgis-user at lists.osgeo.org<mailto:qgis-user at lists.osgeo.org> <qgis-user at lists.osgeo.org<mailto:qgis-user at lists.osgeo.org>>
Subject: [Qgis-user] question
Hello,
I'd like a map with hexagons that are darker the more points there are underneath. My points are in a PostgreSQL table. If there are no points, there should be no hexagon. The hexagons have a constant size on the screen, so they have to be recalculated each time the map is zoomed in. I want a truly optimized solution because I have millions of points. So, perhaps I could use QGIS-server.
Please suggest a solution for both the server and client side.
Best regards
PS : my map must be like GBIF maps
Sylvain Ard
0549507724
0778380991
sylvain.ard at gmail.com<mailto:sylvain.ard at gmail.com>
https://www.sylvain-ard.fr<http://sylvain-ard.fr/>
Entreprise individuelle SIRET : 80079243400022
Appt 26 Bât A Résidence Le Patio
83 rue de la Bugellerie
86000 Poitiers
[https://www.niwa.co.nz/static/niwa-2018-horizontal-180.png] <https://www.niwa.co.nz/>
Brent Wood
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529
National Institute of Water & Atmospheric Research Ltd (NIWA)
301 Evans Bay Parade Hataitai Wellington New Zealand
Connect with NIWA: niwa.co.nz<https://www.niwa.co.nz/> Facebook<https://www.facebook.com/nzniwa> LinkedIn<https://www.linkedin.com/company/niwa> Twitter<https://twitter.com/niwa_nz> Instagram<https://www.instagram.com/niwa_science> YouTube<https://www.youtube.com/channel/UCJ-j3MLMg1H59Ak2UaNLL3A>
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems.
Note: This email is intended solely for the use of the addressee and may contain information that is confidential or subject to legal professional privilege. If you receive this email in error please immediately notify the sender and delete the email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20250314/af33f2bc/attachment.htm>
More information about the QGIS-User
mailing list