This project is read-only.

The Microsoft Maps Spatial Toolkit consists of a number of libraries. The core library is a portable class library that is supported in .NET 4.5, Windows Store 8/8.1 and Windows Phone 8 apps. Here is an overview of the different libraries in this toolkit.
 

Name

Description

Microsoft.Maps.SpatialToolbox.Core

A portable class library that contains all the logic for reading and writing spatial data files.

Microsoft.Maps.SpatialToolbox.Component

A Windows Runtime Component that exposes the core library to JavaScript Windows Store Apps.

Microsoft.Maps.SpatialToolbox.Win8

A Windows Store library that streamlines the data import/export process into Bing Maps and adds several useful features. These features include clustering, support for complex polygons and data contracts for the Bing Maps services.

Microsoft.Maps.SpatialToolbox.WP8

A WP8 class library that streamlines the data import/export process into Bing Maps and adds several useful features.

Microsoft.Maps.SpatialToolbox.WPF

A WPF class library that streamlines the data import/export process into Bing Maps and adds several useful features.

Core Library

Namepsace : Microsoft.Maps.SpatialToolbox.Core

The main library that contains the base geometry class, spatial calculations, spatial file readers/writers, and a common set of classes for storing spatial data sets.

Spatial File readers/writers

Namespace: Microsoft.Maps.SpatialToolbox.Core.IO

Here is a table of the read/write support in this library:

Spatial File Format

File Extension

BaseFeed Class Name

Read Methods

Write Methods

Well Known Text

n/a

WellKnownText

Well Known Binary

n/a

WellKnownBinary

ESRI Shapefile

.shp

ShapefileReader

GeoRSS

.xml, .rss

GeoRSSFeed

GPX

.xml, .gpx

GpxFeed

KML

.xml, .kml

KmlFeed

KMZ

.zip, .kmz

KmlFeed

GeoJSON

.js, .json

GeoJsonFeed

 

SpatialTools Class methods

Name

Description

CalculateBearing

Calculates the bearing (heading) from one coordinate to another.

CalculateDestinationCoordinate

Calculates a destination coordinate based on a starting coordinate, a bearing, a distance, and a distance unit type.

CalculateGeodesic

Takes a list of coordinates and fills in the space between them with accurately positioned points to form a Geodesic path.

CalculateMidpoint

Calculates the midpoint coordinate between two coordinates.

ConvertDistance

Converts a distance from one distance unit to another.

DecimalDegreeToDMS

Converts a decimal degree value into a string in the format of “days, minutes, seconds”.

DMSToDecimalDegree

Converts a “days, minutes, seconds” value into a decimal degree value.

GenerateCircle

Calculates a list of coordinates that are an equal distance away from a central point to create an approximate circle.

GenerateRegularPolygon

Calculates a specified number of coordinates that are an equal distance away from a central point to create a regular polygon.

GetEarthRadius

Gets the approximate radius of the earth in Kilometers, Meters, Miles, and Feet.

HaversineDistance

Calculates the distance between two coordinates on the surface of a sphere (Earth).

ToDegrees

Converts an angle that is in radians to degrees.

ToRadians

Converts an angle that is in degrees to radians.

VertexReduction

Vertex reduction is the brute-force algorithm for simplifying a list of coordinates. It does this by ensuring that no two coordinates are closer than a specified distance in the unit of measurement. If working with coordinates in degrees then the distance would be in degrees.

All of these tools can read data from the specified spatial file formats, however writing is currently only supported by some of them. The read and write methods of these classes make use of a class called SpatialDataSet. This class is used to store a group of geometry objects along with their associated metadata and style information. The SpatialDataSet class has the following properties:

Name

Description

BoundingBox

The bounding box of the data set.

Error

A string with an error value. Often used if there is an issue parsing a file into a spatial data set.

Geometries

A list of geometries in the data set. All of these geometries derive from the Geometry class.

Metadata

Is a ShapeMetadata class that has three properties; Title, Description and Properties. The Title and Description properties are strings. The Properties property is a Dictionary of string and objects used to store additional metadata. All geometry objects have a Metadata property as well.

Styles

A dictionary used as a lookup table for styles. Style information is stored in a ShapeStyle class.

Bing Maps Tools Library

Namespace: Microsoft.Maps.SpatialToolbox.Bing

The WPF, WP8 and Windows Store libraries all contain set of tools for Bing Maps on those respective platform. There are five classes at the root of this namespace that add Bing Maps specific features to the library. Here is an overview of these classes.

Class Name

Description

BingExtensions

A static class used to extend the Bing Maps classes to provide additional functionality. This class adds a method called ToBMGeometry to all geometries for easily converting Geometry objects to a Bing Maps shape. This class also add a method called ToGeometry to all Bing Maps shapes.

HeatMapLayer A class that adds point based density heat maps to Bing Maps.

MapTools

A static class with methods that makes it easy to add a SpatialDataSet or a Geometry object to the map.

PointCompression

This class contains the algorithms required to encode and decode coordinates that are compressed as a 64 bit string. This is used by the Bing Maps REST services for passing a large number of coordinates to the Elevation service. This is also used by the GeoData API in the Bing Spatial Data Services for passing boundary information in a compressed format.

StyleTools

This class contains a number of methods for creating Bing Maps Shapes from geometries using styles from a ShapeStyle class.

TileMath

A set of mathematical calculation based on the quad key tile system used in Bing Maps. This is handy when creating advance mapping applications.

In the Windows Store library this namespace also has a class called MapShapeExt which adds a DependencyProperty to MapPolygon’s and MapPolyline’s. This property is a Tag property where an object can be stored. This library stores the metadata for each shape in this property. The WPF library has a similar class called MapElementExt. Here is an example of how this can be used.

C#

MapPolygon p = new MapPolygon();
p.SetValue(MapShapeExt.TagProperty, "My Metedata");
object tagValue = p.GetValue(MapShapeExt.TagProperty);

Visual Basic

Dim p = New MapPolygon()
p.SetValue(MapShapeExt.TagProperty, "My Metedata")
Dim tagValue = p.GetValue(MapShapeExt.TagProperty)

Last edited Aug 12, 2014 at 3:58 PM by rbrundritt, version 5