Well Known Text Reader/Writer
Author: Ricky Brundritt
Category: Data
Module Size: 11 kb (minified 4 kb)
Description:
This module allows you to easily read and write Well Know Text data. When reading Well Know Text data it is parsed into Bing Maps shapes. MultiPoint, MultiLinstring, MultiPolygon and GeometryCollection are turned into an EntityCollection of shapes.To write
Well Known text simply pass in a Bing Maps shape and the Well Known Text equivalent will be returned.
Supported WKT tags:
- Point
- Linestring
- Polygon – Supports Complex Polygons
- MultiPoint
- MultiLinestring
- MultiPolygon
- Geometrycollection
Loading the Module:
//Register and load the Persistence Module
Microsoft.Maps.registerModule("WKTModule", "scripts/WKTModule.js");
Microsoft.Maps.loadModule("WKTModule");
Write Example:
var p = new Microsoft.Maps.Point(new Microsoft.Maps.Location(0,0));
var wkt = WKTModule.Write(p);
--> wkt = 'POINT(0,0)'
Read Example:
var wkt = 'LINESTRING(0 0, 10 10)';
var shape = WKTModule.Read(wkt);
--> shape = Microsoft.Map.Polyline
Options:
Style Options - Pass in styles into the Read method to override the default styles options for generating the shapes. These styles will be merged with the default option styles.
Download:

BMv7.WKTModule.zip