Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I posted this on stackoverflow but got no answers so far, hope someone here could shed some light on it. In a nutshell, my tiles look ugly, for example:
Look at those pixelated text labels and overall poor resolution. I played with different zoom levels and different styles with no success.
When displaying the same map on google maps, I get the usual nicely rendered look:
I can change tile provider but results are similar:
It doesn't matter if I run the code on a Jupyter notebook or a python console or on a different machine, results are identical.
Full environment definition
macOS High Sierra 10.13.3 (17D47)
From the matplotlib documentation (for
Maybe I've got a slightly different use case in that I was primarily producing PDF files from matplotlib (on a Mac, using Homebrew Python installation) viewing the results with preview or notebook with inline svg.
Your example producing bitmap output (PNG) yes I get noticeable pixelation, there was some improvement using
I think it is down to
For reference, I've provided a link to the StackOverflow question.
For future readers who find this and who don't see the benefit from the interpolation keyword, it is probably because you are re-projecting the tiles into the target projection which is happening before matplotlib gets any influence on the scheme. There isn't a lot we can do with this, as cartopy is using a general 3d interpolation scheme in order to support the full diversity of the projections it can handle. Your best option for poor resolution cross projection map tiles is to change the resolution of the re-projection. A question about how to do this came up on StackOverflow not too long ago: [I can't currently find the link
To give a concrete example of this, take the following code:
If we simply add the
Instead, we also need to control how coarse/fine the target regridded image should be with the
Pardon the nagging: while the
There's three changes visible:
Could difference 3 be a case of regression?
I had a try at installing an earlier cartopy version to see if I could reproduce the 2015 example, but unfortunately, the earliest version on conda is 0.15.1 (which is also "not-crisp" by default). PyPI does have the earlier versions, but not surprisingly, installing a package from 2015 fails miserably. I'm not nearly familiar enough with the cartopy source to investigate from that direction...
Having good looking tiles is a really cool and convenient feature, so it might be worth another look?
The simple answer I think is that the default interpolation changed in matplotlib. I have some things lined up to improve the tiles interface further for v0.18 (interactive & auto zoom). Implementing a better interpolation scheme by default is going to be important for that functionality too.