GithubHelp home page GithubHelp logo

Comments (1)

fmaussion avatar fmaussion commented on June 14, 2024

Thanks for raising this! The documentation could be more informative indeed.

Are you referring to the fact that the google map doesn't fit exactly the provided extent? If so, I'm afraid there is no simple solution: it is a limitation of the static google maps API which only has a finite number of zoom levels. GoogleVisibleMap chooses the highest zoom level guaranteed to cover the provided extent.

The simplest workaround (but requiring trial and error) is to play with the size_* kwarg:

from salem import GoogleVisibleMap, Map
import matplotlib.pyplot as plt

mapextent = [-82, -65, 17, 31] # W, E, S, N

g = GoogleVisibleMap(x=[mapextent[0], mapextent[1]], y=[mapextent[2], mapextent[3]],
                     scale=2,  # this provides a higher resolution ggl image but takes longer to download
                     size_x=200, size_y=200,  # this makes the map smaller starting from its centre
                    )
ggl_img = g.get_vardata()

fig, ax = plt.subplots(1, 1, figsize=(12,8))
sm = Map(g.grid, factor=1)  # factor=1 is nicer here because it prevents image resizing
sm.set_rgb(ggl_img)
sm.visualize(ax=ax)

Another possibility would be to add an "ExactGoogleVisibleMap" which would do this size_* picking for us. I can consider adding this to salem, but it might not be trivial.

from salem.

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.