mapbox / shp-write

create and write to shapefiles in pure javascript
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

Doku options types #28

Open ximex opened 8 years ago

ximex commented 8 years ago

look at the options.types.line. It should be: options.types.polyline

current:

var options = {
    folder: 'myshapes',
    types: {
        point: 'mypoints',
        polygon: 'mypolygons',
        line: 'mylines'
    }
}

correct:

var options = {
    folder: 'myshapes',
    types: {
        point: 'mypoints',
        polygon: 'mypolygons',
        polyline: 'mypolylines'
    }
}
tmcw commented 8 years ago

Have you tested this to be true? I haven't looked at this module in a while, but it really appears like the option would be called line.

ximex commented 8 years ago

look at:

module.exports.line = justType('LineString', 'POLYLINE'); this "POLYLINE" is compared with the "line/polyline". Maybe change all "POLYLINE" and "line" to "LineString" as it is named in geojson

tmcw commented 8 years ago

Yes, but the code, as it currently stands, would work correctly with the example in the readme, and not with the suggested example, right?

ximex commented 8 years ago

options.types[l.type.toLowerCase()]

l.type.toLowerCase() = polyline options.types = {line: "mypolylines"} so: options.types["polyline"] = undefined but with: options.types = {polyline: "mypolylines"} options.types["polyline"] = mypolyline

the example in the readme didn't work for me. i have changed it that it works.