I have a set of polygons out of which I want to make a KML file, my table schema is as follows :
CREATE TABLE [dbo].[utilitygeo]( [ID] [int] NOT NULL, [PolygonID] [varchar](8000) NULL, [geog] [geography] NULL )
I tried extracting
Lat/Long from each polygon and then thought of converting them into a KML file, following is the code:
declare @g geography; select top 1 @g = geog from MyDB..Geoterritory declare @i int = 1 create table ##result( Latitude float, Longitude float ) while @i < @g.STNumPoints() BEGIN insert into ##result values( @g.STPointN(@i).Lat, @g.STPointN(@i).Long ) END select * from ##result
But this takes a lot of time.
Is there a better way to generate KML file from these polygons in