[postgis-users] Are there psql command for detecting geometry types stored in PostGIS?

Paul Ramsey pramsey at cleverelephant.ca
Fri Sep 20 08:32:43 PDT 2019


Also better that geometry_typmod_out, some utility functions:

postgis_typmod_dims(integer)
    RETURNS integer

postgis_typmod_srid(integer)
    RETURNS integer

postgis_typmod_type(integer)
    RETURNS text


> On Sep 20, 2019, at 8:30 AM, Paul Ramsey <pramsey at cleverelephant.ca> wrote:
> 
> Here’s a starting point:
> 
> select 
>  c.relname, 
>  t.typname, 
>  case when t.typname = 'geometry' then geometry_typmod_out(atttypmod) else '' end, 
>  a.attnum, a.attname, a.atttypid, a.atttypmod 
> from pg_class c join pg_attribute a on c.oid = a.attrelid join pg_type t on a.atttypid = t.oid 
> where c.relname = 'countries' and a.attnum > 0;
> 
> 
> 
>> On Sep 20, 2019, at 8:22 AM, Shaozhong SHI <shishaozhong at gmail.com> wrote:
>> 
>> Hi, All,
>> 
>> Are there psql command for detecting geometry types stored in PostGIS?
>> 
>> For instance, data is stored in the geometry column, can we use any commands to detect what types of geometry it is (e.g., collection of points, or point only and etc.)?
>> 
>> Regards,
>> 
>> Shao
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
> 



More information about the postgis-users mailing list