How you can view this query in qgis like maps?

1 year ago 17 Replies
Ján Infosuty Šutý
4 years ago

[data from pgadmin to QGIS]

Hello.

How you can view this query in qgis like maps?

Any ideas? Thanks you very much.

I can see only whole layers, but I don t know how view this query

29 Likes

Replies

Adelcides Varela 4 years ago

Conect to Postgis, and run query using DB Manager.

0 Likes
Adelcides Varela 4 years ago

https://docs.qgis.org/3.10/en/docs/training_manual/databases/db_manager.html?highlight=postgis#basic-fa-executing-sql-queries-with-db-manager

1 Like
Ján Infosuty Šutý 4 years ago

there is a problem with "no geometry"

0 Likes
Ján Infosuty Šutý (4 years ago)

Adelcides Varela (4 years ago)

Your query is missing geometry, you just have "sum".

Ján Infosuty Šutý (4 years ago)

Adelcides Varela yes, i know. But, how transform it, to make geometry?

Adelcides Varela (4 years ago)

Ján Infosuty Šutý can you send me the data?

Ján Infosuty Šutý (4 years ago)

Adelcides Varela https://gis.fns.uniba.sk/vyuka/gbu/data_nyc.zip

Adelcides Varela (4 years ago)

This query is much more efficient (just sum, no geometry):

Adelcides Varela 4 years ago

Ján Infosuty Šutý I'm achieving it using Virtual Layers, I'll keep trying using PostGIS and report the results.

0 Likes
Adelcides Varela 4 years ago

Ján Infosuty Šutý I finally got it:

2 Likes
Adelcides Varela 4 years ago

The result:

2 Likes
Ján Infosuty Šutý (4 years ago)

thank you very much , so you modify query and finally we can see view.

Adelcides Varela (4 years ago)

select name, sum (popn_total), st_astext(nyc_neighborhoods.geom) as geom from nyc_neighborhoods, nyc_census_blocks where st_intersects(nyc_neighborhoods.geom, nyc_census_blocks.geom) and name ='The Rockaways' group by name, nyc_neighborhoods.geom;

Ján Infosuty Šutý (4 years ago)

Adelcides Varela yes, it works.

Adelcides Varela (4 years ago)

Ján Infosuty Šutý no need to "create view" just "load layer".

Ján Infosuty Šutý (4 years ago)

Adelcides Varela yes, I understand. Thank you very much and have a nice day :)