当前位置:网站首页>Recommend a cool geospatial data visualization tool with low code
Recommend a cool geospatial data visualization tool with low code
2022-07-04 11:32:00 【The way of several people】
The way of several original articles , Please contact us for reprint
In the open source geospatial information data visualization tool , Most of them need a certain programming foundation and skills to use . And today I want to introduce this tool , You don't need any programming foundation , Visualization of geospatial data can be realized , And the effect is very cool .
This one is called kepler.gl Open source tools for , Is based on Uber Big data visualization open source project deck.gl Created , Depending on WebGL Powerful graphics rendering capabilities , Large scale data sets can be easily displayed in various forms on the browser side .
adopt kepler.gl oriented Python Open interface package keplergl, We can do it in Jupyter Notebook/Lab By writing simple Python The way code passes in data of various formats , Embedded in it Notebook/Lab In the interactive window, it uses many kinds of rich spatial data visualization functions built in it . You can also directly use the demo Tools , Configure the visualization directly after importing data .
/ Use on the official website /
This method of use does not require writing any code , Visualization of geospatial data can be realized !
Visit the following official website address directly :
https://kepler.gl/demo
Upload data files ( Supported formats are CSV, Json, GeoJSON) After that, the visualization configuration and output of geospatial data can be carried out online ( The configuration operation of each function will be introduced in detail below ).
/ stay Jupyter Use in /
This method needs to be in anaconda Install in Python Of keplergl Module library , And pass Jupyter Notebook/Lab The interactive window of .
1
Prepare before use
It needs to be installed before use keplergl Of Python Library and its related dependent packages .
1.1
install keplergl modular
stay Anaconda Prompt Enter the following command in the tool to install keplergl modular , Relevant dependent packages will be automatically downloaded and installed :
conda install -c conda-forge keplergl
Because there are many dependent packages , The installation needs to wait for some time .
1.2
install jupyter labextension
If you use JupyterLab, You also need to install an extension , stay Anaconda Prompt Enter the following command in the tool to install :
jupyter labextension install @jupyter-widgets/jupyterlab-manager keplergl-jupyter
After installation , restart Anaconda, And on again JupyterLab You can use .
2
Initialize the map form
Instantiate a KeplerGl() object , View the initialized map object operation window .
【 Parameter Introduction 】
KeplerGl() Parameters of :
- height:int type , The height of the displayed map form , The default is 400px
- data:dict type , Dictionary data set in the incoming map
- config:dict type , Map parameter configuration information
- show_docs:bool type , Set whether to display the address of the user guidance document , The default is True, It shows
【 Code 】
from keplergl import KeplerGl # Load the initialization map form map_a = KeplerGl(height=800, show_docs=False) map_a
【 result 】
appear kepler.gl Initialize the map operation window , Click the small arrow in the upper left corner to expand a feature rich configuration panel :
chart 2-1:kepler.gl Initialize the map form
This function panel is used for visual configuration , It will be introduced in detail below .
3
Load geographic data file
kepler.gl Support 4 Data formats , Namely :CSV, GeoJSON, DataFrame, GeoDataFrame. Some geographic data visualization types only support GeoJSON Formatted data .
kepler.gl Would be right csv Infer the field type of the formatted file , Therefore, you must add the corresponding lat、lng part , There are three formats :
- <name>_lat, <name>_lng
- <name>_lat, <name>_lon
- <name>_latitude, <name>_longitude
among <name> Is the optional variable name . If you do not name the longitude and latitude field name in this format , The imported data cannot be automatically recognized as possible graphic objects , Manual selection is required .
We use 《 After the eruption of Tonga volcano , Analyze the global volcanic distribution , The most volcanoes are found here !》 Volcano data set downloaded from csv file , adopt Pandas The module reads the data and stores it DataFrame in , And then use it keplergl Library add_data() Method to load the data information into the map layer .
【 Parameter Introduction 】
add_data() Parameters of :
- data: Data set in the incoming map , It can be CSV, GeoJSON, DataFrame
- name: The name displayed in the incoming layer of the dataset
【 Code 】
import pandas as pd # Read in the data file df = pd.read_csv("volcano_keplergl.csv",encoding='ANSI') # Create a new map form , And load geographic data map_b = KeplerGl(height=800, show_docs=False) map_b.add_data(data=df, name="volcano") map_b
【 result 】
chart 3-1: Load geographic data information to kepler.gl In the map
After the geographic data information is loaded into the map , By default, the most appropriate data layer visualization type will be selected to display its geographical location .
4
Geospatial data visualization configuration
And pyecharts, matplotlib, folium And other visualization libraries are configured in different ways , stay kepler.gl There is no need to write colors 、 Icon 、 style 、 Trigger event and other parameter configuration codes , You only need to perform visual configuration operations in the function panel on the page , The configured parameters can be reused , Really realize the use of low code .
The following describes the configuration operations of some common functions .
4.1
Layers( Layers ) function
Data display layer , Above the underlying map layer . Used to set after importing data , The style of data layer display . Multiple sets of data can be displayed by layer superposition , You can also create new layers by yourself .
There are as many data layers 40+ Two color schemes are available ( Each color scheme will be based on the selected steps Adjust the quantity accordingly ), You can also customize the configuration ; You can set the reference field of color matching ( I'm going to set it to region)、 transparency :
chart 4-1-1: Set up kepler.gl Data layer color scheme
You can configure the type of visualization for each data layer , Different types can set different contents . For example, for punctuation type, you can set the radius of the marked point 、 Outline, line color, etc ; Path type can set the thickness of path lines 、 Altitude ratio, etc :
chart 4-1-2: Set up kepler.gl Data layer visualization type
Arc and Line Path visualization can display path information on the map , The premise is that there are two groups of longitude and latitude coordinate data , That is, the starting point coordinate and the ending point coordinate :
chart 4-1-3:kepler.gl The path information is displayed on the map
Some visualization types ( Such as Hexbin, Cluster) You can also pass the height ( At an altitude of ) data , Draw out 3D Data map :
chart 4-1-4:kepler.gl draw 3D Data map example 1
chart 4-1-5:kepler.gl draw 3D Example 2 of data map
chart 4-1-6:kepler.gl draw 3D Example 3 of data map
chart 4-1-7:kepler.gl draw 3D Example 4 of data map
【 actual combat 】
Add the second group of longitude and latitude data to the original volcanic data set , Realize the function of displaying path information .
chart 4-1-8:kepler.gl Display path information actual battle
Because the added second group of endpoint coordinate data is randomly generated , So the path is messy 、 No rules , You can use more real data to realize path display .
4.2
Filters ( filter ) function
To filter the data in the layer .
Numerical data , The range of values can be selected ; String data , You can filter by selecting the corresponding value ; Time data , You can add a timeline , Cooperate with path information , It can also realize the animation of time rotation path .
chart 4-2-1:kepler.gl Layer data filtering
chart 4-2-2:kepler.gl Realize the animation of time rotation path
【 actual combat 】
On the basis of adding the second group of longitude and latitude data to the original volcanic data set , Then add the time information , Pass time filter condition , Realize the animation function of time rotation path .
chart 4-2-3:kepler.gl Add time filtering conditions to the data layer
chart 4-2-4:kepler.gl Realize the Animation Practice of time rotation path
After adding the filter conditions of the time type field in the data layer , The layer will automatically generate the rotation timeline , Click the play button to generate path information in chronological order for rotation . It can be applied to travel 、 logistics 、 Routes and other big data display .
4.3
Interaction( Interaction ) function
Set the interactive data information that triggers the event .
You can set the data information content displayed on the target , Set whether to display longitude and latitude coordinate information , Set whether to allow location search through geographic encoder .
chart 4-3-1: Set up kepler.gl Trigger event interaction information
Here, hover is set to display the name of the volcano 、 type 、 The year of the last eruption 、 Country 、 Area and longitude and latitude coordinate information , Allow location search via geocoder .
4.4
Base map( Base map ) function
Set the style of the underlying map and the layer order and layer content of the underlying map .
There are currently five map styles to choose from , You can also specify external or customized map styles ; You can set the display content and order of map layers . in addition 3D The map can also set the color of buildings .
chart 4-4-1:kepler.gl Bottom map style and layer settings
There are many interesting configurations in each function , You can explore .
5
Get map configuration information
adopt .config You can get all the configuration information in the current map , And json Format returns the result . extracted config Parameters , You can directly pass it into its layer when initializing another new form , To reuse to other geographic data .
【 Code 】
# Display layer configuration information map_b.config # Initialize new form , And import data and map_b Configuration information map_c = KeplerGl(height=800, data={"volcano_new": df}, config=map_b.config, show_docs=False) map_c
【 result 】
chart 5-1: Output kepler.gl Layer configuration parameter information
chart 5-2: Reuse data and layer configuration information into new layers
Volcanic data sets and map_b The layer configuration parameter information of was successfully imported into the new layer .
6
Export map files for visual configuration
adopt kepler.gl Of .save_to_html() Method , The visualization results of geospatial data can be generated html file , Further configuration and use .
【 Parameter Introduction 】
.save_to_html() Parameters of :
- data:dict type , Geographic data , If it is blank, the geographic data in the current map will be used
- config:dict type , Map configuration information , If it is empty, the current configuration in the map will be used
- file_name:str type , Exported file name , The default is keplergl_map.html
- read_only:bool type , Set whether the exported file hides the configuration panel , The default is Fasle, That is, it supports configuration
【 Code 】
# Export geospatial data visualization map file map_c.save_to_html(file_name="volcano_keplergl_map.html")
【 result 】
chart 6-1: Derived kepler.gl Map file
Next close Jupyter, Find the exported... In the working directory html Open the file directly , Then you can do it in the browser ( Happy ) The reason is ( Yue ) Count ( huan ) According to the ( fast ) Visual operation of ( play ) do ( Play ) 了 .
边栏推荐
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
- Summary of Shanghai Jiaotong University postgraduate entrance examination module -- cryptography
- 守护进程Xinted和日志记录Syslogd
- SSH原理和公钥认证
- QQ group administrators
- Elevator dispatching (pairing project) ③
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 9
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 12
- VPS安装Virtualmin面板
- Summary of collection: (to be updated)
猜你喜欢
OSI seven layer model & unit
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
Canoe - the second simulation engineering - xvehicle - 2 panel design (operation)
Elevator dispatching (pairing project) ③
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22
Fundamentals of software testing
Oracle11g | getting started with database. It's enough to read this 10000 word analysis
netstat
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
随机推荐
netstat
2021 annual summary - it seems that I have done everything except studying hard
Canoe: the fourth simulation project -- bug debugging experience
How do std:: function and function pointer assign values to each other
VPS installation virtualmin panel
Btrace tells you how to debug online without restarting the JVM
Is Sanli futures safe? How to open a futures account? How to reduce the handling charge of futures at present?
QQ get group member operation time
VPS安装Virtualmin面板
Understanding of object
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
Function introduction of canbedded component
Xiaobing · beauty appraisal
Local MySQL forgot the password modification method (Windows)
Canoe test: two ways to create CAPL test module
Canoe-the second simulation project-xvehicle-1 bus database design (idea)
LxC shared directory permission configuration
Function parameters (positional parameters, default value parameters, variable parameters, named keyword parameters, keyword parameters)
Postman advanced
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14