Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding point data to test Krovak projection #116

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/deriveConstants.js
Expand Up @@ -49,6 +49,8 @@ module.exports = function(json) {
json.axis = "enu";
}

json.datum = datum(json);
if (!json.datum) {
json.datum = datum(json);
}
return json;
};
};
19 changes: 19 additions & 0 deletions test/test.js
Expand Up @@ -213,6 +213,25 @@ function startTests(chai, proj4, testPoints) {
assert.equal(point.toMGRS(3), "25XEN041865", "MGRS reference with 3-digit accuracy correct.");
});
});
describe('Defs and Datum definition', function() {
proj4.defs("EPSG:5514", "+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +pm=greenwich +units=m +no_defs +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56");
var point = proj4.transform(proj4.Proj("WGS84"), proj4.Proj("EPSG:5514"),
proj4.toPoint([12.806988, 49.452262]));
it("Longitude of point from WGS84 correct.", function() {
assert.equal(point.x.toPrecision(8), "-868208.61", "Longitude of point from WGS84 correct.");
});
it("Latitude of point from WGS84 correct.", function() {
assert.equal(point.y.toPrecision(9), "-1095793.64", "Latitude of point from WGS84 correct.");
});
var point2 = proj4.transform(proj4.Proj("WGS84"), proj4.Proj("EPSG:5514"),
proj4.toPoint([12.806988, 49.452262]));
it("Longitude of point from WGS84 with second call for EPSG:5514 correct.", function() {
assert.equal(point2.x.toPrecision(8), "-868208.61", "Longitude of point from WGS84 correct.");
});
it("Latitude of point from WGS84 with second call for EPSG:5514 correct.", function() {
assert.equal(point2.y.toPrecision(9), "-1095793.64", "Latitude of point from WGS84 correct.");
});
});
});
});
}
Expand Down
7 changes: 6 additions & 1 deletion test/testData.js
Expand Up @@ -279,6 +279,11 @@ var testPoints = [
code:"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs",
ll:[-3.20078, 55.96056],
xy:[325132.0089586496, 674822.638235305]
},
{
code:"+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +pm=greenwich +units=m +no_defs +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56",
ll: [12.806988, 49.452262],
xy: [-868208.61, -1095793.64]
}
];
if(typeof module !== 'undefined'){
Expand All @@ -287,4 +292,4 @@ if(typeof module !== 'undefined'){
define(function(){
return testPoints;
});
}
}