Bug report #5229

SQL Server type of geography: Latitude and Longitude are swapped.

Added by Sergey M almost 9 years ago. Updated almost 9 years ago.

Status:Closed
Priority:Normal
Assignee:Tamas Szekeres
Category:Data Provider
Affected QGIS version:master Regression?:No
Operating System:windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:14965

Description

When connecting to SQL Server (new native driver) to the table with the type of geography - longitude and latitude are swapped

SQL:

CREATE TABLE [dbo].[test](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Geo] [geography] NULL,
 CONSTRAINT [PK_test] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

INSERT INTO test
SELECT *
FROM
( 
SELECT geography::Parse('LINESTRING (37.5213796 47.1254473, 37.5234009 47.1251464, 37.5236238 47.1251132)') Geo
UNION ALL
SELECT geography::Parse('LINESTRING (37.5131171 47.1227004, 37.5119065 47.122804, 37.5114139 47.1229543, 37.5108024 47.1232576, 37.5101528 47.1235379, 37.5097069 47.1237922, 37.5088067 47.12424, 37.5074309 47.1249825, 37.5073969 47.1250345, 37.5073969 47.1251154, 37.5074691 47.1251963, 37.5102037 47.1279814, 37.5103055 47.1281257)')
) q
GO

INSERT INTO [geometry_columns]
([f_table_catalog]
,[f_table_schema]
,[f_table_name]
,[f_geometry_column]
,[coord_dimension]
,[srid]
,[geometry_type])
VALUES
('mydb'
,'dbo'
,'test'
,'Geo'
,2
,4326
,'LINESTRING')

QGIS version - 1.9.90-Alpha


Related issues

Duplicated by QGIS Application - Bug report #5302: SQL Server new provider doesn't work with geography table Closed 2012-04-04

Associated revisions

Revision be8f135a
Added by Tamas Szekeres almost 9 years ago

Fix for issues with sql server geography type (fixes #5229 fixes #5302)

History

#1 Updated by Nathan Woodrow almost 9 years ago

  • Assignee set to Tamas Szekeres

#2 Updated by Tamas Szekeres almost 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF