Adding WKT to the Google Maps JavaScript API

Well-known Text (WKT) is a text markup language for representing vector geometry objects on the map according to Wikipedia. This format was originally defined by the Open Geospatial Consortium (OGC), which is also a standard.

Apart from XML or JSON, WKT is a defined text format that only defines geometries without properties compared to GeoJSON. It was an old and outdated format, but there are still software or services supporting this format. There are 18 distinct geometric objects that represent Earth features, but simple ones are observed in this recipe.

The Google Maps JavaScript API does not support WKT natively, but WKT support will be added with a few lines of coding or with some additional libraries. ...

Get Google Maps JavaScript API Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.