4

pgAdmin4 now offers PostGIS geometry viewer

 2 years ago
source link: https://www.bostongis.com/blog/index.php?%2Farchives%2F272-pgAdmin4-now-offers-PostGIS-geometry-viewer_html=
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Saturday, September 08. 2018

pgAdmin4 now offers PostGIS geometry viewer

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:

  1. 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');
  2. In the data output, you should see an eye icon on the header column: pgAdmin_postgis_viewer_query1.png

  3. 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.

    pgAdmin_postgis_viewer_query2.png
  4. Provided that your SRID is 4326, you'll see an optional layers pgAdmin_postgis_viewer_layers_menu.png selector.

  5. 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');
    pgAdmin_postgis_viewer_query3.png

    If you click on a feature on the map, you can view the data in the non-geometry columns.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK