Code Monkey home page Code Monkey logo

Comments (3)

ahocevar avatar ahocevar commented on May 27, 2024

It would be possible to add that, but usually it is easier to do what you are currently doing - creating a new View and call map.setView(newView). I don't see how this would be more complex than setting a projection, calculating the new center and zoom, and set the resulting properties on an existing view.

from openlayers.

mike-000 avatar mike-000 commented on May 27, 2024

It makes sense to create a new view as center and resolution must also change when the projection changes. As long as the projections are defined using proj4 and their extents overlap the onChangeProjection function in https://openlayers.org/en/latest/examples/projection-and-scale.html should work for any combination of projections.

from openlayers.

oxyeez avatar oxyeez commented on May 27, 2024

It would be possible to add that, but usually it is easier to do what you are currently doing - creating a new View and call map.setView(newView). I don't see how this would be more complex than setting a projection, calculating the new center and zoom, and set the resulting properties on an existing view.

Yeah I didn't explain much. The reason why it's adding complexity is because for this project I'm setting many listeners on the view for different purposes. So any time I'm replacing the old view by the new one I have to unset the listeners on the old one, and reset all of them for the new view. And this has to be done any time we change projection, so with the UTM/UPS system it can be very frequent (nearly every mouse drag).

It makes sense to create a new view as center and resolution must also change when the projection changes. As long as the projections are defined using proj4 and their extents overlap the onChangeProjection function in https://openlayers.org/en/latest/examples/projection-and-scale.html should work for any combination of projections.

This is indeed the work from which one I started.

from openlayers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.