Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Architecture
ASP.NET
ASP.NET MVC
ASP.NET WebForms
B2B (Business Integration)
BizTalk
Book Excerpts
Build and Deploy
C#
C++
Code Contracts
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Design Patterns
Development Process
Display Technologies
Distributed Computing
DotNetNuke
DSL
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Graphics
Internet Explorer 8.0
Interviews
iPhone
Java
Java Script
jQuery
LINQ
Linux
Mac OS X
MDX
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
Network
NHibernate
Object Oriented Development
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
Podcasts
Post Mortem
PowerPoint
Print/Output
Product News
Product Reviews
Project Management
Python
Q&A
Reporting Services
REST
RIA Services
Ruby
Search
Security
Services
SharePoint
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server CE/AnyWhere/Mobile/Compact
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
Tips
UI Design
UML
User Groups
VB Script
VB.NET
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WF
Whitepapers
Windows 7
Windows Azure
Windows Live
Windows Server
Windows Vista
WinForms
Workflow
WPF
XAML
XML
XNA
XSLT



PyCon 2010


 


VFPConversion.com

Reader rating:
Click here to read 1 comment about this article.
Article source: CoDe (2008 - Vol. 5 - Issue 2 - Windows Live )


Article Pages: < Previous - 1 2  3 


Virtual Earth-What's New in the Latest Release (Cont.)

New Tile Set-Hill Shaded

The core imagery of Virtual Earth is broken into tile sets, these 256 x 256 px images are loaded on demand in both the 2D AJAX control and the 3D control. “Hill Shaded” is a new tile set that combines the lightweight, easy-to-read road tiles with a 3D shading effect based on the elevation data, see Figure 6. The result provides an alternative to the existing “Hybrid” tile set which provides the road information over the satellite and aerial photography available in the “Aerial” tile set. To switch to the new shaded tiles, use the new enumeration value in the map load or call:

Click for a larger version of this image.

Figure 6: The new Hill Shaded tiles in Virtual Earth.

map.SetMapStyle(VEMapStyle.Shaded);

With this addition you now have four tile sets, as well as the unique bird’s eye images and textured 3D models making up the imagery of Virtual Earth.

Prefer to Zoom to the Mouse Pointer?

A new option for navigating Virtual Earth is to change from the default, where the mouse scroll wheel zooms on the center of the screen, to a mode where Virtual Earth will zoom on the mouse location itself. It can be a little counter-intuitive at first as this functionality was previously reserved for a “double click” on the map. It does however, with a little practice, allow for a click-less zoom to any point on the planet. It is enabled with one line of code:

map.SetMouseWheelZoomToCenter(false); 

Shapes Get Faster and Some New Methods Also

Shapes are interactive elements you can add to your map. These include:

  • Pushpins: representing a single point.
  • Poly lines: representing a path of many points.
  • Polygons: representing a closed area of points.

Zindex

You can now change the “Zindex” of shapes. As shapes can easily overlap, it is important to be able to control which shape appears on top or behind. This is the same concept as in applications like Microsoft PowerPoint, where you may send objects backwards or forward in their Z index. Microsoft has added three new methods to retrieve and set Zindex for the icon (pushpin) and the line or polygon separately, collectively called the “polyshape”.

VEShape.GetZIndex();
VEShape.GetZIndexPolyShape();
VEShape.SetZIndex(icon, polyshape);

Altitude

Within 3D mode, you can now position shapes at a specific altitude. The VELatLong class now has two extra properties:

VELatLong.Altitude
VELatLong.AltitudeMode

The Altitude is a floating point number while the Altitude Mode is an enumeration supporting the following options:

  • Absolute: the altitude is meters above the WGS 84 ellipsoid.
  • RelativeToGround: the altitude is meters above ground level (default).

This opens up a world of possible visualizations within 3D mode for anything above the ground. You may have already seen some great applications tracking aircraft online.

"
Clearly it is uncommon to actually know these coordinates unless the data is coming from a GPS device.
"

Polygons and Poly lines also get a new method to draw a line to the ground from the shape at altitude. This also opens up some interesting visualization options:

VEShape.SetLineToGround(extrude);

Conditional Zoom Level Range

It is a common issue with Virtual Earth that as you zoom out, shapes overlap. You have already seen how you can adjust the Zindex, but it is also now possible to hide shapes. Two new methods allow for the specification of a maximum and minimum zoom level to show the shape:

