This is a migrated thread and some comments may be shown as answers.

Can I dynamic load the KML file from webservice source?

1 Answer 34 Views
Map
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 28 Nov 2011, 11:40 PM
I check the code of URL: http://www.telerik.com/help/silverlight/radmap-features-kml-data-import.html
Can I use webservice or other web source to imlpement the URI object as the data source?

Because the KML file is too big to download.

If the KmlReader can read the source, can you post the sample code?




private
void LoadKMLData() { StreamResourceInfo streamResource = Application.GetResourceStream( new Uri( "/Sample;component/Data/bulgaria.kml", UriKind.RelativeOrAbsolute ) ); List<FrameworkElement> elements = KmlReader.Read( streamResource.Stream ); foreach ( FrameworkElement element in elements ) { this.informationLayer.Items.Add( element ); } }

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 29 Nov 2011, 07:45 PM
I found the solution:
 
The KmlReader.Read( String KMLFile)

            String STR = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + " <Document>"
                + "   <Style id=\"defaultStyle\">"
                + "     <LineStyle>" + "       <color>ffffffff</color>"
                + "       <width>2</width>"
                + "     </LineStyle>"
                + "     <PolyStyle>"
                + "       <color>99ff6600</color>"
                + "       <outline>1</outline>"
                + "       <fill>1</fill>"
            + "     </PolyStyle>"
            + "   </Style>" + "   <Placemark>"
            + "     <styleUrl>#defaultStyle</styleUrl>"
            + "     <name>SD</name>"
            + "     <MultiGeometry>"
            + "       <Polygon>"
            + "         <outerBoundaryIs>"
            + "           <LinearRing>"
            + "             <coordinates>-104.055274963379,45.9456737602595 -96.55991926471,45.9338366274704 -96.5962114797054,45.8178073969135 -96.6602139519255,45.7363599585271 -96.7907210414848,45.6741591112611 -96.843639410815,45.6467689369645 -96.8522213685857,45.6077354623423 -96.7556047173945,45.5023240047083 -96.6870617366376,45.4085414704814 -96.6016745536201,45.4092843080694 -96.4882137001685,45.3429784356569 -96.4645885921062,45.3081940454951 -96.4521929522176,43.5027920882586 -96.5801656644998,43.4994868919256 -96.6014584291322,43.4432087575776 -96.5216859802016,43.3909584907608 -96.5373640107471,43.3018991566551 -96.57550097764,43.2822354026014 -96.5518758695777,43.238027755039 -96.4721034206471,43.2101593410859 -96.4428635784979,43.1290309914735 -96.475385811304,43.0642053399723 -96.5022933100232,43.032153505201 -96.4955124042214,42.9713337429691 -96.5617230415485,42.8446212808261 -96.6279336788756,42.7423945077692 -96.615538038987,42.6936700884695 -96.5413803241432,42.6614252562979 -96.4840668115599,42.55476030123 -96.4716711716713,42.4851891937664 -96.5041934044773,42.4901099017253 -96.5591745736307,42.5198649606394 -96.6141557427841,42.5040896388606 -96.6242190392428,42.5462489370011 -96.7185033470041,42.6131774082495 -96.6948782389418,42.6635211325205 -96.7947772807898,42.6766841358986 -96.8272995135959,42.7104760482505 -96.9159690872703,42.7360022084285 -96.9709502564237,42.7202815588552 -96.9810135528824,42.7581723651385 -97.131445201512,42.775436778335 -97.2032705729259,42.8091749227663 -97.3087843488608,42.8552439630157 -97.4648307315772,42.8477871500515 -97.5198119007306,42.8814858382553 -97.5860225380576,42.8411052922238 -97.641003707211,42.8583465769922 -97.6791406741039,42.8344227116937 -97.7285071091705,42.8557819806538 -97.7722588101502,42.8359745611229 -97.849698915651,42.865564502205 -97.8990653507175,42.8292914257203 -97.9540465198709,42.7723927998729 -98.053945561719,42.7649259911536 -98.0808530604382,42.7904297412876 -98.1695226341126,42.8447467302428 -98.3592574213501,42.8990160033015 -98.4479269950245,42.9326867214132 -98.5197523664384,42.9991991037097 -104.056585582371,43.0122908013072 -104.055419410656,45.0063216669722 -104.03740903668,45.9401693797229</coordinates>"
            + "           </LinearRing>"
            + "         </outerBoundaryIs>"
            + "       </Polygon>"
            + "       <Point>"
            + "         <coordinates>-101.246852874756,45.2127380371094</coordinates>"
            + "       </Point>"
            + "     </MultiGeometry>"
            + "   </Placemark>"
            + " </Document>";
            List<FrameworkElement> elements = KmlReader.Read(STR);
Tags
Map
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Share this question
or