WO2022126774A1 - 基于数据库实时定位生成轨迹的方法、系统、设备及介质 - Google Patents

基于数据库实时定位生成轨迹的方法、系统、设备及介质 Download PDF

Info

Publication number
WO2022126774A1
WO2022126774A1 PCT/CN2020/141743 CN2020141743W WO2022126774A1 WO 2022126774 A1 WO2022126774 A1 WO 2022126774A1 CN 2020141743 W CN2020141743 W CN 2020141743W WO 2022126774 A1 WO2022126774 A1 WO 2022126774A1
Authority
WO
WIPO (PCT)
Prior art keywords
data table
positioning information
data
database
dimensional array
Prior art date
Application number
PCT/CN2020/141743
Other languages
English (en)
French (fr)
Inventor
陈喜灿
Original Assignee
威创集团股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 威创集团股份有限公司 filed Critical 威创集团股份有限公司
Publication of WO2022126774A1 publication Critical patent/WO2022126774A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating

Definitions

  • the present application relates to the field of computer data processing, and more particularly, to a method, system, device and medium for generating a trajectory based on real-time positioning based on a database.
  • the track splicing of the background system is not separated, which may cause the business system to process too much content, the back-end server runs slowly and freezes, and there are downtimes. In severe cases, the background may also be caused. crash, and for a system without real background processing logic, it is necessary to rebuild the background and server, which is very troublesome to operate, which brings huge difficulties to the implementation of specific work.
  • the present application aims to overcome at least one of the above-mentioned defects (deficiencies) of the prior art, and provides a method, system, device and medium for generating a trajectory based on database real-time positioning, which is used to solve the problem of high running pressure and stuck when the background server splices the trajectory table.
  • the technical solution adopted in this application is a method for generating a trajectory based on database real-time positioning, comprising the following steps:
  • the data collector collects and stores the positioning information of several users and stores it in the data table B;
  • the data collector again collects and stores the latest positioning information of several users and stores it in the data table A;
  • the timer of the database compares whether the positioning information in data table B is the same as that in data table A. If so, update the positioning information in data table B to the positioning information in data table A. If not, create a new data table C in the database. , the positioning information in the data table B and the positioning information in the data table A are sequentially spliced into a two-dimensional array, and stored in the data table C;
  • two new data tables A and B are created in the database to store information data
  • the data collector of the database is used to collect and store the positioning information of several users and store them in data table B, and then collect the positioning information and store them in data table A again.
  • the timer of the database uses the timer of the database to compare whether the positioning information in the data table B is the same as the positioning information in the data table A, that is, to compare whether the last positioning information of the user is the same as the latest positioning information.
  • the positioning information in the data table B is the same as the positioning information in the data table A, it means that the position of the user at the time of the two data collection has not changed, that is, there is no movement track, then the positioning information in the data table B is updated as Positioning information in Data Sheet A.
  • the positioning information in data table B is the same as the positioning information in data table A, it means that the user's position has changed at these two moments, that is, there is a movement track, so it is necessary to create a new data table C in the database, and then The positioning information in data table B and the positioning information in data table A are sequentially spliced into a two-dimensional array, which is stored in data table C.
  • the primary key in the data table of the database is a unique identifier that can determine a record and can be used to ensure data integrity. Therefore, the primary key can be used to distinguish different users. For example, unique identification fields such as the ID number of each user can be set as the primary key. field, which is convenient to query the trajectory information of each user according to the primary key.
  • This application directly uses the database to directly generate the trajectory table through real-time positioning information, and does not require background support. When the amount of data is huge and the background logic is complex, the database can share part of the pressure, reducing the slow running of the background due to the excessive amount of data. Machines and other phenomena, and for projects without a background, there is no need to build a background and a server.
  • the method further includes the following steps before querying the primary key of the data table C to obtain a two-dimensional array and obtaining the track:
  • the timer judges whether the positioning information in data table A is the last element in the two-dimensional array in data table C, if so, update the positioning information in data table B to the positioning information in data table A, and return to the data collector to collect and collect again.
  • this step it is judged whether the positioning information in data table A is the last element in the two-dimensional array in data table C, in order to judge whether the previous steps are executed correctly, only the previous steps are executed correctly, the positioning information in data table A will be Appears in the last element of the two-dimensional array in data table C, because in the previous step, the positioning information in data table B and the positioning information in data table A are sequentially spliced into a two-dimensional array, when it is judged that in data table A After the positioning information is the last element in the two-dimensional array in the data table C, update the positioning information in the data table B to the positioning information in the data table A, and then return to the step: the data collector collects and stores the latest positioning information of several users again.
  • Saving data table A is equivalent to completing the real-time update of the positioning information of data table A and data table B, so that the positioning information at multiple times can be continuously updated, and the trajectories can be formed by continuous splicing.
  • the positioning information in data table A is not the last element in the two-dimensional array in data table C, it means that the previous step was executed incorrectly, then re-judg whether the positioning information in data table B is the same as the positioning information in data table A, and re-splicing and so on, until the latest positioning information appears in the last element of the two-dimensional array.
  • the primary key field definitions of the data table A and data table B are the same as the data table C.
  • the data collected in the database needs to be stored in a data table, and it is also convenient to update and iterate the data later.
  • Multiple data tables are used to store positioning information separately, which is convenient for data sorting.
  • the primary key fields of data table A and data table B are defined and C is the same, it is to facilitate the database to extract data through the same primary key for processing.
  • the positioning information in the data table B and the positioning information in the data table A are sequentially spliced into a two-dimensional array, wherein the two-dimensional array is spliced in the form of splicing strings.
  • the trajectory can be obtained clearly and clearly through the two-dimensional array, and other complex conversions can be avoided.
  • the data with the same primary key in data tables A and B are sequentially spliced into a two-dimensional array to form a piece of data, which can greatly reduce the amount of data in database C and greatly improve the query speed.
  • the positioning information is longitude and latitude information.
  • the positioning information adopts longitude and latitude information, with high accuracy and uniform data format.
  • timer of the database runs synchronously with the data collector.
  • the timer and data collector run at the same time, which can ensure the accuracy and real-time of data collection.
  • Another technical solution adopted in this application is a system for generating a trajectory based on database real-time positioning, including:
  • the table building module is used to generate data tables A, B, and C in the database;
  • the data acquisition module is used to collect and store the positioning information of each user twice, the latest positioning information is stored in data table A, and the last positioning information is stored in data table B;
  • the update module is used to update the positioning information in the data table B to the positioning information in the data table A;
  • the comparison module is used to compare whether the positioning information in the data table B is the same as the positioning information in the data table A. If so, update the positioning information in the data table B to the positioning information in the data table A through the update module.
  • the table module creates a new data table C, and then the positioning information in the data table B and the positioning information in the data table A are sequentially spliced into a two-dimensional array through the splicing module, and stored in the data table C;
  • the splicing module is used to sequentially splicing the positioning information in the data table B and the positioning information in the data table A into a two-dimensional array when the positioning information in the data table B is different from the positioning information in the data table A, and store it in the data table C ;
  • the query module is used to query the primary key of the data table C to obtain a two-dimensional array and obtain the track.
  • a judgment module for judgment module, for judging whether the positioning information in the data table A is the last element of the two-dimensional array in the data table C, if so, then update the positioning information in the data table B by updating the module update.
  • the positioning information is collected and stored in the data table A through the data acquisition module. If not, the comparison module is used to compare whether the positioning information in the data table B is the same as the positioning information in the data table A.
  • a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned real-time location generation based on a database when the processor executes the computer program The steps of the method of the trajectory.
  • Another technical solution adopted by the present application is a storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the above-mentioned method for generating a trajectory based on real-time positioning based on a database.
  • the beneficial effects of the present application are as follows: the present application directly uses the database to directly generate the trajectory table through real-time positioning information, and does not require background support.
  • the database can share part of the pressure, It reduces the phenomenon of slow running, stalling and downtime caused by too much data in the background.
  • the positioning information is sequentially spliced into a two-dimensional array to form a trajectory, which reduces the amount of data in the database, reduces the pressure on the database, and greatly improves the speed of query.
  • FIG. 1 is a flow chart of the method of Embodiment 1 of the present application.
  • FIG. 2 is a schematic diagram of a system structure of Embodiment 2 of the present application.
  • table building module 1 data acquisition module 2 , update module 3 , comparison module 4 , splicing module 5 , query module 6 , and judgment module 7 .
  • the technical solution provided by this embodiment is a method for generating a trajectory based on database real-time positioning, comprising the following steps:
  • the data collector collects and stores the positioning information of several users and stores it in the data table B;
  • the data collector again collects and stores the latest positioning information of several users and stores it in the data table A;
  • the timer of the database compares whether the positioning information in data table B is the same as that in data table A. If so, update the positioning information in data table B to the positioning information in data table A. If not, create a new data table C in the database. , the positioning information in the data table B and the positioning information in the data table A are sequentially spliced into a two-dimensional array, and stored in the data table C;
  • two new data tables A and B are created in the database to store information data
  • the data collector of the database is used to collect and store the positioning information of several users and store them in data table B, and then collect the positioning information and store them in data table A again.
  • the timer of the database uses the timer of the database to compare whether the positioning information in the data table B is the same as the positioning information in the data table A, that is, to compare whether the last positioning information of the user is the same as the latest positioning information.
  • the positioning information in the data table B is the same as the positioning information in the data table A, it means that the position of the user at the time of the two data collection has not changed, that is, there is no movement track, then the positioning information in the data table B is updated as Positioning information in Data Sheet A.
  • the positioning information in data table B is the same as the positioning information in data table A, it means that the user's position has changed at these two moments, that is, there is a movement track, so it is necessary to create a new data table C in the database, and then The positioning information in data table B and the positioning information in data table A are sequentially spliced into a two-dimensional array, which is stored in data table C.
  • the primary key in the data table of the database is a unique identifier that can determine a record and can be used to ensure data integrity. Therefore, the primary key can be used to distinguish different users. For example, unique identification fields such as the ID number of each user can be set as the primary key. field, which is convenient to query the trajectory information of each user according to the primary key.
  • This application directly uses the database to directly generate the trajectory table through real-time positioning information, and does not require background support. When the amount of data is huge and the background logic is complex, the database can share part of the pressure, reducing the slow running of the background due to the excessive amount of data. Machines and other phenomena, and for projects without a background, there is no need to build a background and a server.
  • the method further includes the following steps before querying the primary key of the data table C to obtain a two-dimensional array and obtaining the track:
  • the timer judges whether the positioning information in data table A is the last element in the two-dimensional array in data table C, if so, update the positioning information in data table B to the positioning information in data table A, and return to the data collector to collect and collect again.
  • this step it is judged whether the positioning information in data table A is the last element in the two-dimensional array in data table C, in order to judge whether the previous steps are executed correctly, only the previous steps are executed correctly, the positioning information in data table A will be Appears in the last element of the two-dimensional array in data table C, because in the previous step, the positioning information in data table B and the positioning information in data table A are sequentially spliced into a two-dimensional array, when it is judged that in data table A After the positioning information is the last element in the two-dimensional array in the data table C, update the positioning information in the data table B to the positioning information in the data table A, and then return to the step: the data collector collects and stores the latest positioning information of several users again.
  • Saving data table A is equivalent to completing the real-time update of the positioning information of data table A and data table B, so that the positioning information at multiple times can be continuously updated, and the trajectories can be formed by continuous splicing.
  • the positioning information in data table A is not the last element in the two-dimensional array in data table C, it means that the previous step was executed incorrectly, then re-judg whether the positioning information in data table B is the same as the positioning information in data table A, and re-splicing and so on, until the latest positioning information appears in the last element of the two-dimensional array.
  • the primary key field definitions of the data table A and data table B are the same as the data table C.
  • the data collected in the database needs to be stored in a data table, and it is also convenient to update and iterate the data later. Multiple data tables are used to store positioning information separately, which is convenient for data sorting.
  • the primary key fields of data table A and data table B are defined and C is the same, it is to facilitate the database to extract data through the same primary key for processing.
  • the positioning information in the data table B and the positioning information in the data table A are sequentially spliced into a two-dimensional array, wherein the two-dimensional array is spliced in the form of splicing strings.
  • the trajectory can be obtained clearly and clearly through the two-dimensional array, and other complex conversions can be avoided.
  • the data with the same primary key in data tables A and B are sequentially spliced into a two-dimensional array to form a piece of data, which can greatly reduce the amount of data in database C and greatly improve the query speed.
  • the positioning information is longitude and latitude information.
  • the positioning information adopts longitude and latitude information, with high accuracy and uniform data format.
  • timer of the database runs synchronously with the data collector.
  • the timer and data collector run at the same time, which can ensure the accuracy and real-time of data collection.
  • a method for generating a trajectory based on database real-time positioning in this embodiment specifically includes the following steps:
  • the data collector collects and stores the positioning information of several users and stores it in the data table B;
  • the data collector collects and stores the latest positioning information of several users again and stores it in the data table A;
  • the timer of the database compares whether the positioning information in the data table B is the same as the positioning information in the data table A, if so, execute step S7, if not, execute step S5;
  • the timer determines whether the positioning information in the data table A is the last element in the two-dimensional array in the data table C, if so, execute step S7, if not, return to execute step S4;
  • the present embodiment provides a system for generating a trajectory based on database real-time positioning, including:
  • Table building module 1 used to generate data tables A, B, C in the database
  • the data acquisition module 2 is used to collect and store the positioning information of each user twice, the latest positioning information is stored in the data table A, and the last positioning information is stored in the data table B;
  • Update module 3 for updating the positioning information in the data table B to the positioning information in the data table A;
  • the comparison module 4 is used to compare whether the positioning information in the data table B is the same as the positioning information in the data table A. If so, then update the positioning information in the data table B by the update module 3 to update the positioning information in the data table A. If not, then A new data table C is created by the table building module 1, and then the positioning information in the data table B and the positioning information in the data table A are sequentially spliced into a two-dimensional array by the splicing module 5, and stored in the data table C;
  • the splicing module 5 is used for sequentially splicing the positioning information in the data table B and the positioning information in the data table A into a two-dimensional array when the positioning information in the data table B is different from the positioning information in the data table A, and storing them in the data table C middle;
  • the query module 6 is used to query the primary key of the data table C to obtain a two-dimensional array and obtain a track.
  • system for generating trajectories based on database real-time positioning also includes:
  • Judgment module 7 for judging whether the positioning information in the data table A is the last element of the two-dimensional array in the data table C, if so, then update the positioning information in the data table B by the updating module 3 to update the positioning information in the data table A, Then, the data collection module 2 collects the positioning information and stores it in the data table A. If not, the comparison module 4 compares whether the positioning information in the data table B is the same as the positioning information in the data table A.
  • this embodiment also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the above-mentioned method of generating a trajectory based on real-time positioning based on a database is implemented. steps of the method.
  • this embodiment also provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the above-mentioned method for generating a trajectory based on real-time positioning based on a database.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Remote Sensing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Navigation (AREA)