VEShape.SetMaxZoomLevel(level);
VEShape.SetMinZoomLevel(level);

This allows you simply to hide some or all of the shapes or provide additional shapes at other zoom levels to represent the density.

Reduction of Polygon / Poly Line Accuracy

Enabled by default, Virtual Earth will now remove points within a polygon or poly line that are very close visually given the current zoom level. The concept is to reduce the complexity of these objects to improve performance, for example when a 1000 point polygon over New York is viewed at the country level it only needs a few points or, in fact, is too small to render at all.

You can disable this new performance feature with the following code:

map.EnableShapeDisplayThreshold(false);

Performance of Bulk Add

The Virtual Earth team has made a significant performance improvement for the addition of many pushpin shapes to the map. The simple change allows an array of shapes to be added in the existing function:

VEShapeLayer.AddShape(Array);

The performance increase is very measureable; Table 2 shows performance improvements of using the bulk method over a loop of single AddShape() calls.

It is a simple change to most existing applications to benefit from this. Rather than adding directly to the map, add your shapes to an array, and then add this array of shapes to the map in one call.

Map Cruncher Is Now Part of the Virtual Earth Platform

The core of Virtual Earth is accurate image tiles representing the Earth in several different formats. The system allows the user to “stream” just the images they require as they pan and zoom around the planet. This provides the fluid experience and fast load times for such a massive set of data. A powerful feature is the ability to add your own tile layers on top of the map. This allows for the same highly scalable performance for your data overlay or additional imagery for your application.

"
Rather than add directly to the map, add your shapes to an array, and then add this array of shapes to the map in one call.
"

Map Cruncher is a tool that imports raster-based and vector-based images, provides an interface to align the images directly with Virtual Earth, and outputs the tiles in the correct format and naming convention for use with the control. Figure 7 shows Map Cruncher in action. You can also run Map Cruncher from the command line.

Click for a larger version of this image.

Figure 7: MapCruncher Beta in action.

Import Your Data Here

Lastly Virtual Earth now supports the import of the common XML format KML or “KeyHole Markup Language”. The process to import is identical to the existing GeoRSS or a Live collection import types; Microsoft added a new enumeration: VEDataType.ImportXML.

var spec = new
VEShapeSourceSpecification(VEDataType.ImportXML,
"http://enteryourkmlurlhere.htm");
map.ImportShapeLayerData(spec);

Unlike GeoRSS, the KML file itself must be located on a publicly accessible Web server, not a local file or localhost, as the data is parsed through maps.live.com.

Conclusion

Virtual Earth has grown into a mature application ready for use in demanding enterprise applications. The recent update added new functionality, improved the user interface, and increased the performance while having no breaking changes. Applications using version 5 may simply need to change the version number to 6. However to support this, certain functionality from previous versions, such as the old routing method, still works but has been marked as deprecated:

  • VEMap.GetRoute: use VEMap.GetDirections instead.
  • VERouteDeprecated: old VERoute class.
  • VERouteItineraryDeprecated: old VERouteItinerary class.

Now is the perfect time to update your Virtual Earth applications to the latest version or begin using this exciting technology to visualize your location-based data in your application.

John O'Brien

&


Mercator Projection

Virtual Earth 2D uses the “Mercator” projection and uses the WGS84 standard for its coordinates in decimal degrees. Essentially in order to flatten a sphere onto a flat surface this projection distorts the earth horizontally while maintaining accuracy vertically. This distortion increases as you move from the equator to the poles. The side effect is that countries like Greenland, at the extreme, look significantly bigger than in reality. Change to 3D mode to see objects without this distortion.



Table 2: Performance comparison of AddShape() as executed in Internet Explorer 7 under Microsoft Vista x64 on a Dell XPS1330 2.4 Ghz 4 GB RAM.
Number of PinsSingle Add in Loop (sec)Bulk Add (sec)
10.0080.004
100.0660.022
1000.6320.209
5002.8831.477
10007.2642.259
200021.8315.644


Article Pages: < Previous - 1 2  3 

Page 1: Virtual Earth-What's New in the Latest Release
Page 2: Routing Now Supports Multiple Points
Page 3: New Tile Set-Hill Shaded

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
3.5 out of 5

90 people have rated this article.

      ESDC

 

VFPConversion.com