Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mpl_toolkits.basemap
#1
Hello everyone,
I hope everything is very good.
I am reading the shapefile and creating a map with the help of mpl_toolkits.basemap library. In this file, there are many polygons with city boundaries, but also city names. I had the polygons drawn, but I could not overwrite the city names. How can I do this, can you please help?

I want to include scales in the map. Do you get the following error while doing this?
"ValueError: cannot draw map scale for projection='cyl'"

m = Basemap(projection='cyl', llcrnrlat=39.2872, llcrnrlon=26.4942, urcrnrlat=41.8215, urcrnrlon=30.1232, resolution='h')
m.drawcoastlines(linewidth=.5, color='#666666')
m.drawcountries(linewidth=1, color='#990000')
m.drawparallels(np.arange(32, 45, 1), labels=[1, 0, 0, 0], linewidth=0.05)
m.fillcontinents(color='#FFFFFF', lake_color='lightblue')
m.drawmapboundary(fill_color='lightblue')
m.drawmeridians(np.arange(23, 48, 1), labels=[0, 0, 0, 1], linewidth=0.05)
m.readshapefile(myshp, 'Watersheds', linewidth=1, default_encoding='latin-1', color='#CC3300')
m.readshapefile(shapefile=city_shp, name='Watersheds', linewidth=0.2, default_encoding='latin-1', color='#808080')

m.drawmapscale(lon=23, lat=32, lon0=48, lat0=45, units='km', length=100, barstyle='fancy', labelstyle='simple')
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python basemap, cant show the right coordinates dbsr 0 969 Jun-08-2022, 01:55 PM
Last Post: dbsr
Thumbs Up mpl_toolkits rf_kartal 0 2,139 Sep-21-2021, 12:10 PM
Last Post: rf_kartal
  Why is mpl_toolkits loaded? Gribouillis 1 1,621 Jan-30-2021, 08:39 PM
Last Post: Serafim
  readshapefile function in basemap - confusion regarding arguments sendiptangshu 1 2,538 Mar-09-2019, 09:29 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020