Abstract

一种基于数据库实时定位生成轨迹的方法、系统、设备及介质,所述方法包括:数据库新建数据表A、B(S1);数据采集器采集和存储用户的定位信息存入数据表B(S2);数据采集器再次采集和存储用户的最新定位信息存入数据表A(S3);数据库的定时器比较数据表B中定位信息与数据表A中定位信息是否相同(S4),若是,则将数据表B中定位信息更新为数据表A中定位信息(S7),若否,则在数据库新建数据表C,将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C(S5);查询数据表C的主键获取到二维数组,获得轨迹。该方法直接使用数据库生成轨迹,不需要后台支撑,可减少后台压力,同时该方法将定位信息拼接成二维数组形成轨迹,也减小了数据库的数据量,提高查询速度。

Description

基于数据库实时定位生成轨迹的方法、系统、设备及介质
本申请要求于2020年12月15日提交至中国专利局、申请号为202011482951.9、发明名称为“基于数据库实时定位生成轨迹的方法、系统、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机数据处理领域,更具体地,涉及一种基于数据库实时定位生成轨迹的方法、系统、设备及介质。
背景技术
在部分公安项目中,需要获得大量的轨迹以分析案情协助破案,但在部分项目中由于各种原因只能获得各类实时定位数据,无法直接获取轨迹,针对这种问题通常的解决方法是,系统的数据库根据实时定位数据生成实时定位表,再通过在后台的计算拼接去生成轨迹表,但是这样的解决方案会导致后台运行压力比较大,而当数据量庞大,后台逻辑复杂的时候,数据的处理也比较繁杂,后台系统的轨迹拼接没有剖离出来,可能会导致业务系统需要处理的内容太多,后端服务器运行缓慢卡顿,出现宕机等现象,严重的时候还可能会导致后台奔溃,而对于没有真正后台处理逻辑的系统,则需要重新搭建后台及服务器,操作十分麻烦,给具体工作实施带来巨大困难。
发明内容
本申请旨在克服上述现有技术的至少一种缺陷(不足),提供一种基于数据库实时定位生成轨迹的方法、系统、设备及介质,用于解决后台服务器拼接轨迹表时运行压力大、卡顿宕机的问题或没有后台的项目需搭建后台及服务器再生成轨迹表操作麻烦等问题。
本申请采取的技术方案是,一种基于数据库实时定位生成轨迹的方法,包括以下步骤:
数据库新建数据表A、B;
数据采集器采集和存储若干用户的定位信息存入数据表B;
数据采集器再次采集和存储若干用户的最新定位信息存入数据表A;
数据库的定时器比较数据表B中定位信息与数据表A中定位信息是否相同,若是,则将数据表B中定位信息更新为数据表A中定位信息,若否,则在数据库新建数据表C,将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C;
查询数据表C的主键获取到二维数组,获得轨迹。
本申请首先在数据库中新建两张数据表A、B用来存储信息数据,使用数据库的数据采集器采集和存储若干用户的定位信息存入数据表B,接着再次采集定位信息存入数据表A,这表明了数据表B中记录的定位信息是数据表A中定位信息的上一个时刻的定位信息。接着,使用数据库的定时器比较数据表B中定位信息与数据表A中定位信息是否相同,即为比较用户上一次定位信息与最新定位信息是否相同。当数据表B中定位信息与数据表A中定位信息相同时,这代表了该用户在这两个数据采集的时刻的位置没有发生变化,即没有移动轨迹,则数据表B中定位信息更新为数据表A中定位信息。而当数据表B中定位信息与数据表A中定位信息相同时,即代表了在这两个时刻该用户的位置发生了变化,即存在移动轨迹,所以需要在数据库新建数据表C,之后再将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中。最后查询数据表C的主键就可以获取不同主键中的二维数组,也就是各个用户的轨迹。其中,数据库的数据表中的主键是能确定一条记录的唯一标识,可以用来保证数据完整性,因此可使用主键来区分不用用户,例如可以设置各个用户的身份证号等唯一标识字段为主键字段,方便之后根据主键查询到各个用户的轨迹信息。本申请直接使用数据库通过实时定位信息直接生成轨迹表,不需要后台支撑,当数据量庞大,后台逻辑复杂的时候,数据库可以分担部分压力,减少后台由于数据量过多导致运行缓慢卡顿,宕机等现象,而对于没有后台的项目也不用再去搭建后台及服务器。
进一步的,所述方法在查询数据表C的主键获取到二维数组,获得轨迹之前还包括以下步骤:
定时器判断数据表A中定位信息是否为数据表C中二维数组中的最后 一个元素,若是,则将数据表B中定位信息更新为数据表A中定位信息,返回数据采集器再次采集和存储若干用户的最新定位信息存入数据表A步骤;若否,则返回数据库的定时器判断数据表B中定位信息与数据表A中定位信息是否相同步骤。
此步骤中,判断数据表A中定位信息是否为数据表C中二维数组中的最后一个元素,是为了判断之前的步骤是否执行正确,只有之前步骤执行正确,数据表A中定位信息才会出现在数据表C中二维数组的最后一个元素,因为之前步骤中是将数据表B中定位信息与数据表A中定位信息按顺序拼接成一个二维数组,当判断得出数据表A中定位信息是数据表C中二维数组中的最后一个元素后,将数据表B中定位信息更新为数据表A中定位信息,之后返回步骤:数据采集器再次采集和存储若干用户的最新定位信息存入数据表A,相当于完成了数据表A和数据表B的定位信息的实时更新,使得可不断更新多个时刻的定位信息,并不断拼接形成轨迹。当数据表A中定位信息不是数据表C中二维数组中的最后一个元素,则代表之前步骤执行错误,则重新判断数据表B中定位信息与数据表A中定位信息是否相同,重新进行拼接等步骤,直到最新的定位信息出现在二维数组的最后一个元素。
进一步的,所述数据表A、数据表B主键字段定义与数据表C相同。
数据库采集数据需要使用数据表进行存储,同时还方便之后进行数据的更新迭代,使用多张数据表分开存储定位信息,方便进行数据的整理,而数据表A、数据表B主键字段定义与数据表C相同,则是为了方便数据库通过相同主键提取数据进行处理。
进一步的,将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,其中二维数组拼接方式为使用拼接字符串形式进行拼接。使用字符串的形式进行拼接二维数组,可清晰明了的通过二维数组获取轨迹,而避免其他复杂的换算。同时,将数据表A、B中主键相同的数据按顺序拼接成二维数组形成一条数据,可大大减少数据库C的数据量,查询时速度大大提高。
进一步的,所述定位信息为经纬度信息。定位信息采用经纬度信息,准确性高,且数据格式统一。
进一步的,数据库的定时器与数据采集器同步运行。定时器和数据采 集器同时运行,可确保数据采集的准确性,实时性。
本申请采取的另一种技术方案为,一种基于数据库实时定位生成轨迹的系统,包括:
建表模块,用于在数据库中生成数据表A、B、C;
数据采集模块,用于两次采集和存储各个用户的定位信息,最新定位信息存入数据表A,上一次定位信息存入数据表B;
更新模块,用于将数据表B中定位信息更新为数据表A中定位信息;
比较模块,用于比较数据表B中定位信息与数据表A中定位信息是否相同,若是,则通过更新模块更新数据表B中定位信息更新为数据表A中定位信息,若否,则通过建表模块新建数据表C,再通过拼接模块把数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中;
拼接模块,用于当数据表B中定位信息与数据表A中定位信息不同时,把数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中;
查询模块,用于查询数据表C的主键获取二维数组,获取轨迹。
进一步的,还包括判断模块,用于判断模块,用于判断数据表A中定位信息是否为数据表C中二维数组的最后一个元素,若是,则通过更新模块更新数据表B中定位信息更新为数据表A中定位信息,再通过数据采集模块采集定位信息存入数据表A,若否,再通过比较模块比较数据表B中定位信息与数据表A中定位信息是否相同。
本申请采取的另一种技术方案为,一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述的一种基于数据库实时定位生成轨迹的方法的步骤。
本申请采取的另一种技术方案为,一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的一种基于数据库实时定位生成轨迹的方法的步骤。
与现有技术相比,本申请的有益效果为:本申请直接使用数据库通过实时定位信息直接生成轨迹表,不需要后台支撑,当数据量庞大,后台逻辑复杂的时候,数据库可以分担部分压力,减少后台由于数据量过多导致 运行缓慢卡顿,宕机等现象,而对于没有后台的项目也不用再去搭建后台及服务器,避免了工作处理操作麻烦等问题;同时本申请中将多个时刻的定位信息按顺序拼接成二维数组形式形成轨迹,得到减小了数据库的数据量,减轻数据库压力,且大大提高了查询时候的速度。
附图说明
图1为本申请实施例1的方法流程图。
图2为本申请实施例2的系统结构示意图。
附图标记说明:建表模块1,数据采集模块2,更新模块3,比较模块4,拼接模块5,查询模块6,判断模块7。
具体实施方式
本申请附图仅用于示例性说明,不能理解为对本申请的限制。为了更好说明以下实施例,附图某些部件会有省略、放大或缩小,并不代表实际产品的尺寸;对于本领域技术人员来说,附图中某些公知结构及其说明可能省略是可以理解的。
实施例1
本实施例提供的技术方案是,一种基于数据库实时定位生成轨迹的方法,包括以下步骤:
数据库新建数据表A、B;
数据采集器采集和存储若干用户的定位信息存入数据表B;
数据采集器再次采集和存储若干用户的最新定位信息存入数据表A;
数据库的定时器比较数据表B中定位信息与数据表A中定位信息是否相同,若是,则将数据表B中定位信息更新为数据表A中定位信息,若否,则在数据库新建数据表C,将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C;
查询数据表C的主键获取到二维数组,获得轨迹。
本申请首先在数据库中新建两张数据表A、B用来存储信息数据,使用数据库的数据采集器采集和存储若干用户的定位信息存入数据表B,接着再次采集定位信息存入数据表A,这表明了数据表B中记录的定位信息是数据表A中定位信息的上一个时刻的定位信息。接着,使用数据库的定 时器比较数据表B中定位信息与数据表A中定位信息是否相同,即为比较用户上一次定位信息与最新定位信息是否相同。当数据表B中定位信息与数据表A中定位信息相同时,这代表了该用户在这两个数据采集的时刻的位置没有发生变化,即没有移动轨迹,则数据表B中定位信息更新为数据表A中定位信息。而当数据表B中定位信息与数据表A中定位信息相同时,即代表了在这两个时刻该用户的位置发生了变化,即存在移动轨迹,所以需要在数据库新建数据表C,之后再将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中。最后查询数据表C的主键就可以获取不同主键中的二维数组,也就是各个用户的轨迹。其中,数据库的数据表中的主键是能确定一条记录的唯一标识,可以用来保证数据完整性,因此可使用主键来区分不用用户,例如可以设置各个用户的身份证号等唯一标识字段为主键字段,方便之后根据主键查询到各个用户的轨迹信息。本申请直接使用数据库通过实时定位信息直接生成轨迹表,不需要后台支撑,当数据量庞大,后台逻辑复杂的时候,数据库可以分担部分压力,减少后台由于数据量过多导致运行缓慢卡顿,宕机等现象,而对于没有后台的项目也不用再去搭建后台及服务器。
进一步的,所述方法在查询数据表C的主键获取到二维数组,获得轨迹之前还包括以下步骤:
定时器判断数据表A中定位信息是否为数据表C中二维数组中的最后一个元素,若是,则将数据表B中定位信息更新为数据表A中定位信息,返回数据采集器再次采集和存储若干用户的最新定位信息存入数据表A步骤;若否,则返回数据库的定时器判断数据表B中定位信息与数据表A中定位信息是否相同步骤。
此步骤中,判断数据表A中定位信息是否为数据表C中二维数组中的最后一个元素,是为了判断之前的步骤是否执行正确,只有之前步骤执行正确,数据表A中定位信息才会出现在数据表C中二维数组的最后一个元素,因为之前步骤中是将数据表B中定位信息与数据表A中定位信息按顺序拼接成一个二维数组,当判断得出数据表A中定位信息是数据表C中二维数组中的最后一个元素后,将数据表B中定位信息更新为数据表A中定位信息,之后返回步骤:数据采集器再次采集和存储若干用户的最新定位 信息存入数据表A,相当于完成了数据表A和数据表B的定位信息的实时更新,使得可不断更新多个时刻的定位信息,并不断拼接形成轨迹。当数据表A中定位信息不是数据表C中二维数组中的最后一个元素,则代表之前步骤执行错误,则重新判断数据表B中定位信息与数据表A中定位信息是否相同,重新进行拼接等步骤,直到最新的定位信息出现在二维数组的最后一个元素。
进一步的,所述数据表A、数据表B主键字段定义与数据表C相同。数据库采集数据需要使用数据表进行存储,同时还方便之后进行数据的更新迭代,使用多张数据表分开存储定位信息,方便进行数据的整理,而数据表A、数据表B主键字段定义与数据表C相同,则是为了方便数据库通过相同主键提取数据进行处理。
进一步的,将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,其中二维数组拼接方式为使用拼接字符串形式进行拼接。使用字符串的形式进行拼接二维数组,可清晰明了的通过二维数组获取轨迹,而避免其他复杂的换算。同时,将数据表A、B中主键相同的数据按顺序拼接成二维数组形成一条数据,可大大减少数据库C的数据量,查询时速度大大提高。
进一步的,所述定位信息为经纬度信息。定位信息采用经纬度信息,准确性高,且数据格式统一。
进一步的,数据库的定时器与数据采集器同步运行。定时器和数据采集器同时运行,可确保数据采集的准确性,实时性。
因此,作为一种优选的实施方式,如图1所示,本实施例的一种基于数据库实时定位生成轨迹的方法,具体包括以下步骤:
S1、数据库新建数据表A、B;
S2、数据采集器采集和存储若干用户的定位信息存入数据表B;
S3、数据采集器再次采集和存储若干用户的最新定位信息存入数据表A;
S4、数据库的定时器比较数据表B中定位信息与数据表A中定位信息是否相同,若是,则执行步骤S7,若否,则执行步骤S5;
S5、在数据库新建数据表C,将数据表B中定位信息与数据表A中定 位信息顺序拼接成一个二维数组,存入数据表C;
S6、定时器判断数据表A中定位信息是否为数据表C中二维数组中的最后一个元素,若是,执行步骤S7,若否,返回执行步骤S4;
S7、将数据表B中定位信息更新为数据表A中定位信息;
S8、查询数据表C的主键获取到二维数组,获得轨迹。
实施例2
如图2所示,本实施例提供一种基于数据库实时定位生成轨迹的系统,包括:
建表模块1,用于在数据库中生成数据表A、B、C;
数据采集模块2,用于两次采集和存储各个用户的定位信息,最新定位信息存入数据表A,上一次定位信息存入数据表B;
更新模块3,用于将数据表B中定位信息更新为数据表A中定位信息;
比较模块4,用于比较数据表B中定位信息与数据表A中定位信息是否相同,若是,则通过更新模块3更新数据表B中定位信息更新为数据表A中定位信息,若否,则通过建表模块1新建数据表C,再通过拼接模块5把数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中;
拼接模块5,用于当数据表B中定位信息与数据表A中定位信息不同时,把数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中;
查询模块6,用于查询数据表C的主键获取二维数组,获取轨迹。
进一步的,该基于数据库实时定位生成轨迹的系统还包括:
判断模块7,用于判断数据表A中定位信息是否为数据表C中二维数组的最后一个元素,若是,则通过更新模块3更新数据表B中定位信息更新为数据表A中定位信息,再通过数据采集模块2采集定位信息存入数据表A,若否,再通过比较模块4比较数据表B中定位信息与数据表A中定位信息是否相同。
另一方面,本实施例还提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述的一种基于数据库实时定位生成轨迹的方法的步骤。
另一方面,本实施例还提供一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的一种基于数据库实时定位生成轨迹的方法的步骤。
显然,本申请的上述实施例仅仅是为清楚地说明本申请技术方案所作的举例,而并非是对本申请的具体实施方式的限定。凡在本申请权利要求书的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本申请权利要求的保护范围之内。

