Continuing on clustering queries

Max Pyziur pyz at brama.com
Thu Mar 28 15:46:13 PDT 2024


On Thu, 28 Mar 2024, Regina Obe wrote:

Thank you to everyone for their contributions here; trying to get to 
QGIS visibility here.

[... deleting for the sake of brevity ...]

>> This SQL variant does not return errors, but it isn't visible in my QGIS
> project
>> (it's an ongoing project with about twenty layers built with PostGIS).
>>
>> Any advice?
>>
>> Should I direct this inquiry to the QGIS list?
>>
>> Thank you,
>>
>> Max
> It might be because it returns a geometry collection.  I recall QGIS not
> liking geometry collections.
> Also depending on how you are creating this -- is this a view or an inline
> SQL, you might need to force the type for it to show as a layer option.

Regina: In these subsequent queries you are specifying SRS 4326; shouldn't 
it be 2163, the SRS of all of the other layers?


> Try:
>
>       SELECT cluster_id AS cid1 ,
>       ST_Collect(ST_MinimumBoundingCircle(ST_Collect(geom)),
> ST_Collect(geom))::geometry(GEOMETRYCOLLECTION,4326) AS geom
>       , COUNT(*) as ct FROM shapefiles.filling_station_clusters GROUP BY
>       1;

> Or having as two separate layers:
> -- layer 1
> SELECT cluster_id AS cid1 ,
> ST_MinimumBoundingCircle(ST_Collect(geom)):geometry(POLYGON,4326) AS geom
> , COUNT(*) as ct FROM shapefiles.filling_station_clusters GROUP BY
> 1;
>
> -- layer 2
> SELECT cluster_id AS cid1 ,  ST_Collect(geom):geometry(MULTIPOINT,4326) AS
> geom
> , COUNT(*) as ct FROM shapefiles.filling_station_clusters GROUP BY
> 1;
>
> Could also be a permission issue.
> If that doesn't help, then yes QGIS mailing list might have more useful
> answers.
>
> Hope this helps,
> Regina
>


Thank you again, I'll port these QGIS visibility questions to the QGIS 
users list.

But all of the layers that I load are done using PostGIS. Everything seems 
to be much more controllable that way.

Max


More information about the postgis-users mailing list