Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Map Visualization with Python

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "Python how to achieve Map Visualization", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Python how to achieve Map Visualization" article.

A brief introduction to folium

Use Python to process the data, and then use Folium to visualize it on Leaflet maps. Folium can easily visualize the data processed by Python on interactive Leaflet maps. It can not only display the distribution map of the data on the map, but also use Vincent/Vega to mark it on the map.

This open source library contains many built-in map elements from OpenStreetMap, MapQuestOpen, MapQuestOpen Aerial, Mapbox and Stamen, and supports customizing personalized map elements using Mapbox or Cloudmade's API key. Folium supports the overlay of GeoJSON and TopoJSON file formats, you can also connect data to the overlay layer of both file formats, and finally you can create a distribution map using the color-brewer color scheme.

Folium allows you to use Python's powerful ecosystem to process data and then display it with Leaflet maps. Folium has built-in some map elements (tilesets) from OpenStreetMap, MapQuest Open, MapQuest Open Aerial, Mapbox, and Stamen, and supports customization of map elements with Mapbox or Cloudmade API keys. Folium supports GeoJSON and TopJSON overlay (overlays), binding data to create a hierarchical statistical chart (Choropleth map). However, when the Folium library draws a heat map, it needs to be networked before it can be displayed.

1. Install folium module pip install folium2. Install jupyterpip install jupyter

It is easy to view the map

3. View the world map import foliumm = folium.Map () # display map M4. View the map of China import foliumm = folium.Map (location= [30100], zoom_start=3) m

Location longitude and latitude, list or tuple format, latitude (latitude), longitude (longitude)

Zoom_start scaling value. The default is 10. The larger the value, the smaller the scale, and the greater the magnification level of the map.

Tiles display style. The default is * 'OpenStreetMap'*, which turns on street display.

Crs Geographic coordinate reference system, default is "EPSG3857"

5. Map of Wuhan m = folium.Map (location= [30.6114.4], zoom_start=8) # Map of Wuhan

Modify the styl

M = folium.Map (location= [30.6114.4], zoom_start=8,tiles='Stamen Toner') m = folium.Map (location= [30.6114.4], zoom_start=8,tiles='Stamen Terrain') 6. Add tag import foliumwuhan_map = folium.Map (location= [30.6114.4], zoom_start=8) # add tag folium.Marker (location= [30.6114.3], # position popup='Wu Han City Marker', # mouse click pop-up description icon=folium.Icon (icon='cloud') # icon style). Add_to (wuhan_map) folium.Marker (location= [30.6114.33], popup='Timberline Lodge' Icon=folium.Icon (color='green'). Add_to (wuhan_map) folium.Marker (location= [30.6114.35], popup='Some Other Location', icon=folium.Icon (color='red', icon='info-sign')). Add_to (wuhan_map) folium.Circle (# add circle radius=200, location= (30.6114.32), popup='The Waterfront', color='crimson', fill=False ). Add_to (wuhan_map) folium.CircleMarker (# add blue circle location= (30.6114.37), radius=50, popup='Laurelhurst Park', color='#3186cc', fill=True, fill_color='#3186cc'). Add_to (wuhan_map) # longitude and latitude of the acquisition point # wuhan_map.add_child (folium.LatLngPopup ()) # dynamic tagging wuhan_map.add_child (folium.ClickForMarker (popup='Waypoint')) 7. Find the longitude and latitude of Wuhan University of Science and Technology import foliumposition = [30.4415, 114.2628] # school_mp = folium.Map (location=position,zoom_start=15) school_mp8. Unresolved

Pop-up pop_up shows that the picture will not.

The above is about the content of this article on "how to achieve map visualization in Python". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report