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 easily make time rotation Map with Python+Kepler.gl

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "how to use Python+Kepler.gl to easily make time rotation map". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use Python+Kepler.gl to easily make time rotation map".

1 introduction

As a powerful open source geographic information data visualization tool, Kepler.gl can help us easily make visualization works for large-scale vector data, thus assisting data analysis.

It is very simple and convenient for Kepler.gl to make regular maps. You can get to usage with a little exploration of the dashboard interface, but some special maps require additional data processing or use some hidden features in Kepler.gl, such as the dynamic path map described in the previously written Python+Kepler.gl easy to create cool path animation. The "time rotation Map", which will be introduced in this article, is also a special map, which we will introduce with practical examples below.

2 Python+Kepler.gl production time rotation map 2.1 example: Uber passenger boarding and alighting information

Let's take the official boarding and alighting data of passengers in New York in 2015 provided by Uber as an example. Corresponding to the data.csv in the Github warehouse at the beginning of the article, about the environment configuration of Python+Kepler.gl, you can review the relevant content in the cool path animation easily created by Python+Kepler.gl.

First, let's read in the data.csv data:

Import pandas as pd

From keplergl import KeplerGl

Raw = pd.read_csv ('data.csv')

Raw.head ()

Figure 1

It should be noted that in addition to the necessary longitude and latitude information, our data contains data in tpep_pickup_datetime and tpep_dropoff_datetime date format, which is the key to making a date rotation map, that is, our data set must have corresponding time information for each row of data records.

When the data is ready, export the html file corresponding to Kepler.gl externally using the following code, because we manually adjust all the visual elements separately. Here, you only need to embed the target data into the html file:

Map1 = KeplerGl (height=800, data= {'layer1': raw}) # generate Kepler.gl web pages

Map1.save_to_html (file_name=' time carousel map example 1.htmlbroadcast, data= {'layer1': raw}) # Export web page

Open the previously exported html file externally, and the initial interface is shown in figure 2:

Figure 2

First, delete the sidebar Kepler.gl to automatically identify all the layers created, and then manually create the required layers, taking the OD line as an example:

Figure 3, figure 4.

Then adjust the appropriate visual elements according to the attributes of the data. This part depends on personal preferences. Skip the specific steps:

Figure 5

Next, to the most important step, open the filter panel in the upper left corner:

Figure 6

Click "Add Filter" and select the field you want to use as the information for the time rotation:

Figure 7

The time rotation unit appears in the lower right corner of the map:

Figure 8

You can set the time window span and playback speed in the time rotation part. Here is the effect I created, because the number of frames recorded in the motion picture should not be too high. It is much more fluent than in the motion picture, and you can also explore it on your own:

Figure 9

Thank you for reading, the above is the content of "how to use Python+Kepler.gl to easily make time rotation map". After the study of this article, I believe you have a deeper understanding of how to use Python+Kepler.gl to easily make time rotation map, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report