After searching through the great forums here and looking for an answer (and trying many different things), I am still stuck...sorry for the remedial question, but Silverlight and Telerik are both new to me!
I have 3 KML files that all contain multiple polygons that have styling performed on them, such as (stripped down version):
I have a radMap control on my page along with 3 checkboxes that the user can select to load one of the three KML files, which reside in a subfolder called includes.
I am using the OpenStreetMap provider...
Here is the checked event for one of the checkboxes:
For the life of me, I cannot get the polygons to display on the map when checking the checkbox! I am sure I am overlooking something very simple.
The namespace of this page is MapTest. I assume I am referencing the KML correctly...but am unsure.
Also, I set the build action of the KML files to Resource.
Any help will be greatly appreciated! For the first time in a long time, development has become interesting and fun again!
Thanks!
I have 3 KML files that all contain multiple polygons that have styling performed on them, such as (stripped down version):
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Document>
<name>Mapinfo Import</name>
<Style id="polystyle">
<LineStyle>
<color>ff7faaff</color>
</LineStyle>
<PolyStyle>
<fill>1</fill>
<color>7fff0000</color>
</PolyStyle>
</Style>
<Style id="textstyle">
<IconStyle>
<Icon></Icon>
</IconStyle>
<LabelStyle>
<color>ff0000ff</color>
</LabelStyle>
</Style>
<Placemark>
<styleUrl>#polystyle</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-91.293185,38.224134,0
-91.250424,38.22222,0
-91.250425,38.242415,0
-91.237268,38.242224,0
-91.237024,38.270077,0
-91.217533,38.269311,0
-91.200111,38.270268,0
-91.200111,38.277543,0
-91.154549,38.278021,0
-91.154306,38.274576,0
-91.145048,38.274576,0
-91.144926,38.270938,0
-91.135424,38.271226,0
-91.135058,38.256486,0
-91.12519,38.256964,0
-91.086816,38.256677,0
-91.086694,38.246148,0
-91.088643,38.244234,0
-91.092298,38.239927,0
-91.092907,38.238683,0
-91.091933,38.23763,0
-91.090105,38.237726,0
-91.088034,38.239066,0
-91.086085,38.239448,0
-91.083892,38.240118,0
-91.083282,38.24031,0
-91.079384,38.238491,0
-91.077679,38.2383,0
-91.075973,38.239257,0
-91.074633,38.24031,0
-91.073171,38.241267,0
-91.072197,38.242511,0
-91.071222,38.243755,0
-91.069517,38.24433,0
-91.06708,38.243851,0
-91.065131,38.24299,0
-91.06306,38.242128,0
-91.061842,38.240693,0
-91.061355,38.239831,0
-91.061355,38.239161,0
-91.062086,38.238395,0
-91.027731,38.238108,0
-91.027853,38.224134,0
-91.007874,38.223751,0
-91.009336,38.180201,0
-90.992768,38.179914,0
-90.978271,38.180202,0
-90.978637,38.179244,0
-90.979246,38.178956,0
-90.979124,38.177999,0
-90.978515,38.176851,0
-90.979246,38.175224,0
-90.980708,38.174171,0
-90.981439,38.173979,0
-90.982657,38.172831,0
-90.984119,38.172639,0
-90.984971,38.172257,0
-90.985946,38.171491,0
-90.988139,38.1713,0
-90.98887,38.170821,0
-90.989844,38.170055,0
-90.990697,38.169002,0
-90.989844,38.168045,0
-90.989966,38.167088,0
-90.988748,38.166227,0
-90.988626,38.165557,0
-90.98887,38.1646,0
-90.988139,38.162398,0
-90.987652,38.160293,0
-90.987895,38.159431,0
-90.989113,38.158953,0
-90.989844,38.158666,0
-90.990575,38.1579,0
-90.990941,38.157038,0
-90.991428,38.156751,0
-90.991915,38.15589,0
-90.992768,38.15522,0
-90.993134,38.154741,0
-90.992646,38.153306,0
-90.992525,38.1512,0
-90.992525,38.14986,0
-90.993134,38.147946,0
-90.993743,38.147371,0
-90.994108,38.146606,0
-90.993499,38.144883,0
-90.99289,38.144213,0
-90.991428,38.144213,0
-90.991062,38.143639,0
-90.988991,38.14249,0
-90.988016,38.142107,0
-90.987651,38.141437,0
-90.98692,38.140576,0
-90.986189,38.139523,0
-90.983996,38.138087,0
-90.982535,38.137609,0
-90.981804,38.136747,0
-90.978393,38.134163,0
-90.978515,38.13378,0
-90.978636,38.133493,0
-90.97754,38.132823,0
-90.976322,38.133014,0
-90.973885,38.131962,0
-90.973276,38.131483,0
-90.971936,38.1311,0
-90.971327,38.130047,0
-90.969744,38.129282,0
-90.968282,38.128899,0
-90.967794,38.128037,0
-90.966576,38.12708,0
-90.96548,38.126314,0
-90.964992,38.123922,0
-90.965966,38.122773,0
-90.966941,38.121242,0
-90.96755,38.119232,0
-90.968403,38.118083,0
-90.966941,38.117509,0
-90.967063,38.117126,0
-90.967428,38.116838,0
-90.967915,38.116359,0
-90.968281,38.116264,0
-90.967794,38.115881,0
-90.968037,38.114732,0
-90.967794,38.112435,0
-90.968037,38.110234,0
-90.967672,38.109277,0
-90.966941,38.108798,0
-90.966941,38.108224,0
-90.966697,38.107841,0
-90.96755,38.106884,0
-90.968281,38.10631,0
-90.968646,38.105544,0
-90.969865,38.10497,0
-90.972301,38.105065,0
-90.973154,38.105065,0
-90.974007,38.104491,0
-90.975225,38.104108,0
-90.976078,38.103438,0
-90.977052,38.102673,0
-90.993743,38.099993,0
-91.066715,38.091665,0
-91.086938,38.091474,0
-91.087059,38.102672,0
-91.095465,38.102768,0
-91.095344,38.113393,0
-91.096318,38.113776,0
-91.097415,38.114159,0
-91.098389,38.114159,0
-91.099242,38.11502,0
-91.100582,38.115307,0
-91.100947,38.11569,0
-91.102166,38.11636,0
-91.103018,38.11636,0
-91.104237,38.115882,0
-91.105089,38.115307,0
-91.106186,38.115212,0
-91.108013,38.115212,0
-91.109475,38.116073,0
-91.110449,38.116552,0
-91.112277,38.116456,0
-91.112764,38.11636,0
-91.113495,38.11636,0
-91.1152,38.116456,0
-91.115931,38.116647,0
-91.11715,38.11703,0
-91.117637,38.116647,0
-91.119099,38.116839,0
-91.120317,38.11703,0
-91.120804,38.11703,0
-91.123484,38.117222,0
-91.12385,38.116743,0
-91.125312,38.116552,0
-91.12653,38.115881,0
-91.12787,38.116647,0
-91.129453,38.116742,0
-91.129942,38.117892,0
-91.129698,38.119423,0
-91.128845,38.12105,0
-91.12848,38.121529,0
-91.126896,38.12239,0
-91.126531,38.122869,0
-91.126653,38.123347,0
-91.127262,38.124017,0
-91.127993,38.124592,0
-91.12848,38.124496,0
-91.12982,38.124209,0
-91.131891,38.124496,0
-91.132865,38.125357,0
-91.133109,38.125932,0
-91.134936,38.126027,0
-91.136033,38.126027,0
-91.136885,38.126793,0
-91.138104,38.12775,0
-91.138834,38.128612,0
-91.138956,38.12909,0
-91.14054,38.129282,0
-91.14054,38.131004,0
-91.140174,38.131962,0
-91.140418,38.132344,0
-91.139443,38.133589,0
-91.138347,38.135599,0
-91.137372,38.13713,0
-91.136642,38.13847,0
-91.137129,38.139044,0
-91.137129,38.140863,0
-91.138469,38.141054,0
-91.140174,38.141054,0
-91.142732,38.141437,0
-91.143829,38.142011,0
-91.144925,38.142011,0
-91.147483,38.142011,0
-91.149311,38.142586,0
-91.151139,38.143351,0
-91.152235,38.143447,0
-91.152966,38.143734,0
-91.153454,38.1445,0
-91.155159,38.145361,0
-91.156134,38.145936,0
-91.157596,38.146031,0
-91.158205,38.148903,0
-91.16125,38.14919,0
-91.161737,38.156655,0
-91.175868,38.157038,0
-91.176113,38.163738,0
-91.182691,38.164217,0
-91.1833,38.178574,0
-91.190487,38.178957,0
-91.190487,38.182881,0
-91.194873,38.182785,0
-91.196457,38.182211,0
-91.197675,38.181828,0
-91.199015,38.181828,0
-91.200599,38.181732,0
-91.20206,38.181541,0
-91.202792,38.18135,0
-91.211198,38.175607,0
-91.211563,38.181158,0
-91.21802,38.180871,0
-91.217776,38.192931,0
-91.224476,38.192548,0
-91.238487,38.192165,0
-91.241532,38.192357,0
-91.241288,38.195707,0
-91.242385,38.195611,0
-91.243968,38.19609,0
-91.24543,38.196281,0
-91.246405,38.196951,0
-91.246648,38.197908,0
-91.245796,38.198769,0
-91.246161,38.200014,0
-91.246161,38.201067,0
-91.246405,38.201928,0
-91.247501,38.202502,0
-91.247745,38.203651,0
-91.248719,38.203842,0
-91.248963,38.204225,0
-91.249085,38.204704,0
-91.248354,38.205374,0
-91.248354,38.205661,0
-91.249572,38.206235,0
-91.249206,38.207001,0
-91.249206,38.207096,0
-91.277957,38.209011,0
-91.283561,38.209203,0
-91.283805,38.207193,0
-91.293185,38.207384,0
-91.293429,38.224038,0
-91.293185,38.224134,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</Document>
I have a radMap control on my page along with 3 checkboxes that the user can select to load one of the three KML files, which reside in a subfolder called includes.
I am using the OpenStreetMap provider...
Here is the checked event for one of the checkboxes:
private void chkPhone_Checked(object sender, RoutedEventArgs e)
{
OpenStreetMapProvider provider = new OpenStreetMapProvider(MapMode.Aerial, true);
//BingMapProvider provider = new BingMapProvider(MapMode.Aerial, true, applicationId);
//ArcGISServerMapProvider provider = new ArcGISServerMapProvider(MapMode.Aerial, true);
RadMap1.Provider = provider;
RadMap1.Center = new Location(38.207034, -91.160209);
// loading the kml file
StreamResourceInfo streamInfo = Application.GetResourceStream(
new Uri("MapTest;component/includes/ILEC_PHONE.kml", UriKind.RelativeOrAbsolute));
List<FrameworkElement> list = KmlReader.Read(streamInfo.Stream);
//informationLayer.ItemsSource = list;
foreach (FrameworkElement element in list)
{
MapPolygon shape = element as MapPolygon;
if (shape != null)
{
shape.Fill = new SolidColorBrush(Color.FromArgb(99, 99, 0, 99));
}
}
foreach (FrameworkElement shape in list)
{
this.informationLayer.Items.Add(shape);
}
}
For the life of me, I cannot get the polygons to display on the map when checking the checkbox! I am sure I am overlooking something very simple.
The namespace of this page is MapTest. I assume I am referencing the KML correctly...but am unsure.
Also, I set the build action of the KML files to Resource.
Any help will be greatly appreciated! For the first time in a long time, development has become interesting and fun again!
Thanks!