Skip to content

Instantly share code, notes, and snippets.

@dalmat36
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save dalmat36/11228231 to your computer and use it in GitHub Desktop.

Select an option

Save dalmat36/11228231 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<name>KML Name</name>
<description>KML Description</description>
<Style id="style1">
<LineStyle>
<color>990000ff</color>
<width>4</width>
</LineStyle>
<PolyStyle>
<color>330000ff</color>
</PolyStyle>
</Style>
<Placemark>
<name>Polygon 1</name>
<description></description>
<styleUrl>#style1</styleUrl>
<Polygon>
<altitudeMode>relative</altitudeMode>
<LinearRing>
<coordinates>
-93.5596,44.9959
-95.7568,44.4024
-98.5693,43.1651
-101.6895,40.2795
-101.2939,38.4794
-100.9424,37.7533
-98.8330,35.5322
-96.0205,34.0162
-91.8896,32.6209
-86.6602,33.5048
-82.7930,35.1738
-80.5518,37.9615
-78.8379,40.7140
-78.0908,43.1651
-77.7393,44.9648
-79.1895,46.1950
-80.5957,45.6140
-81.8262,43.4848
-83.1006,41.5086
-85.1221,40.9135
-87.1436,41.0131
-89.2969,41.7385
-89.6045,44.0876
-88.6816,45.6448
-90.0879,46.0732
-91.4063,45.6448
-92.8125,45.2440
-93.5596,44.9959
</coordinates>
</LinearRing>
</Polygon>
</Placemark>
</Document>
</kml>
--@poly is the variable passed from java application over JDBC
declare @poly varchar(max) = 'POLYGON((
-93.5596 44.9959,
-95.7568 44.4024,
-98.5693 43.1651,
-101.6895 40.2795,
-101.2939 38.4794,
-100.9424 37.7533,
-98.8330 35.5322,
-96.0205 34.0162,
-91.8896 32.6209,
-86.6602 33.5048,
-82.7930 35.1738,
-80.5518 37.9615,
-78.8379 40.7140,
-78.0908 43.1651,
-77.7393 44.9648,
-79.1895 46.1950,
-80.5957 45.6140,
-81.8262 43.4848,
-83.1006 41.5086,
-85.1221 40.9135,
-87.1436 41.0131,
-89.2969 41.7385,
-89.6045 44.0876,
-88.6816 45.6448,
-90.0879 46.0732,
-91.4063 45.6448,
-92.8125 45.2440,
-93.5596 44.9959))';
--@poly_geo is the c
declare @poly_geo geometry;
SET @poly_geo = geometry::STGeomFromText(@poly,0);
select @poly_geo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment