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

James Klassen klassen.js at gmail.com
Fri Sep 20 08:48:33 PDT 2019


Alternatively, if are asking about the type of a  particular geometry value
versus the column type in a table definition:

https://postgis.net/docs/ST_GeometryType.html

or

https://postgis.net/docs/ST_IsCollection.html



On Fri, Sep 20, 2019, 10:32 Paul Ramsey <pramsey at cleverelephant.ca> wrote:

> 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
> >
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190920/33402680/attachment.html>


More information about the postgis-users mailing list