From 825ce8af25cc63a522e79e8a8e2439daa10d16f2 Mon Sep 17 00:00:00 2001 From: Chad Burt Date: Mon, 9 Sep 2013 15:45:38 -0700 Subject: [PATCH] Fixed support for Point datasets While some support existed, an attempt was being made to create an unnecessary(?) bounding box for each point feature. Also swapped access of the x,y coordinates from record.geometry.x|y to record.x|y. --- shapefile.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/shapefile.js b/shapefile.js index f050d4e..6fe83bb 100644 --- a/shapefile.js +++ b/shapefile.js @@ -256,20 +256,22 @@ for (var r = 0, record; record = records[r]; r++){ feature = {}, fbounds = record.bounds, points = record.points, parts = record.parts feature.type = "Feature" - feature.bbox = [ - fbounds.left, - fbounds.bottom, - fbounds.right, - fbounds.top - ] + if (record.shapeType !== 'Point') { + feature.bbox = [ + fbounds.left, + fbounds.bottom, + fbounds.right, + fbounds.top + ] + } geometry = feature.geometry = {} switch (record.shapeType) { case "Point": geometry.type = "Point" geometry.coordinates = [ - record.points.x, - record.points,y ] + record.x, + record.y ] break case "MultiPoint": case "PolyLine":