Using wkx in the Browser

To use wkx in a webpage, simply copy a built browser version from dist/ into your project, and use a script tag to include it:

<script src="wkx.js"></script>

You may also use RawGit as a CDN, so you don't need to copy wkx into your project:

<script src="https://cdn.rawgit.com/cschwarz/wkx/v0.1.0/dist/wkx.js"></script>

If you use browserify for your project, you can simply npm install wkx --save, and just require wkx as usual in your code.

Regardless of which of the preceeding options you choose, using wkx in the browser will look the same:

var wkx = require('wkx');

Code Samples:

CodeResult
new wkx.Point(1, 2).toWkt()
new wkx.Point(1, 2).toWkb()
wkx.Geometry.parse('POINT(1 2)')
wkx.Geometry.parse(new Buffer(
  '0101000000000000000000f03f0000000000000040', 'hex'))