Method for acquiring workplace, residence and traffic place based on space-time grid
By using a spatiotemporal grid-based data processing method, the problem of extracting individual trajectories from multi-source trajectory data in traditional systems has been solved, achieving efficient and accurate extraction of workplace, residence, and transportation locations, and improving data visualization and decision support capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-13
AI Technical Summary
Traditional geographic information systems struggle to efficiently and intelligently extract and accurately categorize individuals' daily movement trajectories from multi-source, diverse, dynamic, and massive trajectory data, thus limiting the in-depth mining and effective transformation of data value in urban management.
By employing a spatiotemporal grid-based approach, including data cleaning, grouping, sorting, time difference identification, Geohash encoding, and gridding, the system automatically extracts an individual's work, residence, and transportation locations. MaxCompute SQL is used for data processing, and Geohash encoding functions are used for map gridding, thereby achieving data structuring and visualization.
It improves the efficiency and accuracy of data processing, reduces misjudgments, generates intuitive decision-making basis, and supports applications such as urban planning, traffic management, and business site selection.
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and specifically to a method for obtaining workplace, residence, and transportation locations based on a spatiotemporal grid. Background Technology
[0002] As urbanization deepens and accelerates, accurately understanding residents' daily activity patterns in urban spaces has become crucial. Understanding population movement patterns not only helps in the rational allocation of public resources and the optimized layout of infrastructure, but also significantly improves the efficiency and accuracy of urban public safety management. For example, in scenarios such as traffic planning, emergency evacuation, and epidemic prevention and control, trajectory data analysis can provide quantitative support for decision-making, thereby building a more resilient and orderly urban operating system.
[0003] Currently, the technical means of collecting people's daily activity trajectories mainly rely on various digital sensing technologies. Conventional methods include using signaling data from mobile communication base stations to roughly locate a user's movement path by tracking the connection between the mobile phone and different base stations. In addition, technologies such as the Global Positioning System (GPS), Wi-Fi positioning, and Bluetooth beacons can provide precise individual location sequences through smartphones and in-vehicle navigation devices. Public transportation smart card swipe records, shared bicycle trip data, ride-hailing order trajectories, and social media check-in information also collectively constitute massive, multi-source spatiotemporal trajectory big data.
[0004] However, the aforementioned existing technologies have significant limitations and shortcomings in practical applications. Traditional Geographic Information Systems (GIS) and analytical methods often fall short when faced with diverse, varied, dynamic, and massive amounts of "messy" data. They lack efficient and intelligent data fusion and cleaning capabilities, making it difficult to automatically and accurately extract semantically meaningful information from raw, low-value-density location points. For example, they cannot infer an individual's permanent residence, fixed workplace, or identify regular daily movement patterns such as "home-workplace-entertainment venue." This inadequacy in information extraction capabilities restricts the in-depth mining and effective transformation of data value in urban management. Therefore, a method is needed to optimize these shortcomings in order to achieve the collection and classification of individual activity trajectories. Summary of the Invention
[0005] The purpose of this invention is to provide a method for obtaining workplace, residence, and transportation locations based on spatiotemporal grids, in order to solve the problem that traditional geographic information systems cannot accurately extract and classify the daily movement trajectories of individuals from raw, low-density location points.
[0006] To achieve the above objectives, the basic solution provided by this invention is: a method for obtaining workplace, residence, and transportation locations based on a spatiotemporal grid, comprising the following steps: S1: Obtain travel data of the target object and divide the data into trajectory type and registration type; S2: Clean and deduplicate the classified data, convert the format, handle missing values, handle outliers, and normalize the data; S3: In MaxCompute SQL, group by the ID number of the target object and sort in ascending order by time; S4: Obtain the current record and the previous record after grouping and sorting the same target object, calculate the time difference between the current record and the previous record, with a preset time difference threshold of 2h, determine whether the time difference is >2h, if it is >2h, mark the previous record as a valid stop point, and automatically enter the corresponding ID number, geographical location, start and end time into the stop point intermediate table; S5: Group the target objects by their ID number and the corresponding geographical location in the record, filter out key locations, and classify the key locations according to work, residence, and mobility locations based on different times of the day; S6: Generate corresponding Geohash encoded characters for each key location type in MaxCompute SQL to grid the map; S7: Group the target object ID number and its corresponding Geohash encoded characters of different types, and merge neighboring points of different types.
[0007] The working principle of this invention is as follows: First, the method classifies, cleans, and standardizes the travel data of the target object to ensure data quality. The data is then grouped and sorted by individual ID, and the time difference between consecutive records is calculated. Data points exceeding a 2-hour threshold are intelligently identified as valid stops. Next, based on geographical location and different times of day, the system categorizes these stops into key location types such as work, residence, or mobility. Finally, the Geohash encoding function is used to convert the geographical location into a string, achieving map gridding. By merging adjacent grid cells of the same type, a clear spatial distribution map of work, residence, and travel is ultimately formed. The beneficial effects of this invention are as follows: This method realizes the automated and batch extraction of structured location information from raw travel data, which greatly improves the efficiency and accuracy of data processing. By setting time thresholds and combining spatiotemporal patterns to classify locations, it effectively distinguishes different types of stops and reduces misjudgments. The introduction of Geohash encoding functions for grid management not only transforms complex spatial calculations into efficient string operations, but also facilitates large-scale spatial analysis and visualization. The final merged grid provides an intuitive and reliable basis for decision-making in urban planning, traffic management, and commercial site selection.
[0008] Option 2, which is the preferred option of the basic option, involves the following specific processing method for the classified data in step S2: Cleaning and deduplication: The system automatically removes obvious noise and drift points from the original data, and deduplicates records caused by repeated reporting by the device or signal jitter, as well as multiple identical records that appear at the same timestamp or very close positions. Format conversion: unify multi-source data, convert timestamps to Beijing time, convert geographic coordinates to the same coordinate system, and organize the data into a structured data table containing unified fields; Missing value handling: The missing signal is repaired by interpolation, and the missing segments that cannot be interpolated are identified and segmented; Outlier handling: Set upper limits for speed, acceleration, and dwell time, and identify and remove data points that cannot be reached; Normalization: For multi-dimensional features, use one of the methods, Min-Max normalization or Z-Score normalization, to scale these features to the same numerical range.
[0009] Option 3, which is the preferred option of the basic option, involves the following specific steps in step S3 for grouping and sorting the target object IDs: S1: The system automatically issues the DISTRIBUTE BY user_id command, groups the activity records of each target object according to their ID number and their corresponding activity records, and assigns the activity records of the same target object to the same computing node. S2: Use the SORT BY timestamp command within the same computing node to sort the trajectory or the timestamp of the event.
[0010] Option 4 is the preferred option from the basic options. In step S5, the specific method for selecting key locations is as follows: S1: The system automatically groups the target object ID number and the geolocation location using Geohash encoding; S2: Use the COUNT aggregation function to count the number of visits and the number of days visited for each location, and calculate the total length of stay; S3: Use the ROW_NUMBER() function to sort in ascending order by access frequency and dwell time; S4: Filter the sorted data and find the top N locations under each ID that are frequently visited and have a stay time of >2 hours, and designate them as key locations.
[0011] ROW_NUMBER() is a window function used to assign a unique, consecutive integer number to each row in a query result set.
[0012] Option 5, which is the preferred option of Option 4, classifies key locations in step S5 according to work, residence and mobility: 8:00-10:30 is considered the workplace, 10:31-18:59 is considered the mobility location, and 19:00-07:59 the next day is considered the residence location.
[0013] Option 6, which is the preferred option of the basic option, involves the following specific steps for implementing map gridding in step S6: S1: Take the latitude and longitude of each record corresponding to each ID number as input parameters and calculate its Geohash encoding function; S2: Set the precision parameter of the Geohash encoding function to 6 bits, corresponding to a grid area of 1.22km × 0.61km; S3: The system automatically performs the conversion of latitude and longitude to Geohash encoding functions, representing the map in a grid format.
[0014] Option 7 is the preferred option of the basic option. In step S7, the specific operation method for merging adjacent points is as follows: S1: The system groups the ID number of the target object with its corresponding 6-bit Geohash encoding function for its residential, work, or mobile location; S2: Within the same 6-bit Geohash encoded function grid that has been grouped, select the residential, working, or mobile points with the highest access frequency and determine them as the representative points of that grid; S3: Taking a representative point as the core, the system merges the number of visit days and visit times of all residential, working or mobile points within the same grid and accumulates them onto the representative point to complete data aggregation. Detailed Implementation
[0015] The present invention will be further described in detail below through specific embodiments: Example A method for obtaining workplace, residence, and transportation locations based on spatiotemporal grids includes the following steps: S1: Obtain travel data of the target object and divide the data into trajectory type and registration type; S2: The categorized data is cleaned, deduplicated, formatted, missing values are handled, outliers are handled, and normalization is performed. The detailed steps are as follows: 1) Cleaning and deduplication: The system automatically removes obvious noise and drift points from the original data, and deduplicates records caused by repeated reporting by the device or signal jitter, as well as multiple identical records that appear at the same timestamp or very close positions. 2) Format conversion: Unify multi-source data, convert timestamps to Beijing time, convert geographic coordinates to the same coordinate system, and organize the data into a structured data table containing unified fields; 3) Missing value handling: The missing signal is repaired by interpolation, and the missing segments that cannot be interpolated are marked and segmented; 4) Outlier handling: Set upper limits for speed, acceleration, and dwell time, and identify and remove data points that cannot be reached; 5) Normalization: For multi-dimensional features, use one of the methods, Min-Max normalization or Z-Score normalization, to scale these features to the same numerical range. S3: In MaxCompute SQL, the system automatically issues the DISTRIBUTE BY user_id command to group the activity records of each target object according to their ID number and the corresponding activity records, and assign the activity records of the same target object to the same computing node; within the same computing node, the SORT BY timestamp command is used to sort the records according to the timestamp of the trajectory or the registration. S4: Obtain the current record and the previous record after grouping and sorting the same target object, calculate the time difference between the current record and the previous record, with a preset time difference threshold of 2h, determine whether the time difference is >2h, if it is >2h, mark the previous record as a valid stop point, and automatically enter the corresponding ID number, geographical location, start and end time into the stop point intermediate table; S5: Group by the target object's ID number and the corresponding geographical location in the record, and filter out key locations and group them according to the following steps: S5.1: The system automatically groups the target object ID number and the Geohash encoding of the geographical location; S5.2: Use the COUNT aggregation function to count the number of visits and the number of days visited for each location, and calculate the total length of stay; S5.3: Use the ROW_NUMBER() function to sort in ascending order by access frequency and dwell time; S5.4: Filter the sorted data and find the top N locations with the most frequent visits and a stay time of >2 hours under each ID number, and designate them as key locations; S5.5: Critical locations are classified according to work, residence and mobility: 8:00-10:30 is considered the workplace, 10:31-18:59 is considered the mobility location, and 19:00-07:59 the next day is considered the residence. S6: Generate the corresponding Geohash encoded characters for each key location type in MaxCompute SQL, and then grid the map using the following steps: S6.1: Take the latitude and longitude of each record corresponding to each ID number as input parameters and calculate its Geohash encoding function; S6.2: Set the precision parameter of the Geohash encoding function to 6 bits, corresponding to a grid area of 1.22km × 0.61km; S6.3: The system automatically performs the conversion of latitude and longitude to Geohash encoding functions to represent the map in a grid format; S7: Group the target object ID number and its corresponding Geohash encoded characters of different types, and merge neighboring points of different types according to the following steps: S7.1: The system groups the ID number of the corresponding target object with the 6-bit Geohash encoding function of its corresponding residential, work or mobile location; S7.2: Within the same 6-bit Geohash encoded function grid that has been grouped, select the residential, working, or mobile points with the highest access frequency and determine them as the representative points of that grid; S7.3: Taking a representative point as the core, the system merges the number of visit days and visit times of all residential, working or mobile points within the same grid and accumulates them to the representative point to complete data aggregation.
[0016] The implementation method of this embodiment is as follows: A city planning department wanted to analyze the distribution of residents' work and residence and their commuting patterns. This method was used to process a batch of anonymous ride-hailing travel data. The specific process is as follows: First, the system obtains a batch of travel data of ride-hailing passengers (target objects) from the data platform, including vehicle location, timestamp, and order origin and destination. Then, the system performs comprehensive cleaning and preprocessing on this data, removes obvious GPS drift points, deduplicates duplicate reports, unifies all timestamps to Beijing time, unifies various geographic coordinates to the GCJ-02 coordinate system, repairs track segments with lost signals using interpolation, and sets reasonable thresholds to remove abnormal data points such as instantaneous speeds exceeding 120km / h.
[0017] Next, in MaxCompute SQL, the system executes `DISTRIBUTE BY user_id SORT BY timestamp` to group the data by each passenger's ID and sort them in ascending order by time within each group. The system calculates the time difference between consecutive records of the same passenger. The system finds that after passenger A gets off at "X station", the next time he appears at "Y station" is 3 hours later. Since the time difference is greater than the 2-hour threshold, the system marks this stop at "X station" as a valid stop and enters its ID, geographical location, and start time into the stop point intermediate table.
[0018] The system then aggregated all stops by passenger ID and geographic location. By counting the number of visits, days, and total duration, and sorting using the ROW_NUMBER() function, the system filtered out the top few key locations visited and stayed the longest by each passenger. The system identified three key locations for passenger A: a residential area where they frequently appeared at night (8:00 PM to 8:00 AM the next day) and stayed for more than 10 hours; an office building where they regularly appeared during the day (9:00 AM to 7:00 PM) and stayed for about 8 hours; and a shopping mall where they briefly appeared in the afternoon (2:00 PM to 3:00 PM).
[0019] Finally, the system calculates the Geohash encoding function for the latitude and longitude of each key point, divides the geographic space into a grid of approximately 1.22km × 0.61km, and performs data aggregation. The system merges multiple nearby points of the same passenger within the same 6-bit Geohash grid. Passenger A has three nearby points identified as "workplaces" within this grid. The system selects the point with the highest access frequency as the representative point of the "workplace" of this grid, and accumulates the access days and times of the other points to the representative point. In the end, a concise and clear residential grid code and workplace code are generated for passenger A, thus clearly reflecting his work-residence spatial relationship.
[0020] The above descriptions are merely embodiments of the present invention, and common knowledge regarding specific structures and characteristics is not elaborated upon here. It should be noted that those skilled in the art can make various modifications and improvements without departing from the structure of the present invention, and these should also be considered within the scope of protection of the present invention. These modifications and improvements will not affect the effectiveness of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A method for obtaining workplace, residence, and transportation locations based on a spatiotemporal grid, characterized in that, Includes the following steps: S1: Obtain travel data of the target object and divide the data into trajectory type and registration type; S2: Clean and deduplicate the classified data, convert the format, handle missing values, handle outliers, and normalize the data; S3: In MaxCompute SQL, group by the ID number of the target object and sort in ascending order by time; S4: Obtain the current record and the previous record after grouping and sorting the same target object, calculate the time difference between the current record and the previous record, with a preset time difference threshold of 2h, determine whether the time difference is >2h, if it is >2h, mark the previous record as a valid stop point, and automatically enter the corresponding ID number, geographical location, start and end time into the stop point intermediate table; S5: Group the target objects by their ID number and the corresponding geographical location in the record, filter out key locations, and classify the key locations according to work, residence, and mobility locations based on different times of the day; S6: Generate corresponding Geohash encoded characters for each key location type in MaxCompute SQL to grid the map; S7: Group the target object ID number and its corresponding Geohash encoded characters of different types, and merge neighboring points of different types.
2. The method for obtaining work-residence-transportation locations based on a spatiotemporal grid according to claim 1, characterized in that, The specific processing method for the classified data in step S2 is as follows: Cleaning and deduplication: The system automatically removes obvious noise and drift points from the original data, and deduplicates records caused by repeated reporting by the device or signal jitter, as well as multiple identical records that appear at the same timestamp or very close positions. Format conversion: unify multi-source data, convert timestamps to Beijing time, convert geographic coordinates to the same coordinate system, and organize the data into a structured data table containing unified fields; Missing value handling: The missing signal is repaired by interpolation, and the missing segments that cannot be interpolated are identified and segmented; Outlier handling: Set upper limits for speed, acceleration, and dwell time, and identify and remove data points that cannot be reached; Normalization: For multi-dimensional features, use one of the methods, Min-Max normalization or Z-Score normalization, to scale these features to the same numerical range.
3. The method for obtaining work-residence-transportation locations based on a spatiotemporal grid according to claim 1, characterized in that, The specific steps for grouping and sorting the target object IDs in step S3 are as follows: S1: The system automatically issues the DISTRIBUTE BY user_id command, groups the activity records of each target object according to their ID number and their corresponding activity records, and assigns the activity records of the same target object to the same computing node. S2: Use the SORT BY timestamp command within the same computing node to sort the trajectory or the timestamp of the event.
4. The method for obtaining work-residence-transportation locations based on a spatiotemporal grid according to claim 1, characterized in that, In step S5, the specific method for selecting key locations is as follows: S1: The system automatically groups the target object ID number and the geolocation location using Geohash encoding; S2: Use the COUNT aggregation function to count the number of visits and the number of days visited for each location, and calculate the total length of stay; S3: Use the ROW_NUMBER() function to sort in ascending order by access frequency and dwell time; S4: Filter the sorted data and find the top N locations under each ID that are frequently visited and have a stay time of >2 hours, and designate them as key locations.
5. The method for obtaining work-residence-transportation locations based on a spatiotemporal grid according to claim 4, characterized in that, In step S5, the key locations are classified according to work, residence and mobility as follows: 8:00-10:30 is considered the workplace, 10:31-18:59 is considered the mobility location, and 19:00-07:59 the next day is considered the residence.
6. The method for obtaining work-residence-transportation locations based on a spatiotemporal grid according to claim 1, characterized in that, In step S6, the specific operation method for implementing map gridding is as follows: S1: Take the latitude and longitude of each record corresponding to each ID number as input parameters and calculate its Geohash encoding function; S2: Set the precision parameter of the Geohash encoding function to 6 bits, corresponding to a grid area of 1.22km × 0.61km; S3: The system automatically performs the conversion of latitude and longitude to Geohash encoding functions, representing the map in a grid format.
7. The method for obtaining work-residence-transportation locations based on a spatiotemporal grid according to claim 1, characterized in that, In step S7, the specific operation method for merging adjacent points is as follows: S1: The system groups the ID number of the target object with its corresponding 6-bit Geohash encoding function for its residential, work, or mobile location; S2: Within the same 6-bit Geohash encoded function grid that has been grouped, select the residential, working, or mobile points with the highest access frequency and determine them as the representative points of that grid; S3: Taking a representative point as the core, the system merges the number of visit days and visit times of all residential, working or mobile points within the same grid and accumulates them onto the representative point to complete data aggregation.