code: def _geom_type(self, source):
          
          if isinstance(source, AbstractLayer):
              query = source.orig_query
          else:
              query = 'SELECT * FROM "{table}"'.format(table=source)
          resp = self.sql_client.send(
              utils.minify_sql((
                  'SELECT',
                  '    CASE WHEN ST_GeometryType(the_geom)',
                  '               in (\'ST_Point\', \'ST_MultiPoint\')',
                  '         THEN \'point\'',
                  '         WHEN ST_GeometryType(the_geom)',
                  '              in (\'ST_LineString\', \'ST_MultiLineString\')',
                  '         THEN \'line\'',
                  '         WHEN ST_GeometryType(the_geom)',
                  '              in (\'ST_Polygon\', \'ST_MultiPolygon\')',
                  '         THEN \'polygon\'',
                  '         ELSE null END AS geom_type,',
                  '    count(*) as cnt',
                  'FROM ({query}) AS _wrap',
                  'WHERE the_geom IS NOT NULL',
                  'GROUP BY 1',
                  'ORDER BY 2 DESC',
              )).format(query=query),
              **DEFAULT_SQL_ARGS)
          if resp['total_rows'] > 1:
              warn('There are multiple geometry types in {query}: '
                   '{geoms}. Styling by `{common_geom}`, the most common'.format(
                       query=query,
                       geoms=','.join(g['geom_type'] for g in resp['rows']),
                       common_geom=resp['rows'][0]['geom_type']))
          elif resp['total_rows'] == 0:
              raise ValueError('No geometry for layer. Check all layer tables '
                               'and queries to ensure there are geometries.')
          return resp['rows'][0]['geom_type']
docs: gets geometry type(s) of specified layer