pgAdmin4 version 3.3 released this week comes with a PostGIS geometry viewer. You will be able to see the graphical output of your query directly in pgAdmin, provided
you output a geometry or geography column.
If your column is of SRID 4326 (WGS 84 lon/lat), pgAdmin will automatically display against an OpenStreetMap background.
We have Xuri Gong to thank for working on this as a PostGIS/pgAdmin Google Summer of Code (GSOC) project. We'd like to thank Victoria Rautenbach and Frikan Erwee for mentoring.
Give it a try:
Write a query that outputs a geometry or geography column. Below is an example.
SELECT s.stusps, c.name, ST_Transform(c.the_geom,4326)
FROM tiger.county AS c INNER JOIN tiger.state AS s ON c.statefp = s.statefp
WHERE s.stusps IN('CA');
In the data output, you should see an eye icon on the header column:
Click the eye icon and a new geometry viewer tab will open up. If you want to see a subset of your rows, select rows first.
-
Provided that your SRID is 4326, you'll see an optional layers selector.
If you have an SRID other than 4326, the map displays with no background. Following, I transformed my data to SRID 2163.
SELECT s.stusps, c.name, ST_Transform(c.the_geom,2163)
FROM tiger.county AS c INNER JOIN tiger.state AS s ON c.statefp = s.statefp
WHERE s.stusps IN('CA');
If you click on a feature on the map, you can view the data in the non-geometry columns.