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

Configure proj4 options and transforms upon construction #3362

Merged
merged 3 commits into from
Mar 26, 2015

Conversation

ahocevar
Copy link
Member

This makes it easier to add additional configuration options to projections that are connected to a proj4js definition.

Previously (still works):

var proj = ol.proj.get('EPSG:1234');
proj.setExtent([1, 2, 3, 4]);

Now:

var proj = new ol.proj.Projection({
  code: 'EPSG:1234',
  extent: [1, 2, 3, 4]
});

The difference when using this new approach is that additional properties will not be set on the projection instance that is returned from the registry when using ol.proj.get():

> var proj = new ol.proj.Projection({code:'EPSG:1234',extent:[1,2,3,4]});
> ol.proj.get('EPSG:1234').getExtent();
null
> proj.getExtent();
[1,2,3,4]

@elemoine
Copy link
Member

Would it make sense to change the examples that currently use setExtent?

@ahocevar
Copy link
Member Author

ahocevar commented Mar 26, 2015 via email

@ahocevar ahocevar force-pushed the constructor-proj4js branch from 2eec3dd to 362c9b6 Compare March 26, 2015 09:52
@ahocevar
Copy link
Member Author

Would it make sense to change the examples that currently use setExtent?

Done @elemoine.

@elemoine
Copy link
Member

This looks good to me.

ahocevar added a commit that referenced this pull request Mar 26, 2015
Configure proj4 options and transforms upon construction
@ahocevar ahocevar merged commit 34851d8 into openlayers:master Mar 26, 2015
@ahocevar ahocevar deleted the constructor-proj4js branch March 26, 2015 10:21
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