Skip to content Skip to sidebar Skip to footer

How To Display A Image Over A Map With Imshow?

I have a geotif with 9 different colour values (0-9) and want to display it over a map. I'm trying to use it with basemap from the matplotlib package. from mpl_toolkits.basemap imp

Solution 1:

m.imshow(im, extent=extent, alpha=0.6)

Solution 2:

Using extent does not solve your problem! It creates a bigger problem because it looks to be ok but it is wrong.

The extent will work only for cylindrical projections and keeping distances. It just adjusts the image to some box, linearly! The mercator projection is not linear.

Try to use the projection 'cyl'. So, the answer is: there is no way for nonlinear transformations. The possible workaround is to convert the image coordinates to distances in the new projection and then 2d interpolation (matplotlib.tri, for instance) to some new rectangle (of distances).

Post a Comment for "How To Display A Image Over A Map With Imshow?"