Giter VIP home page Giter VIP logo

Comments (4)

Igor-Vladyka avatar Igor-Vladyka commented on July 22, 2024

Hey Peter.

This is an interesting catch. I will check it out and let you know.

from leaflet.browser.print.

petersteele111 avatar petersteele111 commented on July 22, 2024

Hey Peter.

This is an interesting catch. I will check it out and let you know.

Thanks, so we noticed that, at least with Google and presumably OpenStreetMaps, it doesn't load tiles for satellite and hybrid view past zoom level 20. For roadmap or streetview as its called, its level 22. At level 20, it starts scaling the tiles that are loaded, but when rebuilding the map to print, it is unable to load the tiles at the specified zoom level beyond 20. I am assuming the openstreet maps has a similar limitation since it was doing the same thing in your demo. For now, our workaround was to manually set the newMapOption.maxZoom variable to 20. This allows us to still allow a higher level of zoom for our users on the map, but when they go to print, it will default to level 20 for printing purposes, if their native zoom is higher than 20, so those satellite tiles will actually get loaded in.

Temporary fix

As you can see, around line 510 is where we had to set this hard coded instead of using the this._map.getMaxZoom so that the tiles would actually get loaded.

It would ne nice, if we could load the tiles to level 20 so they actually get loaded, and then scale it to the higher zoom to simulate what the user sees on the map if possible. If not, it may just be a limitation of the tile provider that can't be worked around. We thought about just taking a screenshot as well and printing that for the higher zoom levels. So that may be an option to get around this limitation.

I know this might be an edge case regarding printing, but we do GIS stuff with the map, and clients really want to be able to print as close as possible to show their assets hence how we came across this bug. We've been using this plugin for some time, and really appreciate the hard work you put into creating it. It's awesome and I'm surprised we are only just now noticing this.

from leaflet.browser.print.

Igor-Vladyka avatar Igor-Vladyka commented on July 22, 2024

Hey Peter.

I'm not sure about your actual tiles providers that you are using (each tile server has it's own zoom levels, based on need and infrastracture to support it) therefore not sure what is your best approach to go here.

Right now I have fixed the problem, now maxZoom will be taken from the printLayer or from the map itself. At least it fixed the use case that can be reproduced in my demo.

You can check it out, and If it's not sufficient for you, please share your demo(jsbin or something else) with reproducible issue so I can take a look.

from leaflet.browser.print.

petersteele111 avatar petersteele111 commented on July 22, 2024

Thanks, I haven't had a chance to mess with this yet. We are still using our fix right now of just setting the max zoom to 20 and it is working fine for us. I will take a look at it soon though and see if it fixes the issue for us by default. Thanks again for the speedy response and I will let you know how it goes!

from leaflet.browser.print.

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.