GithubHelp home page GithubHelp logo

pixelated images about contextily HOT 22 CLOSED

geopandas avatar geopandas commented on May 18, 2024
pixelated images

from contextily.

Comments (22)

lwasser avatar lwasser commented on May 18, 2024 1

from contextily.

choldgraf avatar choldgraf commented on May 18, 2024 1

+1 with sinc interpolation (you could always make this a kwarg)

from contextily.

darribas avatar darribas commented on May 18, 2024 1

This is cool. How could we integrate it in contextily? My sense is that this comes more at the plotting level than at the download, right? Maybe in plot_map? Incidentally, I've just realised that we have a calculate_zoom that @choldgraf implemented and I hadn't realised. It'd be great to get it as default for bounds2img and bounds2raster. But that's for a different ticket so will move that discussion over there :-)

from contextily.

knaaptime avatar knaaptime commented on May 18, 2024 1

sure, but i'm just the messenger. the credit goes to @ljwolf :)

so the quickest way to use it is to install from his fork until this gets merged

from contextily.

ljwolf avatar ljwolf commented on May 18, 2024 1

I won't speak for @darribas & am not a project maintainer, but I think that #21 may have stalled because of the auto-zoom request in #5, mentioned in #20.

Personally, I don't know if I'll have time to take a look at this until SciPy, but I'll try to un-stick #21 by then.

from contextily.

darribas avatar darribas commented on May 18, 2024 1

Quick update. @ljwolf and I are at SciPy and the idea is to cut a release that includes the interpolation, as well as some streamlining of the API (hopefully not back-breaking :) ). More to come soon!

from contextily.

darribas avatar darribas commented on May 18, 2024 1

This is now addressed in #32, so it's ready in master, should be getting out as a new release soon. If you need it urgently, you can pip install against master.

from contextily.

choldgraf avatar choldgraf commented on May 18, 2024

cc @lwasser as I know she was curious about this too

from contextily.

lwasser avatar lwasser commented on May 18, 2024

ahhh yes @choldgraf @darribas i played around with the zoom and that didn't fix the issue which is when i create a larger figure, the map is then pixelated. Is this user error on my end?

from contextily.

darribas avatar darribas commented on May 18, 2024

Mmm... not directly, the way contextily works, every tile has the same size (248x248 if memory serves well) and the zoom controls how many tiles are used for a given extent. I'm not sure how you'd fix that or if it relates to contextily or the tile provider. Have you seen a different library working, for instance ggmap in R?

from contextily.

jorisvandenbossche avatar jorisvandenbossche commented on May 18, 2024

I was looking into this a bit, and I think doing interpolation in imshow is the best we can get to somewhat solve the pixelated view (it does not solve that you actually might want a higher resolution at a given zoom level ..).

Small example, for Berlin at zoom level 10, the original version (if you only do plt.imshow(basemap, extent=extent)):

image

And with interpolation='bilinear':

image

Which gives a bit better result I think (but as I said, does not give a higher resolution image, only makes the current one a bit nicer).
I think this is also what ggmap does, from a quick view on their source code (but no expert on that)

from contextily.

choldgraf avatar choldgraf commented on May 18, 2024

Nice - that would make sense to me as well...I was wondering how ggmap would get a smoother result from the same underlying data

from contextily.

jorisvandenbossche avatar jorisvandenbossche commented on May 18, 2024

@choldgraf see also https://github.com/darribas/contextily/issues/20, if you have an opinion on that

from contextily.

ljwolf avatar ljwolf commented on May 18, 2024

playing around with all the methods, I think sinc interpolation gives a marginally sharper image, over bilinear, since it appears to strongly preserve contrast better:
2018-05-11-092940_1112x835_scrot
2018-05-11-092935_1093x831_scrot
But, this is messing at the margins, since interpolation='none' looks pixelated regardless of setting axes=equal.

from contextily.

lwasser avatar lwasser commented on May 18, 2024

Wow!! This is visually a lot nicer with the interpolation ! Happy to see this is being revisited. I still haven't looked closely at ggmap to understand how to works. Will this be implemented in contextily? If so I'll try it again for my course! Thank you all!

from contextily.

ljwolf avatar ljwolf commented on May 18, 2024

I think this would be what we set as defaults for #20

from contextily.

lwasser avatar lwasser commented on May 18, 2024

hi all! i'm revisiting this again as i'm working on my class - again. just curious how or whether this might become the default behaviour for contextily plotting. For now i'm happy with using imshow to interpolate. Look at the difference!

BEFORE interpolation
screen shot 2018-07-03 at 4 12 05 pm

after:
screen shot 2018-07-03 at 4 12 42 pm

it would be a nice default plotting behavior if not already implemented. But i do appreciate and thank you all for demonstrating how the maps can be cleaned up using the imshow args.

If this has been implemented please let me know and we can also close this issue :)

from contextily.

knaaptime avatar knaaptime commented on May 18, 2024

the interpolation is included as default in 4850849 but hasn't been merged/released

from contextily.

lwasser avatar lwasser commented on May 18, 2024

ok so install from github in the meantime as an alternative? Thank you @knaaptime ! This is a really nice fix.

from contextily.

lwasser avatar lwasser commented on May 18, 2024

got it! ok thank you @ljwolf i can also just teach them to use the interpolation arg for the time being as well. i really appreciate everyone's work on this!

from contextily.

lwasser avatar lwasser commented on May 18, 2024

oh wonderful. thank you for the update @darribas :) yay!

from contextily.

lwasser avatar lwasser commented on May 18, 2024

i know this is closed but just writing to thank you again @darribas :)

from contextily.

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.