[Qgis-developer] State of Spatialite 4.0 and GDAL 1.10 for QGIS 2.0?

a.furieri at lqt.it a.furieri at lqt.it
Wed May 22 05:12:20 PDT 2013


Hi Giuseppe,

thanks for your further clarifications (really useful to completely
focus the question).


> no insert nor update statements are performed to understand what's 
> the
>
> layer's geometry type, and the db v4.0 wasn't created by DB Manager
>

All right, now I finally understand that the question was about 
querying
the spatial  metadata tables in order to detect geometry-type, srid,
dimensions and so on.
(sorry, I previously understood that the problem was creating a further
geometry column, thus defaulting to use AddGeometryColumn() or not)


I'm not really completely sure about this, but I suppose that the
optimal way should probably be the one to ask the data-provider
itself to return such infos. If I remember well the data
provider is always fully aware of metadata related to each single
layer, and the access methods are always fully independent from
any possible versioning idiosyncrasy.

If for some good reason such an approach isn't suitable for python
plug-ins then the alternative approach is obviously the one to
directly query the metadata tables.
and (sadly) in this case v.3 and v.4 behave rather differently:

v.3 (and earlier versions) layout:
------------------------------------
SELECT srid, type, coord_dimension
FROM geometry_columns
WHERE Lower(f_table_name) = Lower('points')
   AND Lower(f_geometry_column) = Lower('geom');
======
4326  POINT    XY


SELECT srid, type, coord_dimension
FROM geometry_columns
WHERE Lower(f_table_name) = Lower('lines')
   AND Lower(f_geometry_column) = Lower('geom');
======
4326  LINESTRING    XYZM


SELECT srid, type, coord_dimension
FROM geometry_columns
WHERE Lower(f_table_name) = Lower('polygs')
   AND Lower(f_geometry_column) = Lower('geom');
======
4326  MULTIPOLYGON    XYZ



v.4 (and subsequent versions) layout:
-------------------------------------
SELECT srid, geometry_type
FROM geometry_columns
WHERE Lower(f_table_name) = Lower('points')
   AND Lower(f_geometry_column) = Lower('geom');
======
4326  1


SELECT srid, geometry_type
FROM geometry_columns
WHERE Lower(f_table_name) = Lower('lines')
   AND Lower(f_geometry_column) = Lower('geom');
======
4326  3002


SELECT srid, geometry_type
FROM geometry_columns
WHERE Lower(f_table_name) = Lower('polygs')
   AND Lower(f_geometry_column) = Lower('geom');
======
4326  1006


in other worlds:
- in v.3 you have to query both "type" and "cood_dimensions"
   columns, because the geometry-type and the dimensions are
   defined separately
- in v.4 just querying "geometry_type" alone will be enough,
   because now each geometry is fully qualified by its numeric
   type (as strictly required by standard OGC and SQL/MM specs).
   a "coord_dimension" column still exists (merely for standard
   conformance, but is completely redundant and meaningless).

1 = 2D, POINT
2 = 2D, LINESTRING
3 = 2D, POLYGON
4 = 2D, MULTIPOINT
5 = 2D, MULTILINESTRIN
6 = 2D, MULTIPOLYGON
7 = 2D, GEOMETRYCOLLECTION

1001 = 3D, POINT
1002 = 3D, LINESTRING
1003 = 3D, POLYGON
1004 = 3D, MULTIPOINT
1005 = 3D, MULTILINESTRIN
1006 = 3D, MULTIPOLYGON
1007 = 3D, GEOMETRYCOLLECTION

2001 = 2D+M, POINT
2002 = 2D+M, LINESTRING
2003 = 2D+M, POLYGON
2004 = 2D+M, MULTIPOINT
2005 = 2D+M, MULTILINESTRIN
2006 = 2D+M, MULTIPOLYGON
2007 = 2D+M, GEOMETRYCOLLECTION

3001 = 3D+M, POINT
3002 = 3D+M, LINESTRING
3003 = 3D+M, POLYGON
3004 = 3D+M, MULTIPOINT
3005 = 3D+M, MULTILINESTRIN
3006 = 3D+M, MULTIPOLYGON
3007 = 3D+M, GEOMETRYCOLLECTION

bye Sandro




-- 
Il messaggio e' stato analizzato alla ricerca di virus o
contenuti pericolosi da MailScanner, ed e'
risultato non infetto.



More information about the Qgis-developer mailing list