mirror of
https://github.com/wavded/js-shapefile-to-geojson
synced 2024-11-23 14:34:54 +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:
parent
db9bfd55d8
commit
825ce8af25
18
shapefile.js
18
shapefile.js
@ -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"
|
||||||
feature.bbox = [
|
if (record.shapeType !== 'Point') {
|
||||||
fbounds.left,
|
feature.bbox = [
|
||||||
fbounds.bottom,
|
fbounds.left,
|
||||||
fbounds.right,
|
fbounds.bottom,
|
||||||
fbounds.top
|
fbounds.right,
|
||||||
]
|
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":
|
||||||
|
Loading…
Reference in New Issue
Block a user