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

Support affine transforms in the proj4 string #986

Merged
merged 3 commits into from
Apr 3, 2019

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Mar 12, 2019

The latest version of proj4 supports affine transforms via parameters such as +s11 and +xoff. Proj4js doesn't yet support this, but since it is useful, implement these transforms.

Strictly, in Proj4 6.0.0, you can specify an affine transform like so: echo 1 2 | cs2cs +proj=affine +to +proj=affine +s11=1.046 +s12=0.0915 +s21=-0.0915 +s22=1.046 +xoff=-1054 +yoff=-1160, where instead of a projection the affine transformation is specified. However, proj4js expects +proj= to be one of its known projections. Therefore, for know, a layer in image space coordinates could be transformed via something like +proj=longlat +axis=enu +s11=1.046 +s12=-0.0915 +s21=0.0915 +s22=1.046 +xoff=-1054 +yoff=-1160.

Add the ability to easily set the tile layer's gcs. Along with the addition of proj4 affine transforms, this allows multiple tile layers to have different (and adjustable) transforms.

This is a better implementation of the old branch to add a matrix transform the proj4 string (ec462b5). This should eventually be able to transition to official support in proj4js.

manthey added 2 commits March 12, 2019 13:28
The latest version of proj4 supports affine transforms via parameters
such as +s11 and +xoff.  Proj4js doesn't yet support this, but since it
is useful, implement these transforms.

Strictly, in Proj4 6.0.0, you can specify an affine transform like so:
`echo 1 2 | cs2cs +proj=affine +to +proj=affine +s11=1.046 +s12=0.0915
+s21=-0.0915 +s22=1.046 +xoff=-1054 +yoff=-1160`, where instead of a
projection the `affine` transformation is specified.  However, proj4js
expects `+proj=` to be one of its known projections.  Therefore, for
know, a layer in image space coordinates could be transformed via
something like `+proj=longlat +axis=enu +s11=1.046 +s12=-0.0915
+s21=0.0915 +s22=1.046 +xoff=-1054 +yoff=-1160`.
Along with the addition of proj4 affine transforms, this allows multiple
tile layers to have different (and adjustable) transforms.
@manthey
Copy link
Contributor Author

manthey commented Mar 12, 2019

This could be broken into two independent PRs if it preferred.

It will allow support for overlaying multiple tile layers that are distorted compared to each other, for instance with microscopy images of multiple tissue slices.

@manthey manthey requested a review from aashish24 March 12, 2019 17:33
@manthey
Copy link
Contributor Author

manthey commented Mar 12, 2019

Once this and PR #985 are merged, you can see an example use on a tutorial based on the deep zoom example.

Copy link
Member

@aashish24 aashish24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, I did not check the regex.

@manthey manthey merged commit a06dfc6 into master Apr 3, 2019
@manthey manthey deleted the proj4-affine-transforms branch April 3, 2019 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants