Background
The integration of the mobile Internet of things and the Internet of things realizes that people flow analysis in tourist attractions is gradually and widely applied by utilizing multilayer technical means, realizes real-time statistics and monitoring of tourist flow in the attractions, is convenient for managers to manage, control and dredge the passenger flow, effectively avoids safety events, provides accurate, scientific, detailed and used tourist data and information service for tourism industry managers, and improves management and service levels of the tourism industry.
Although monitoring equipment and people stream alarm devices are also installed in part of scenic spots, effective real-time performance cannot be achieved, specific scenic spots in the scenic spots cannot be achieved, real-time statistics work of tourists is relatively delayed, and when the scenic spots in the scenic spots reach load values, managers cannot obtain emergency data at the first time, evacuation work is conducted on specific scenic spots in a targeted mode, and accordingly tourism experience of the tourists is influenced.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a scenic spot real-time load monitoring method and system which can provide overload short message early warning for scenic spots according to the maximum tourist bearing capacity of each scenic spot in the scenic spot and monitor real-time load states based on space-time big data.
The purpose of the invention is realized by the following technical scheme: a scenic spot real-time load monitoring method based on space-time big data comprises the following steps:
s1, obtaining the scenic spot passenger flow volume data by adopting the following two modes: firstly, based on a video analysis principle, carrying out tourist quantity statistics by adopting a head and shoulder recognition mode, and capturing the number of tourists in the current scenic spot; secondly, based on a WiFi mode, network information is covered in the scenic spot, and when the tourist is connected with open WiFi, the network information is counted to a database;
s2, carrying out scenic spot map partitioning;
s3, carrying out region division on the passenger flow data;
s4, referring to past real passenger flow data and a maximum load value of a scenic spot, setting a tourist current carrying upper limit label for each scenic spot of the scenic spot, recording the tourist current carrying upper limit label as tValue, setting a load threshold as 80% of the tourist current carrying upper limit, and simultaneously warehousing and storing;
s5, processing the passenger flow data obtained in the step S1, and judging whether the scenic spot passenger flow is overloaded or not;
and S6, displaying the current passenger flow information by adopting a scenic spot real-time passenger flow distribution density thermodynamic diagram based on the Baidu Echarts.
Further, the step S2 includes the following sub-steps:
s21, calculating longitude and latitude binary codes of the scenic spots: the longitude interval of the earth is [ -180,180], and the latitude interval is [ -90,90 ];
firstly, latitude codes are calculated: dividing the interval of [ -90,90] into two intervals of [ -90,0) and [0,90], judging the interval where the latitude of the scenic spot is located, recording the interval as 0 if the scenic spot is located in the left interval, and recording the interval as 1 if the scenic spot is located in the right interval;
continuously dividing the interval of the scenic spot into a left interval and a right interval, judging the interval of the latitude of the scenic spot, recording as 0 if the scenic spot is in the left interval, and recording as 1 if the scenic spot is in the right interval;
sequentially carrying out division and judgment operation on the intervals of the scenic spots to obtain eight-digit binary codes of the latitude of the scenic spots;
obtaining eight-digit binary codes of the longitudes of the scenic spots by adopting the same dividing and judging operations as latitude codes;
s22, generating a GeoHash code, recombining binary strings of longitude and latitude according to the rules of longitude on even digits and latitude on odd digits, and generating a 16-digit new binary code; then, converting the 16-bit binary code into a decimal value, and searching a corresponding base32 code to obtain a GeoHash code;
and S23, repeating the operations of the steps S21 and S22 to obtain the GeoHash code of each sight spot in the sight area.
Further, the step S3 includes the following sub-steps:
s31, dividing the real-time passenger flow data acquired in the step S1 according to the one-to-one correspondence of time and space: dividing the time data respectively in the forms of yyyy-MM-dd and hh: MM: ss to respectively obtain time character strings of year, month and day and time, minute and second character strings; performing GeoHash coding processing on the spatial data, judging whether the prefix of the GeoHash character string is the same as the GeoHash code of each scenic spot obtained in the step S2, and judging the same passenger flow data point to be located in the corresponding scenic spot;
and S32, recombining the processed year, month, day, hour, minute and second time character string and the GeoHash code according to the yyy-MM-dd + GeoHash code + hh: MM: ss form to obtain a plurality of rectangular areas.
Further, the specific implementation method of step S5 is as follows: the method adopts real-time passenger flow statistics based on Spark Streaming to process passenger flow volume data, and comprises the following specific steps:
s51, adding a staff list and storing the information of the managers in the scenic spot, wherein the managers are responsible for each scenic spot;
s52, adding a passenger flow number variable count and a weight variable weight for each sight spot, counting the count values of each batch of data in different sight spots, and calculating the weight value:
weight(i)=count(i)/(count(1)+count(2)+…+count(n))
i is 1,2, …, n, n represents the total number of sights;
s53, when the count (i) is more than or equal to tValue, namely when the passenger flow of the scenic spot i exceeds the set scenic spot passenger load threshold value, the tourist is not suitable to be accommodated, the database inquires the contact information of the scenic spot person in charge of the i, and sends a warning message to the scenic spot management personnel.
Further, the step S6 includes the following sub-steps:
s61, adopting the result flow obtained in the step S5 as a data source of the thermodynamic diagram; defining longitude and latitude as position information, weight as weight, wherein the data format of the thermodynamic diagram consists of (lat, lng, weight), lat represents latitude, and lng represents longitude;
s62, filling data on the map based on canvas;
s63, calculating the transparency value alpha of each data point on the map according to the weight value weight of each data point obtained in the step S5:
weight Min ═ alpha [0], weight Max ═ alpha [1], and the remaining alpha values are calculated as:
alpha[i]=(weight[i]-weight[min])/(weight[max]-weight[min]);
s64, calling a getImageData () method provided by canvas to obtain the gray value of each pixel point on the canvas, thereby obtaining the color of the corresponding position in the color ribbon.
The invention also discloses a scenic spot real-time load monitoring system based on the space-time big data, which comprises a data source acquisition module, a scenic spot data analysis module, a passenger flow load monitoring module and a result visualization module, wherein the scenic spot data analysis module comprises a scenic spot map division submodule and a passenger flow data division submodule;
the data source acquisition module is used for acquiring accurate GIS information of each scenic spot in the scenic spot by calling a third party API; obtaining GPS data of the tourists based on free WiFi provided by the scenic spot; based on a video analysis principle, acquiring the amount of tourists in a head and shoulder recognition mode;
the scenic spot map dividing submodule is used for optimizing the scenic spot GIS data: partitioning a map of a scenic spot according to positions of the scenic spots;
the passenger flow data division submodule is used for optimizing the tourist GPS data: carrying out region division on the tourist GPS data;
the passenger flow load monitoring module is used for adding a passenger flow threshold label to each scenic spot, comparing the current passenger flow with a threshold value, and sending out a warning when the passenger flow exceeds the threshold value; adding a scenic spot and scenic spot management personnel list, storing the contact information of each scenic spot principal, and contacting the scenic spot principal when a load warning occurs; adding a weight value to the passenger flow data passing through each scenic spot, and calculating the weight value in real time;
and the result visualization module is used for defining the data format of the thermodynamic diagram, filling data on the map based on canvas, calculating a corresponding transparent value alpha according to the weight of each data point, and then drawing the thermodynamic diagram on the map.
The invention has the beneficial effects that: the monitoring method can provide overload short message early warning for the scenic spots and monitor the load state in real time according to the maximum tourist bearing capacity of each scenic spot in the scenic spots. On one hand, under the condition that scenic spots bear overload, early warning short messages are issued to scenic spot management personnel to avoid scenic spot overload reception; on the other hand, by drawing a scenic spot number distribution map, the population density distribution and the tourist behavior characteristics of each scenic spot in different time periods in the scenic spot are mastered, the number of tourists in the scenic spot is predicted, and the workers can conveniently make overload measures of all scenic spots in advance.
Detailed Description
The technical scheme of the invention is further explained by combining the drawings and the specific embodiment.
As shown in fig. 1, the method for monitoring scenic spot real-time load based on space-time big data of the present invention includes the following steps:
s1, obtaining the scenic spot passenger flow volume data by adopting the following two modes: firstly, based on a video analysis principle (a passenger flow monitoring camera is arranged at a gate of a scenic spot and at the position of each scenic spot channel), carrying out tourist quantity statistics by adopting a head and shoulder identification mode, and capturing the number of tourists in the current scenic spot; secondly, based on a WiFi mode, network information is covered in the scenic spot, and when the tourist is connected with open WiFi, the network information is counted to a database;
s2, carrying out scenic spot map partitioning; the most intuitive way to inquire the number of individuals near a scenic spot is to look up a table in a database, calculate and inquire data within xx kilometers away from the scenic spot, screen out and return the data to a client. This approach requires the calculation of a relative distance for each entry in the entire table, which is time consuming. Therefore, the scenic region is considered to be divided into regions, so that even if the relative distance is calculated once for each piece of data in each region, it is calculated once more quickly than in the previous full table. The map partitioning process is a process of adding an index, a proper index is added to points on the map, the points can be sorted, and the method similar to binary search can be used for quickly inquiring and counting the passenger capacity of a scenic spot.
The method specifically comprises the following substeps:
s21, calculating longitude and latitude binary codes of the scenic spots: the longitude interval of the earth is [ -180,180], and the latitude interval is [ -90,90 ];
firstly, latitude codes are calculated: dividing the interval of [ -90,90] into two intervals of [ -90,0) and [0,90], judging the interval where the latitude of the scenic spot is located, recording the interval as 0 if the scenic spot is located in the left interval, and recording the interval as 1 if the scenic spot is located in the right interval;
continuously dividing the interval of the scenic spot into a left interval and a right interval, judging the interval of the latitude of the scenic spot, recording as 0 if the scenic spot is in the left interval, and recording as 1 if the scenic spot is in the right interval;
sequentially carrying out division and judgment operation on the intervals of the scenic spots to obtain eight-digit binary codes of the latitude of the scenic spots;
obtaining eight-digit binary codes of the longitudes of the scenic spots by adopting the same dividing and judging operations as latitude codes;
taking the Bifeng isthmic region of Yaan city, Sichuan as an example, the longitude of the Bifeng isthmic region is 116.413384, and the latitude is 39.910925. Dividing the interval between-90 and 90 into about-90 and 0 and 90, determining 39.910925 as right interval and marking as 1; dividing [0,90] into [0,45 ], and [45,90] into a left interval and a right interval, and determining 39.910925 as a left zone interval which is marked as 0; this process is recursed in turn, resulting in a binary result of dimension 10111000; similarly, the longitude binary code of the peck isthmus scene area is 11010110, as shown in table one.
Watch 1
S22, generating a GeoHash code, recombining binary strings of longitude and latitude according to the rules of longitude on even-numbered positions and latitude on odd-numbered positions, and generating a 16-bit new binary code: the binary code of the pecan isthmus is 1110011101101000; then, converting the 16-bit binary code into decimal values of 125278 respectively, and searching the corresponding base32 code to obtain the GeoHash code: 1tv 8;
and S23, repeating the operations of the steps S21 and S22 to obtain the GeoHash code of each sight spot in the sight area.
Each GeoHash character string respectively represents a rectangular area, all points in the rectangular area share the same GeoHash, and therefore passenger flow information can be inquired and counted by using prefix/suffix matching of the character strings.
S3, carrying out region division on the passenger flow data; after map division is carried out according to scenic spots based on scenic spots, region division is carried out on tourist GPS data, similarly, the dividing process is also a process of adding indexes, each index represents a small rectangular region, and a moving object located in the region is contained in the index. The invention improves the common spatial point index algorithm, divides the index structure into the forms of year, month and day, GeoHash coding and time, minute and second, can count passenger flow information according to specific scenic spots in scenic spots, and can obtain real-time people flow distribution information according to time, thereby achieving the purpose of subsequent real-time load monitoring. As shown in fig. 2, the method specifically includes the following sub-steps:
s31, dividing the real-time passenger flow data acquired in the step S1 according to the one-to-one correspondence of time and space: dividing the time data respectively in the forms of yyyy-MM-dd and hh: MM: ss to respectively obtain time character strings of year, month and day and time, minute and second character strings; performing GeoHash coding processing on the spatial data, judging whether the prefix of the GeoHash character string is the same as the GeoHash code of each scenic spot obtained in the step S2, and judging the same passenger flow data point to be located in the corresponding scenic spot;
and S32, recombining the processed year, month, day, hour, minute and second time character string and the GeoHash code according to the yyy-MM-dd + GeoHash code + hh: MM: ss form to obtain a plurality of rectangular areas. The method has the advantages that passenger flow information can be counted according to specific scenic spots in scenic spots, and real-time people flow distribution information can be obtained according to time, so that the purpose of follow-up real-time load monitoring is achieved.
S4, referring to past real passenger flow data and a maximum load value of a scenic spot, setting a tourist current carrying upper limit label for each scenic spot of the scenic spot, recording the tourist current carrying upper limit label as tValue, setting a load threshold as 80% of the tourist current carrying upper limit, and simultaneously warehousing and storing;
s5, processing the passenger flow data obtained in the step S1, and judging whether the scenic spot passenger flow is overloaded or not; the specific implementation method of S5 is as follows: real-time passenger flow statistics based on Spark Streaming is adopted to process passenger flow data, Spark Streaming is an extension of Spark core API, and high-throughput real-time flow data with a fault-tolerant mechanism can be processed. And continuously accessing the processed real-time passenger flow data into a Spark Streaming by batches through kafka, and then processing the real-time passenger flow data through a Spark engine to generate a result flow by batches. The method comprises the following specific steps:
s51, adding a staff list, and storing the information of the managers in the scenic spot, which is in charge of each scenic spot, including the mobile phone number or other contact ways;
s52, adding a passenger flow number variable count and a weight variable weight for each sight spot, counting the count values of each batch of data in different sight spots, and calculating the weight value:
weight(i)=count(i)/(count(1)+count(2)+…+count(n))
i is 1,2, …, n, n represents the total number of sights;
s53, when the count (i) is more than or equal to tValue, namely when the passenger flow of the scenic spot i exceeds the set scenic spot passenger load threshold value, the tourist is not suitable to be accommodated, the database inquires the contact way of the i scenic spot person in charge, and sends a warning message to the scenic spot management personnel (preferably, the warning message is informed in a short message mode, and the short message is sent to the management personnel by sending a Alry carp SDK through a third-party short message sending service).
S6, displaying current passenger flow information by adopting a scenic spot real-time passenger flow distribution density thermodynamic diagram based on Baidu Echarts; the thermodynamic diagram is a good way to show the passenger flow dynamics, and the implementation principle can be roughly summarized into the following steps: firstly, setting a circle with gradually changed gray scale from the center to the outside for each data point; secondly, calculating a gray value obtained by cross superposition of the data of each pixel point by utilizing the principle that the gray values can be superposed; and thirdly, performing color mapping in a color ribbon according to the gray value obtained by calculating each pixel, and finally coloring the image to obtain the heat flow graph. The invention draws a scenic spot passenger flow distribution thermodynamic diagram based on the Baidu Echarts. The method specifically comprises the following substeps:
s61, adopting the result flow obtained in the step S5 as a data source of the thermodynamic diagram; defining longitude and latitude as position information, weight as weight, wherein the data format of the thermodynamic diagram consists of (lat, lng, weight), lat represents latitude, and lng represents longitude;
s62, filling data on the map based on canvas;
s63, calculating the transparency value alpha of each data point on the map according to the weight value weight of each data point obtained in the step S5:
weight Min ═ alpha [0], weight Max ═ alpha [1], and the remaining alpha values are calculated as:
alpha[i]=(weight[i]-weight[min])/(weight[max]-weight[min]);
s64, calling a getImageData () method provided by canvas to obtain the gray value of each pixel point on the canvas, thereby obtaining the color of the corresponding position in the color ribbon.
In addition, because the invention carries out corresponding grid division on the scenic map when processing the data source, the grid operation is carried out on the data points when rendering the thermodynamic diagram, the rendering cost can be effectively reduced, and the display efficiency of the thermodynamic diagram is improved.
The invention also discloses a scenic spot real-time load monitoring system based on the space-time big data, which comprises a data source acquisition module, a scenic spot data analysis module, a passenger flow load monitoring module and a result visualization module, wherein the scenic spot data analysis module comprises a scenic spot map division submodule and a passenger flow data division submodule;
the data source acquisition module is used for acquiring accurate GIS information of each scenic spot in the scenic spot by calling a third party API; obtaining GPS data of the tourists based on free WiFi provided by the scenic spot; based on a video analysis principle, acquiring the amount of tourists in a head and shoulder recognition mode;
the scenic spot map dividing submodule is used for optimizing the scenic spot GIS data: partitioning a map of a scenic spot according to positions of the scenic spots;
the passenger flow data division submodule is used for optimizing the tourist GPS data: carrying out region division on the tourist GPS data;
the passenger flow load monitoring module is used for adding a passenger flow threshold label to each scenic spot, comparing the current passenger flow with a threshold value, and sending out a warning when the passenger flow exceeds the threshold value; adding a scenic spot and scenic spot management personnel list, storing the contact information of each scenic spot principal, and contacting the scenic spot principal when a load warning occurs; adding a weight value to the passenger flow data passing through each scenic spot, and calculating the weight value in real time;
and the result visualization module is used for defining the data format of the thermodynamic diagram, filling data on the map based on canvas, calculating a corresponding transparent value alpha according to the weight of each data point, and then drawing the thermodynamic diagram on the map.
As shown in fig. 3, the system structure of the present invention is mainly divided into three layers:
the lowest layer is a data acquisition layer which mainly acquires scenic spot geographic position data and tourist target position data. The main data sources are from WiFi probes and video surveillance. Based on the free WiFi provided by the scenic spot, the code of the mobile phone of the tourist is obtained through the probe in the network information covered in the scenic spot, each mobile phone has a unique MAC code, and the WiFi probe captures the code and counts. In addition, the data of the tourists is obtained in a video mode, a camera is installed at the entrance of each scenic spot in the scenic spot, and the number of the tourists in the current scenic spot channel is automatically captured.
The second layer is a data analysis layer which carries out optimization processing on the collected real-time data including scenic spot GIS data and tourist GPS data and mainly completes the functions of regional division of scenic spots, data access interaction, processing of passenger flow data and the like. And then the processed data is accessed into a passenger flow load monitoring module.
The third layer is a passenger flow load monitoring layer which mainly accesses the processed passenger flow data into a load monitoring module to complete the functions of real-time passenger flow statistics, overload warning and the like.
The fourth layer is a data display layer, and the data display layer is used for drawing population density distribution maps of scenic spots in different time periods of each scenic spot through a result stream obtained by the third layer based on a third-party tool Echarts.
It will be appreciated by those of ordinary skill in the art that the embodiments described herein are intended to assist the reader in understanding the principles of the invention and are to be construed as being without limitation to such specifically recited embodiments and examples. Those skilled in the art can make various other specific changes and combinations based on the teachings of the present invention without departing from the spirit of the invention, and these changes and combinations are within the scope of the invention.