Claims (10)

  1. 一种基于数据库实时定位生成轨迹的方法,其特征在于,包括以下步骤:
    数据库新建数据表A、B;
    数据采集器采集和存储若干用户的定位信息存入数据表B;
    数据采集器再次采集和存储若干用户的最新定位信息存入数据表A;
    数据库的定时器比较数据表B中定位信息与数据表A中定位信息是否相同,若是,则将数据表B中定位信息更新为数据表A中定位信息,若否,则在数据库新建数据表C,将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C;
    查询数据表C的主键获取到二维数组,获得轨迹。
  2. 根据权利要求1所述的一种基于数据库实时定位生成轨迹的方法,其特征在于,在查询数据表C的主键获取到二维数组,获得轨迹之前还包括以下步骤:
    定时器判断数据表A中定位信息是否为数据表C中二维数组中的最后一个元素,若是,则将数据表B中定位信息更新为数据表A中定位信息,返回数据采集器再次采集和存储若干用户的最新定位信息存入数据表A步骤;若否,则返回数据库的定时器判断数据表B中定位信息与数据表A中定位信息是否相同步骤。
  3. 根据权利要求1所述的一种基于数据库实时定位生成轨迹的方法,其特征在于,所述数据表A、数据表B主键字段定义与数据表C相同。
  4. 根据权利要求1所述的一种基于数据库实时定位生成轨迹的方法,其特征在于,将数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,其中二维数组拼接方式为使用拼接字符串形式进行拼接。
  5. 根据权利要求1至4任一项所述的一种基于数据库实时定位生成轨迹的方法,其特征在于,所述定位信息为经纬度信息。
  6. 根据权利要求1至4任一项所述的一种基于数据库实时定位生成轨迹的方法,其特征在于,数据库的定时器与数据采集器同步运行。
  7. 一种基于数据库实时定位生成轨迹的系统,其特征在于,包括:
    建表模块,用于在数据库中生成数据表A、B、C;
    数据采集模块,用于两次采集和存储各个用户的定位信息,最新定位信息存入数据表A,上一次定位信息存入数据表B;
    更新模块,用于将数据表B中定位信息更新为数据表A中定位信息;
    比较模块,用于比较数据表B中定位信息与数据表A中定位信息是否相同,若是,则通过更新模块更新数据表B中定位信息更新为数据表A中定位信息,若否,则通过建表模块新建数据表C,再通过拼接模块把数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中;
    拼接模块,用于当数据表B中定位信息与数据表A中定位信息不同时,把数据表B中定位信息与数据表A中定位信息顺序拼接成一个二维数组,存入数据表C中;
    查询模块,用于查询数据表C的主键获取二维数组,获取轨迹。
  8. 根据权利要求7所述的基于数据库实时定位生成轨迹的系统,其特征在于,还包括:
    判断模块,用于判断数据表A中定位信息是否为数据表C中二维数组的最后一个元素,若是,则通过更新模块更新数据表B中定位信息更新为数据表A中定位信息,再通过数据采集模块采集定位信息存入数据表A,若否,再通过比较模块比较数据表B中定位信息与数据表A中定位信息是否相同。
  9. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至6中任一项所述方法的步骤。
  10. 一种存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至6中任一项所述的方法的步骤。
