0

I'm trying to add a zoom variable to the following code to increase / decrease the zoom (scale) of the map this code produces:

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
latitudes = [24.49522]
longitudes = [46.5057713]

# Create a new Basemap instance with the desired map projection
m = Basemap(projection='merc', lat_0=0, lon_0=0, resolution='h',
            area_thresh=1000.0, llcrnrlon=min(longitudes)-1, llcrnrlat=min(latitudes)-1,
            urcrnrlon=max(longitudes)+1, urcrnrlat=max(latitudes)+1, epsg=4326)

# Set the map type to satellite view
m.arcgisimage(epsg=4326, xpixels=1000, verbose=False)

# Plot the coordinates on the map
x, y = m(longitudes, latitudes)
m.plot(x, y, 'ro', markersize=20)

# Add a custom scale bar to the map
#plt.text(0.5, -0.05, 'Scale: 10 km', ha='center', va='bottom', transform=plt.gca().transAxes)

# Set the title of the map
#plt.title('Map of One Coordinate')

# Save the map as a JPEG file
plt.savefig('map.jpg', dpi=300

I've tried adding this:

mpl.rcParams['figure.figsize'] = (x, y)

But it seems to just increase the size of the image rather than the scale / level of zoom

2
  • Use map extents (specified by llcrnrlon, llcrnrlat, urcrnrlon, urcrnrlat) to get different zoom/scsle_level of image. Figsize does nothing about zoom level of map data. Commented Apr 1, 2023 at 5:19
  • Cand find what you are looking for here: stackoverflow.com/questions/47271039/… Commented May 17, 2023 at 19:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.