In this example, It has been demonstrated on how you can integrate the Keyhole Markup Language KML document in Asp.net using C Sharp. The Google maps return this document in result of Http request sent by the user which contains the data for direction and distance. You will see the implementation and translation when you walk in to the code. Use Linq allows XML data to be queried by using the standard query operators as well as tree-specific operators that provide XPath-like navigation through descendants, ancestors, and siblings. It simplifies working with XML data without having to resort to using additional language syntax like XPath or XQuery. You can use LINQ to XML to perform LINQ queries over XML that you retrieve from the file system, from a remote web service, or from in-memory XML content.
Using the code
The first thing we will do is add the namespaces we will be using. Our code-behind will look something like this:
Line 1: XNamespace obj_XNameSpace = XNamespace.Get("http://earth.google.com/kml/2.0");
Line 2: string Des_Source_URL = "http://maps.google.com/?q=From " + txtDestination.Text + " to " + txtSource.Text + "&output=kml&view=text";
Before going into detail there are some points to keep in mind.
1: XNamespace ("http://earth.google.com/kml/2.0") this will works as a namespace for which we will use to parse the KML for the specified Uniform Resource Identifier
2: Browser Qurey www.maps.google.com/?q=from "from_address" to "to_address" "&output=kml&view=text"; (where "from" and "to" are the keywords).
3: The "output" parameter retrieves the result in the given format which will be KML in this case.
READ MORE >>