In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to insert a basic map analysis library in python". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn "how to insert a basic map analysis class library in python"!
The most commonly used class library in python can use Basemap in mpl_toolkits.basemap. The data is the historical air quality data of Beijing. To use the existing vector data, draw a Beijing political district map on the map.
Vector data can be in shp or geojson format, in order to reduce the number of data files, transfer a geojson data, read data through fiona, reference fiona class library, read geojson data, you can see python development: feature data processing.
Import fiona
Shpdata = fiona.open (path,'r')
Refer to the class library of Basemap, cycle through the geojson data, draw the data on the map, according to the situation, get the coordinate information, use the plot function to draw the line, set the color and width of the line and other attributes, the data used is the polygon type, to traverse and draw each line.
Import matplotlib.pyplot as plt
From mpl_toolkits.basemap import Basemap as Basemap
Fig, ax = plt.subplots ()
M = Basemap (epsg=4326, resolution='l', llcrnrlat=bounds [1], urcrnrlat=bounds [3])
Llcrnrlon=bounds [0], urcrnrlon=bounds [2]) while True:
Try:
Evdata = shpdata.next ()
Evshape = evdata ['geometry'] [' coordinates']
For evls in evshape:
Xx, yy = zip (* evls)
M.plot (xx, yy, linewidth=1, color='black')
Sometimes when you need to draw annotation information on a map, you need to use shapely to calculate the center point of the area and draw notes on the map.
From shapely.geometry import shape, pointax.annotate (evdata ['properties'] [' NAME99'])
(X, Y), xytext= (- 10,5), textcoords='offset points')
Effect picture:
At this point, I believe you have a deeper understanding of "how to insert a basic map analysis library in python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.