में बहुभुज के रूप में प्राकृतिक पृथ्वी के आकार को साजिश करने के लिए पाइथन का उपयोग करना मैं चाहता हूं कि मानचित्र प्राप्त करने के करीब हूं। Matplotlib का Basemap बहुत अच्छा है, लेकिन जब मैं ज़ूम इन करता हूं तो तटीय रेखाएं बहुत मोटे हैं। मैं प्राकृतिक पृथ्वी आकार के चित्रों को पढ़ सकता हूं और उन्हें साजिश कर सकता हूं, जो बहुत बेहतर हैं ... लेकिन जब मैं बहुभुजों को आजमाता हूं और भरता हूं, तो मुझे लगता है कि यह सभी का इलाज कर रहा है एक बहुभुज से संबंधित अंक। मैं बहुभुज के माध्यम से कैसे पुन: प्रयास कर सकता हूं और मानचित्र को सही तरीके से प्रदर्शित कर सकता हूं?Matplotlib Basemap
अग्रिम धन्यवाद!
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
%matplotlib inline
landColor, coastColor, oceanColor, popColor, countyColor = '#eedd99','#93ccfa','#93ccfa','#ffee99','#aa9955'
fig = plt.figure()
ax = fig.add_subplot(111)
s = 1900000
m = Basemap(projection='ortho',lon_0=-86.5,lat_0=30.3,resolution='l',llcrnrx=-s,llcrnry=-s,urcrnrx=s,urcrnry=s)
m.drawmapboundary(fill_color=oceanColor) # fill in the ocean
# generic function for reading polygons from file and plotting them on the map. This works with Natural Earth shapes.
def drawShapesFromFile(filename,facecolor,edgecolor,m):
m.readshapefile(filename, 'temp', drawbounds = False)
patches = []
for info, shape in zip(m.temp_info, m.temp): patches.append(Polygon(np.array(shape), True))
ax.add_collection(PatchCollection(patches, facecolor=facecolor, edgecolor=edgecolor, linewidths=1))
# read the higher resolution Natural Earth coastline (land polygons) shapefile and display it as a series of polygons
drawShapesFromFile('\\Conda\\notebooks\\shapes\\ne_10m_coastline',landColor,coastColor,m)
drawShapesFromFile('\\Conda\\notebooks\\shapes\\ne_10m_urban_areas',popColor,'none',m)
m.drawcounties(color=countyColor)
plt.gcf().set_size_inches(10,10)
मैं इसे समझ से बाहर: सभी मैं करना था
ne_10m_land
इस तरह केne_10m_coastline
बदल गया था। मैं गलत इनपुट डेटा का उपयोग कर रहा था। मैंने भूमि डेटासेट के बजाय तटीय रेखा डेटासेट का उपयोग किया। उफ़। खैर, उम्मीद है कि उपरोक्त कोड सभी के लिए उपयोगी होगा। –आपको अपने स्वयं के फ़िक्स को उत्तर के रूप में पोस्ट करना चाहिए! – tmthydvnprt