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

Proj4 doesn't include some projections by default. Include them. #840

Merged
merged 1 commit into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/reprojection/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ $(function () {
node: '#map',
center: {x: 0, y: 0},
zoom: 2.5,
gcs: gcsTable[gcs],
gcs: gcsTable[gcs] || gcs,
unitsPerPixel: (range[1].x - range[0].x) / 256,
clampBoundsX: false,
clampBoundsY: false,
Expand All @@ -131,7 +131,7 @@ $(function () {
gcs: 'EPSG:3857',
attribution: $('#url-list [value="' + $('#layer-url').val() + '"]').attr(
'credit'),
minLevel: 4,
minLevel: query.minLevel ? parseInt(query.minLevel, 10) : 4,
keepLower: true,
wrapX: false,
wrapY: false
Expand Down
8 changes: 8 additions & 0 deletions src/transform.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
var proj4 = require('proj4');
/* These projections exist in proj4 but aren't included by default. */
proj4.Proj.projections.add(require('proj4/projections/equi'));
proj4.Proj.projections.add(require('proj4/projections/gauss'));
proj4.Proj.projections.add(require('proj4/projections/gstmerc'));
proj4.Proj.projections.add(require('proj4/projections/ortho'));
var util = require('./util');

/**
Expand Down Expand Up @@ -614,4 +619,7 @@ transform.vincentyDistance = function (pt1, pt2, gcs, baseGcs, ellipsoid, maxIte
};
};

/* Expose proj4 to make it easier to debug */
transform.proj4 = proj4;

module.exports = transform;