Permalink
Browse files

Merge

  • Loading branch information...
2 parents 5564541 + aa46863 commit b93512feb4658c83b858a0f0f959894296d2908b @tmcw tmcw committed Sep 24, 2013
View
@@ -113,6 +113,11 @@ function csv2geojson(x, options, callback) {
row: parsed[i]
});
} else {
+ if (!options.includeLatLon) {
+ delete parsed[i][lonfield];
+ delete parsed[i][latfield];
+ }
+
features.push({
type: 'Feature',
properties: parsed[i],
@@ -209,4 +214,4 @@ module.exports = function(x, dims) {
},{}]},{},[1])
(1)
});
-;
+;
View
@@ -111,6 +111,11 @@ function csv2geojson(x, options, callback) {
row: parsed[i]
});
} else {
+ if (!options.includeLatLon) {
+ delete parsed[i][lonfield];
+ delete parsed[i][latfield];
+ }
+
features.push({
type: 'Feature',
properties: parsed[i],
View
@@ -1,6 +1,6 @@
{
"name": "csv2geojson",
- "version": "3.4.1",
+ "version": "3.5.1",
"description": "convert CSV files to GeoJSON",
"main": "index.js",
"repository": {
View
@@ -84,6 +84,13 @@ describe('csv2geojson', function() {
});
});
+ it('with includeLatLon option', function(done) {
+ csv2geojson.csv2geojson(textFile('includeLatLon.csv'), { includeLatLon: true }, function(err, data) {
+ expect(data).to.eql(jsonFile('includeLatLon.geojson'));
+ done();
+ });
+ });
+
describe('delimiters', function() {
it('|', function(done) {
csv2geojson.csv2geojson(textFile('simple.pipe.dsv'), { delimiter: '|' },
@@ -155,7 +162,7 @@ describe('csv2geojson', function() {
type: 'FeatureCollection',
features: [{
type: 'Feature',
- properties: { name: '3', y: '1', x: '2' },
+ properties: { name: '3' },
geometry: {
type: 'Point',
coordinates: [2, 1]
@@ -1 +1 @@
-{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"lat":"23°N","lon":"26°W","name":"Chester"},"geometry":{"type":"Point","coordinates":[-26,23]}}]}
+{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"name":"Chester"},"geometry":{"type":"Point","coordinates":[-26,23]}}]}
@@ -0,0 +1,2 @@
+lat,lng,name
+1,2,3
@@ -0,0 +1,15 @@
+{
+ "type": "FeatureCollection",
+ "features": [{
+ "type": "Feature",
+ "properties": {
+ "lat": "1",
+ "lng": "2",
+ "name": "3"
+ },
+ "geometry": {
+ "type": "Point",
+ "coordinates": [2, 1]
+ }
+ }]
+}
View
@@ -3,9 +3,7 @@
"features": [{
"type": "Feature",
"properties": {
- "name": "3",
- "lat": "1",
- "lng": "2"
+ "name": "3"
},
"geometry": {
"type": "Point",
@@ -1 +1 @@
-{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"lat":"40° 11′","lon":"40° 11' 15\"","name":"Chester"},"geometry":{"type":"Point","coordinates":[40.1875,40.18333333333333]}}]}
+{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"name":"Chester"},"geometry":{"type":"Point","coordinates":[40.1875,40.18333333333333]}}]}
View
@@ -3,9 +3,7 @@
"features": [{
"type": "Feature",
"properties": {
- "name": "3",
- "lat": "1",
- "lon": "2"
+ "name": "3"
},
"geometry": {
"type": "Point",
@@ -3,8 +3,6 @@
"features": [{
"type": "Feature",
"properties": {
- " lat": "1",
- " lon": "2",
" name": "3"
},
"geometry": {

0 comments on commit b93512f

Please sign in to comment.