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

Shaozhong SHI shishaozhong at gmail.com
Fri Sep 20 12:28:41 PDT 2019


Thanks. I will have a close look.  Regards, shao

On Friday, 20 September 2019, James Klassen <klassen.js at gmail.com> wrote:

> 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/c5497ce6/attachment.html>


More information about the postgis-users mailing list