Wednesday, November 30, 2022
Code Search
Code Bank
.NET Applications
XSD Schema Generator
.NET/XML Training


Generate Dynamic Maps and Flight Routes with XML and SVG

This code sample demonstrates how over 30 meg of XML data containing world mapping points, airport locations, and flight routes can be dynamically parsed and used to generate Scalable Vector Graphic (SVG) images. Because the images are vector-based they can be zoomed in and out without affecting the image quality. The example also shows how Web Services can be integrated into SVG. Airports shown on the map can be selected to view temperature and wind data (when available).

The SVG image was initially generated by using XSLT but due to the size of the 3 XML documents involved, XSLT was abandoned in favor of using the XmlTextReader and XmlTextWriter. These two classes provide an extremely efficient reading/writing combination. The sample has also been updated to leverage compressed SVG (.svgz file format) to speed up downloading SVG data to the browser.

To try out the demo, click the Example link below. You will need the Adobe SVG Viewer to view the sample. Once the initial map loads for Phoenix, AZ you can zoom into or out of the image by right-clicking on it. Other airports can be selected from the drop-down box. Scaling can be changed by selecting from the "Scaling" drop-down box.

Special thanks to Ewan Godley who provided the data, did the heavy lifting with math calculations, made airplane drawings, plus more. Ewan and I met in one of my XML Web Services courses and needless to say, he picked up on the topics extremely fast.

Teaches XmlTextReader, XmlTextWriter, SVG
Requirements .NET 1.1
Download Code: Click Here


.NET, SharePoint and Silverlight Training Solutions
    Online, Onsite and Video Training on .NET and SharePoint technologies available through The Wahlin Group.

© 2007 Wahlin Consulting LLC
XML for ASP.NET Developers in bookstores