Opened 11 years ago

#868 new enhancement

Avoid querying NULL values when determine CRS

Reported by: gBecker Owned by: danstoica
Priority: minor Milestone: 3.8.0
Component: SQLServer Spatial Version: 3.8.0
Severity: 3 Keywords:
Cc: External ID:

Description

When determine CRS for a table in SQL Server the provider selects the first row and get the SRID of the geometry.

SELECT TOP 1 [geom].STSrid as srid from [tablename]

If there is no geometry (=NULL) in the first row then the query return NULL and SRID is treated as 0. So when inserting new geometries they have the wrong CRS.

In tables where we already have existing geometries it would be nice when we can enhance the query to avoid selecting NULLs:

SELECT TOP 1 [geom].STSrid as srid from [tablename] WHERE [geom] IS NOT NULL

I suppose there are other places where this has to be changed. For example when querying all the spatial indexes to get a list of CRS used in a FeatureSource (Autodesk Infrastructure Studio / Maestro)

Change History (0)

Note: See TracTickets for help on using tickets.