[gdal-dev] OGR MS SQL Spatial driver has been added

Tamas Szekeres szekerest at gmail.com
Mon Sep 20 18:05:53 EDT 2010


David,

The driver assumes that the first field is the fid and the second is the
geometry column in the table. This doesn't appear to be a problem until the
table has been created by the same driver.
However in your case the field ordering doesn't follow this pattern. For a
workaround you may modify your table as follows:

select [PKey], [Feature], [SpatialDataKey], [StartX], [StartY] into
MetesAndBoundsHeader2 from MetesAndBoundsHeader
ALTER TABLE dbo.MetesAndBoundsHeader2 ADD CONSTRAINT
PK_MetesAndBoundsHeader2 PRIMARY KEY CLUSTERED (PKey)

and then do the same test with MetesAndBoundsHeader2. (Hopefully this will
solve the mapserver issue as well)


I consider this to be a bug in the driver and I'll correct this issue
tomorrow so as to allow the columns defined in arbitrary field order.

Best regards,

Tamas





2010/9/20 David Lowther <dlowther at coordinatesolutions.com>

>  CREATE TABLE [dbo].[MetesAndBoundsHeader](
>
>       [PKey] [int] IDENTITY(1,1) NOT NULL,
>
>       [SpatialDataKey] [int] NULL,
>
>       [StartX] [decimal](18, 4) NULL,
>
>       [StartY] [decimal](18, 4) NULL,
>
>       [Feature] [geometry] NULL,
>
>  CONSTRAINT [PK_MetesAndBoundsDescription] PRIMARY KEY CLUSTERED
>
> (
>
>       [PKey] 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
>
> SET IDENTITY_INSERT [dbo].[MetesAndBoundsHeader] ON
>
> INSERT [dbo].[MetesAndBoundsHeader] ([PKey], [SpatialDataKey], [StartX],[StartY]
> , [Feature]) VALUES (8, 7, CAST(463644.9082 AS Decimal(18, 4)), CAST(1484517.3764
> AS Decimal(18, 4)),0xE60E00000104050000009A999999734C1C4100000000E5A636419A999999734C1C4100000000F5CD36419A99999939B01B4100000000A4CE36419A99999939B01B410000000094A736419A999999734C1C4100000000E5A6364101000000020000000001000000FFFFFFFF0000000003
> )
>
> INSERT [dbo].[MetesAndBoundsHeader] ([PKey], [SpatialDataKey], [StartX],[StartY]
> , [Feature]) VALUES (9, 8, CAST(416571.3699 AS Decimal(18, 4)), CAST(1465354.3699
> AS Decimal(18, 4)),0xE60E00000104050000009A999999ED6C1941000000000A5C36419A999999ED6C1941000000001A8336419A999999B3D0184100000000C98336419A999999B3D0184100000000B95C36419A999999ED6C1941000000000A5C364101000000020000000001000000FFFFFFFF0000000003
> )
>
> SET IDENTITY_INSERT [dbo].[MetesAndBoundsHeader] OFF
>
>
>
>
>
> David Lowther
>
>
>
> Coordinate Solutions, Inc.
>
>
>   ------------------------------
>
> *From:* Tamas Szekeres [mailto:szekerest at gmail.com]
> *Sent:* Monday, September 20, 2010 4:56 PM
> *To:* David Lowther
> *Cc:* gdal-dev
> *Subject:* Re: [gdal-dev] OGR MS SQL Spatial driver has been added
>
>
>
>
>
> 2010/9/20 David Lowther <dlowther at coordinatesolutions.com>
>
>
>
> It seems almost as if there is an index off in the field information.
>
>
>
>
> David,
>
> That's strange indeed. What is the database type of this field in the
> table? Could you provide your test data to reproduce this?
>
>
>
>  I am also not seeing any features when I render the layer in Mapserver
> (though that could be any number of things as I am just getting started with
> OGR MSSQL in Mapserver).
>
>
>
>
> It would be helpful to see your mapfile to make sure about the problem.
>
>
> Best regards,
>
> Tamas
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100921/49d86556/attachment.html


More information about the gdal-dev mailing list