PCT/CN2020/141743 2020-12-15 2020-12-30 基于数据库实时定位生成轨迹的方法、系统、设备及介质 WO2022126774A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011482951.9 2020-12-15
CN202011482951.9A CN112650823B (zh) 2020-12-15 2020-12-15 基于数据库实时定位生成轨迹的方法、系统、设备及介质

Publications (1)

Publication Number Publication Date
WO2022126774A1 true WO2022126774A1 (zh) 2022-06-23

Family

ID=75354153

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/141743 WO2022126774A1 (zh) 2020-12-15 2020-12-30 基于数据库实时定位生成轨迹的方法、系统、设备及介质

Country Status (2)

Country Link
CN (1) CN112650823B (zh)
WO (1) WO2022126774A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1952680A (zh) * 2006-11-20 2007-04-25 李玉衡 即时定位追踪器装置及方法
CN106649656A (zh) * 2016-12-13 2017-05-10 中国科学院软件研究所 一种面向数据库的时空轨迹大数据存储方法
CN107277765A (zh) * 2017-05-12 2017-10-20 西南交通大学 一种基于聚类离群分析的手机信令轨迹预处理方法
CN108806335A (zh) * 2018-05-29 2018-11-13 大连海事大学 一种基于ais轨迹大数据的船舶交通环境重构方法
CN111721312A (zh) * 2019-05-28 2020-09-29 腾讯科技(深圳)有限公司 一种运行轨迹生成方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1952680A (zh) * 2006-11-20 2007-04-25 李玉衡 即时定位追踪器装置及方法
CN106649656A (zh) * 2016-12-13 2017-05-10 中国科学院软件研究所 一种面向数据库的时空轨迹大数据存储方法
CN107277765A (zh) * 2017-05-12 2017-10-20 西南交通大学 一种基于聚类离群分析的手机信令轨迹预处理方法
CN108806335A (zh) * 2018-05-29 2018-11-13 大连海事大学 一种基于ais轨迹大数据的船舶交通环境重构方法
CN111721312A (zh) * 2019-05-28 2020-09-29 腾讯科技(深圳)有限公司 一种运行轨迹生成方法和装置

