PostGIS: View Multiple Tables with PgAdmin

This post is useful if you have 2+ geo-referenced tables in PostGIS and are trying to visualize their rows on PgAdmin at the same time.

TL;DR

Just do a UNION query, make sure that the columns of each table match so the resulting union table make sense:

select id, geom from table1 where condition1
UNION
select id, geom from table2 where condition2;

In detail

For the example below I’ve used the following data

Here is how they both look separately in PgAdmin

# Here I'm using ST_Force2D because the geometry is 3D for downtown_buildings 
# and PgAdmin does not support it yet for visualization
select id, ST_Force2D(geom) from downtown_buildings;

# The 'roads' open data covers all Montreal, so I am limiting to downtown (Ville-Marie)
select id, geom from roads where arr_gch='Ville-Marie';

Now we UNION them

select id, ST_Force2D(geom) from downtown_buildings
UNION
select id, geom from roads where arr_gch='Ville-Marie';

… and now you can see both the roads that lead to the Parc du Mont-Royal and the  Kondiaronk Belvedere 🙂