terraformer-wkt-parser
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "terraformer-wkt-parser", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Well-Known Text parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -461,3 +461,3 @@ (function (root, factory) { | ||
}; | ||
lexer.rules = [/^(?:\s+)/,/^(?:\()/,/^(?:\))/,/^(?:-?(([0-9]+\.?)|([0-9]*\.?[0-9]+)([eE][-+]?[0-9]+)?))/,/^(?:POINT\b)/,/^(?:LINESTRING\b)/,/^(?:POLYGON\b)/,/^(?:MULTIPOINT\b)/,/^(?:MULTILINESTRING\b)/,/^(?:MULTIPOLYGON\b)/,/^(?:,)/,/^(?:EMPTY\b)/,/^(?:M\b)/,/^(?:Z\b)/,/^(?:$)/,/^(?:.)/]; | ||
lexer.rules = [/^(?:\s+)/,/^(?:\()/,/^(?:\))/,/^(?:-?[0-9]+(\.[0-9]+)?)/,/^(?:POINT\b)/,/^(?:LINESTRING\b)/,/^(?:POLYGON\b)/,/^(?:MULTIPOINT\b)/,/^(?:MULTILINESTRING\b)/,/^(?:MULTIPOLYGON\b)/,/^(?:,)/,/^(?:EMPTY\b)/,/^(?:M\b)/,/^(?:Z\b)/,/^(?:$)/,/^(?:.)/]; | ||
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],"inclusive":true}}; | ||
@@ -566,2 +566,3 @@ return lexer;})() | ||
} catch (err) { | ||
console.dir(err); | ||
throw Error("Unable to parse", err); | ||
@@ -568,0 +569,0 @@ } |
@@ -17,5 +17,7 @@ var vows = require('vows'), | ||
multi_p = fs.readFileSync('./examples/multi_polygon.wkt', 'utf8'), | ||
multi_p_h = fs.readFileSync('./examples/multi_polygon_with_hole.wkt', 'utf8'); | ||
multi_p_h = fs.readFileSync('./examples/multi_polygon_with_hole.wkt', 'utf8'), | ||
poly_dots = fs.readFileSync('./examples/polygon_with_dots.wkt', 'utf8'); | ||
vows.describe('WKT Parsing').addBatch({ | ||
@@ -85,2 +87,22 @@ 'Given a Point': { | ||
}, | ||
'Given a Polygon with Dots': { | ||
topic: function () { | ||
return wkt.parse(poly_dots); | ||
}, | ||
'the point should be correctly converted to Loqi-GeoJSON internally': function (topic) { | ||
//-122.358 47.653,-122.348 47.649,-122.348 47.658,-122.358 47.658,-122.358 47.653 | ||
assert.equal(topic.type, "Polygon"); | ||
assert.equal(topic.coordinates.length, 1); | ||
assert.equal(topic.coordinates[0][0][0], -122.358); | ||
assert.equal(topic.coordinates[0][0][1], 47.653); | ||
assert.equal(topic.coordinates[0][1][0], -122.348); | ||
assert.equal(topic.coordinates[0][1][1], 47.649); | ||
assert.equal(topic.coordinates[0][2][0], -122.348); | ||
assert.equal(topic.coordinates[0][2][1], 47.658); | ||
assert.equal(topic.coordinates[0][3][0], -122.358); | ||
assert.equal(topic.coordinates[0][3][1], 47.658); | ||
assert.equal(topic.coordinates[0][4][0], -122.358); | ||
assert.equal(topic.coordinates[0][4][1], 47.653); | ||
} | ||
}, | ||
'Given an Empty Polygon': { | ||
@@ -202,2 +224,3 @@ topic: function () { | ||
'the point should be correctly converted to Loqi-GeoJSON internally': function (topic) { | ||
console.dir(topic); | ||
assert.equal(topic.type, "MultiPolygon"); | ||
@@ -204,0 +227,0 @@ assert.equal(topic.coordinates.length, 2); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43236
27
1065