Re: How can I add a custom EPSG to the Map (Geometry) Viewer in PGAdmin4,

From: Avin Kavish <avinkavish(at)gmail(dot)com>
To: "Basques, Bob (CI-StPaul)" <bob(dot)basques(at)ci(dot)stpaul(dot)mn(dot)us>
Cc: "pgadmin-support(at)postgresql(dot)org" <pgadmin-support(at)postgresql(dot)org>, Dave Page <dpage(at)pgadmin(dot)org>
Subject: Re: How can I add a custom EPSG to the Map (Geometry) Viewer in PGAdmin4,
Date: 2019-08-01 10:45:02
Message-ID: CAFpscORS+K0_oDw1cG5irG6j6e-eQzPxOkEvm+WWwEat1eWBvg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hey bobb,

but we have a custom EPSG, where do I add this into PGAdmin4
>

EPSGs are stored in a table called spatial_ref_sys. All you need to do is
insert a record that contains the definition in well known text format and
proj4 format (for transformation). I'd recommend checking the table first
because there over 5000 EPSGs in it. epsg.io shoud give you an idea of what
the insert statement should look like. Example

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text,
srtext) values ( 4326, 'EPSG', 4326, '+proj=longlat +datum=WGS84
+no_defs ', 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]')

Also, it would be nice to add in our own background mapping layers as well,
> is there a method for adding in WMS/WFS to the layer list?

Till support for custom layers land, once you have added your custom EPSG
to the database you can transform the geometries to SRID 4326 and assuming
they are on Earth, they will show up on the map. The following functions
will be helpful

st_srid - Check the SRID of a shape
st_setsrid - Change an SRID without transforming coordinates
st_transform - Transforms a geometry from one EPSG to another

So when you are selecting data from a different EPSG, use: select
st_transform(geometry, 4326) from table_name and it will enable the world
map. AFAIK no other EPSG is supported for viewing on the map without
transformation. I discovered it by sheer accident.

On Wed, Jul 31, 2019 at 7:54 PM Basques, Bob (CI-StPaul) <
bob(dot)basques(at)ci(dot)stpaul(dot)mn(dot)us> wrote:

> All,
>
> Following the appreciation thread and saw the reference to the geometry
> viewer, I didn’t even know that was in there. Anyway, nice, but we have a
> custom EPSG, where do I add this into PGAdmin4?
>
> Also, it would be nice to add in our own background mapping layers as
> well, is there a method for adding in WMS/WFS to the layer list?
>
> Thanks
>
> bobb
>
>
>
>

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Richard Greenwood 2019-08-01 12:51:56 no results in 4.11 Ubuntu
Previous Message Dave Page 2019-08-01 10:14:31 Re: How can I add a custom EPSG to the Map (Geometry) Viewer in PGAdmin4,