Comparing version 0.0.4 to 0.1.0
@@ -36,3 +36,3 @@ #!/usr/bin/env node | ||
function readStream() { | ||
if (fromCrs && toCrs) { | ||
if ((fromCrs && toCrs) || (!argv.from && !argv.to)) { | ||
((argv._[0] && fs.createReadStream(argv._[0])) || process.stdin).pipe(concat(openData)); | ||
@@ -49,3 +49,3 @@ } | ||
if (argv["from"] || argv["to"]) { | ||
if (fromCrs && toCrs) { | ||
geojson = reproject.reproject(geojson, fromCrs, toCrs, crss) | ||
@@ -76,2 +76,7 @@ } | ||
function lookupCrs(crsName, cb) { | ||
if (!crsName) { | ||
cb(null); | ||
return; | ||
} | ||
if (!crss[crsName]) { | ||
@@ -78,0 +83,0 @@ if (useSpatialReference) { |
"use strict"; | ||
var proj4node = require('proj4node'); | ||
var proj4 = require('proj4'); | ||
// Checks if `list` looks like a `[x, y]`. | ||
@@ -80,2 +79,3 @@ function isXY(list) { | ||
to = determineCrs(to, projs); | ||
var transform = proj4(from, to); | ||
@@ -89,4 +89,3 @@ return traverseGeoJson(geojson, function(gj) { | ||
gj.coordinates = traverseCoords(gj.coordinates, function(xy) { | ||
var coord = to.transform(from, { x:xy[0], y:xy[1] }); | ||
return [ coord.x, coord.y ]; | ||
return transform.forward(xy); | ||
}); | ||
@@ -110,4 +109,4 @@ }); | ||
toWgs84: function(geojson, from) { | ||
return reproject(geojson, from, proj4node.WGS84); | ||
return reproject(geojson, from, proj4.WGS84); | ||
} | ||
} |
{ | ||
"name": "reproject", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "Reproject GeoJSON from one projection/CRS to another", | ||
@@ -22,5 +22,5 @@ "repository": "git@github.com:perliedman/reproject.git", | ||
"dependencies": { | ||
"proj4node": "0.0.6", | ||
"minimist": "0.0.2", | ||
"concat-stream": "~1.0.1" | ||
"concat-stream": "~1.0.1", | ||
"proj4": "~1.4.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
@@ -5,6 +5,6 @@ "use strict"; | ||
expect = require('expect.js'), | ||
proj4node = require('proj4node'); | ||
proj4 = require('proj4'); | ||
var sweref99tm = proj4node('+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'), | ||
rt90 = proj4node('+lon_0=15.808277777799999 +lat_0=0.0 +k=1.0 +x_0=1500000.0 +y_0=0.0 +proj=tmerc +ellps=bessel +units=m +towgs84=414.1,41.3,603.1,-0.855,2.141,-7.023,0 +no_defs'), | ||
var sweref99tm = proj4.Proj('+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'), | ||
rt90 = proj4.Proj('+lon_0=15.808277777799999 +lat_0=0.0 +k=1.0 +x_0=1500000.0 +y_0=0.0 +proj=tmerc +ellps=bessel +units=m +towgs84=414.1,41.3,603.1,-0.855,2.141,-7.023,0 +no_defs'), | ||
crss = { | ||
@@ -11,0 +11,0 @@ "EPSG:3006": sweref99tm, |
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
19652
7
564
1
+ Addedproj4@~1.4.0
+ Addedproj4@1.4.1(transitive)
- Removedproj4node@0.0.6
- Removedproj4node@0.0.6(transitive)