Skip to content

Commit

Permalink
fix little bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Gasson committed Mar 10, 2016
1 parent 53a5b6b commit c6ac36c
Show file tree
Hide file tree
Showing 4 changed files with 2,911 additions and 17 deletions.
18 changes: 7 additions & 11 deletions src/geojson.js
Expand Up @@ -15,17 +15,13 @@ function justType(type, TYPE) {
}

function justCoords(t) {
console.log("justCoords", t)
return t.geometry.coordinates;
// if (t.geometry.coordinates[0] !== undefined &&
// t.geometry.coordinates[0][0] !== undefined &&
// t.geometry.coordinates[0][0][0] !== undefined) {
// console.log("justCoords 1")
// return t.geometry.coordinates[0];
// } else {
// console.log("justCoords 2")
// return t.geometry.coordinates;
// }
if (t.geometry.coordinates[0] !== undefined &&
t.geometry.coordinates[0][0] !== undefined &&
t.geometry.coordinates[0][0][0] !== undefined) {
return t.geometry.coordinates[0];
} else {
return t.geometry.coordinates;
}
}

function justProps(t) {
Expand Down
34 changes: 28 additions & 6 deletions test/extent.test.js
Expand Up @@ -3,9 +3,31 @@ var expect = require('expect.js'),
var write = require('../src/write');
var types = require('../src/types');
var fs = require('fs')
var path = require('path')
var zip = require('../src/zip')


describe('extent', function() {

// describe("isochrone", function(){
// it('should zip this geojson correctly', function(done){

// fs.readFile(path.join(__dirname, 'isochrone.json'), 'utf-8', function(err,data){
// if (err){
// throw err
// }
// var js = JSON.parse(data)
// var x = zip(js)
// fs.readFile(path.join(__dirname, 'isochrone.zip'), function(err, data){
// // console.log(data)
// expect(x).to.eql(data)
// done(null)
// })

// })
// })
// })

describe('#blank', function() {
it('creates an ext', function() {
var ext = extent.blank();
Expand Down Expand Up @@ -78,9 +100,9 @@ describe('extent', function() {
// geometries
[points],
function(err, files){
fs.writeFileSync('polygon.shp', toBuffer(files.shp.buffer));
fs.writeFileSync('polygon.shx', toBuffer(files.shx.buffer));
fs.writeFileSync('polygon.dbf', toBuffer(files.dbf.buffer));
// fs.writeFileSync('polygon.shp', toBuffer(files.shp.buffer));
// fs.writeFileSync('polygon.shx', toBuffer(files.shx.buffer));
// fs.writeFileSync('polygon.dbf', toBuffer(files.dbf.buffer));
var view = files.shp
describe('the file', function(){
it('has the correct header', function(){
Expand Down Expand Up @@ -215,9 +237,9 @@ describe('extent', function() {
// geometries
[points],
function(err, files){
fs.writeFileSync('multipolygon.shp', toBuffer(files.shp.buffer));
fs.writeFileSync('multipolygon.shx', toBuffer(files.shx.buffer));
fs.writeFileSync('multipolygon.dbf', toBuffer(files.dbf.buffer));
// fs.writeFileSync('multipolygon.shp', toBuffer(files.shp.buffer));
// fs.writeFileSync('multipolygon.shx', toBuffer(files.shx.buffer));
// fs.writeFileSync('multipolygon.dbf', toBuffer(files.dbf.buffer));
var view = files.shp

describe('the file', function(){
Expand Down

0 comments on commit c6ac36c

Please sign in to comment.