Also Published As

Publication number Publication date
CN112650823A (zh) 2021-04-13
CN112650823B (zh) 2024-04-02

Similar Documents

Publication Publication Date Title
CN107273506A (zh) 一种数据库多表联合查询的方法
US9229982B2 (en) Processing queries using oriented query paths
US9189506B2 (en) Database index management
CN111782265B (zh) 基于字段级血缘关系的软件资源系统及其建立方法
CN105373541B (zh) 数据库的数据操作请求的处理方法和系统
CN106649378A (zh) 一种数据同步方法及装置
US20150032695A1 (en) Client and server integration for replicating data
US10002142B2 (en) Method and apparatus for generating schema of non-relational database
CN106339274A (zh) 一种数据快照获取的方法及系统
CN109558452B (zh) 一种查询建表操作的同步方法
CN103853718B (zh) 分片数据库访问方法及数据库系统
CN104573024B (zh) 一种复杂网络体系下异构安全日志信息的自适应提取方法及系统
JP2008533612A5 (zh)
CN108427714A (zh) 基于机器学习的房源重复记录识别方法及系统
WO2020155740A1 (zh) 信息查询方法、装置、计算机设备及存储介质
US20160092554A1 (en) Method and system for visualizing relational data as rdf graphs with interactive response time
CN103970902A (zh) 一种大量数据情况下的可靠即时检索方法及系统
CN103778133A (zh) 一种数据库对象的变更方法及装置
CN104504001A (zh) 面向海量分布式关系数据库的游标构造方法
CN107423390A (zh) 一种基于oltp‑olap混合关系型数据库系统内部的数据实时同步算法
CN108847957A (zh) 发现与呈现网络应用访问信息的方法和系统
CN109165124A (zh) 一种基于故障树的嵌入式系统硬件故障检测及处理方法
CN109508346A (zh) 一种ddl操作的级联同步控制方法及系统
CN104391908A (zh) 一种图上基于局部敏感哈希的多关键字索引方法
WO2023279684A1 (zh) 一种基于命名规则和缓存机制的知识图谱构建的操作方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20965786

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20965786

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 31/10/2023)