mirror of
https://github.com/wavded/js-shapefile-to-geojson
synced 2025-12-14 18:24:03 +00:00
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.
This commit is contained in:
@@ -256,20 +256,22 @@
|
|||||||
for (var r = 0, record; record = records[r]; r++){
|
for (var r = 0, record; record = records[r]; r++){
|
||||||
feature = {}, fbounds = record.bounds, points = record.points, parts = record.parts
|
feature = {}, fbounds = record.bounds, points = record.points, parts = record.parts
|
||||||
feature.type = "Feature"
|
feature.type = "Feature"
|
||||||
|
if (record.shapeType !== 'Point') {
|
||||||
feature.bbox = [
|
feature.bbox = [
|
||||||
fbounds.left,
|
fbounds.left,
|
||||||
fbounds.bottom,
|
fbounds.bottom,
|
||||||
fbounds.right,
|
fbounds.right,
|
||||||
fbounds.top
|
fbounds.top
|
||||||
]
|
]
|
||||||
|
}
|
||||||
geometry = feature.geometry = {}
|
geometry = feature.geometry = {}
|
||||||
|
|
||||||
switch (record.shapeType) {
|
switch (record.shapeType) {
|
||||||
case "Point":
|
case "Point":
|
||||||
geometry.type = "Point"
|
geometry.type = "Point"
|
||||||
geometry.coordinates = [
|
geometry.coordinates = [
|
||||||
record.points.x,
|
record.x,
|
||||||
record.points,y ]
|
record.y ]
|
||||||
break
|
break
|
||||||
case "MultiPoint":
|
case "MultiPoint":
|
||||||
case "PolyLine":
|
case "PolyLine":
|
||||||
|
|||||||
Reference in New Issue
Block a user