An efficient spatial dataset query method based on density grayscale images
By converting the density information of spatial datasets into grayscale images and constructing image-grid binary sequences, the problems of high computational complexity and sensitivity to outliers in existing technologies are solved, achieving efficient and accurate dataset similarity calculation and query.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-21
- Publication Date
- 2026-04-07
AI Technical Summary
Existing methods for measuring spatial dataset similarity are insufficient in terms of computational complexity and sensitivity to outliers, making it difficult to efficiently calculate dataset similarity.
The density grayscale method is used to convert the location point density information of the spatial dataset into grayscale values. By cross-fusion of image matching and dataset, an image-grid binary sequence is constructed, and the similarity of the dataset is calculated.
It improves the efficiency and accuracy of spatial dataset queries, can intuitively represent dataset distribution, provides fast location and filtering functions, and has flexibility and scalability.
Smart Images

Figure CN117453771B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of data retrieval, and particularly relates to a high-efficiency spatial data set query method based on density gray scale map. BACKGROUND
[0002] Many data engines are widely used for data discovery at present, in which sample query is widely concerned. As an important part of data sets in the real world, spatial data sets are more and more widely used in the world. Sample query in spatial data set search can find data points with similar location characteristics, spatial relationship or spatial distribution from spatial data sets according to a given query object or sample. This technology has great application value in the fields of geographic information system, urban traffic management system, environmental monitoring and risk assessment, etc.
[0003] Sample query of spatial data sets needs to measure the similarity between data sets. In order to realize the similarity measurement of spatial data sets, many methods have been proposed in the existing literature. For example, Euclidean distance suitable for continuous spatial data measures the similarity of two points by calculating the straight-line distance between them; Manhattan distance suitable for grid structure measures the distance between two points by calculating the sum of absolute values of all coordinate axes; Hausdorff distance measures the shortest distance of each point in one set to another set; EMD measures the minimum cost of one distribution transforming into another distribution; MBR calculates the similarity according to the area size of the overlapping region. Among the proposed spatial similarity measurement methods, the time complexity of EMD and Hausdorff is high, and the outliers have a great influence on the result of Hausdorff method; MBR only considers the area of the overlapping region, but it cannot effectively measure the case that two data sets are almost in the same spatial range, but the distribution of their position points has little similarity, that is, it does not consider the distribution of data in space. Therefore, if a new method can be proposed to efficiently calculate the similarity of data sets, a new path for spatial data set query can be opened up. SUMMARY
[0004] In order to solve the problems of the prior art, the present application provides a high-efficiency spatial data set query method based on density gray scale map, which cross-fuses image matching with data sets, provides a new data set similarity measurement method, and improves the query efficiency.
[0005] In order to achieve the above purposes, the present application is realized by the following technical solutions:
[0006] This invention provides an efficient spatial dataset query method based on density grayscale images. The method comprises two stages: a first stage of data processing and a second stage of query execution. Specifically, it includes the following processes:
[0007] The data processing stage includes the following steps:
[0008] (1a) Given a spatial database D = {D1, D2, ..., D...} n}, D i ∈D is a spatial dataset containing several two-dimensional location points, D i ={(x1,y1),(x2,y2),…,(x mi ,y mi )}. Calculate {D1,D2,...,D n The smallest and largest x-coordinates and y-coordinates among all points in the array are x, x, and y, respectively. min x max and y min y max Using coordinates (x) min ,y min ) and (x max ,y max Construct a global rectangular region, and then divide this region into 2 based on the partitioning parameter θ. θ ×2 θ Construct a global grid coordinate system R using grids of equal size.
[0009] (1b) For each spatial dataset D in D i According to the ability to cover D i The smallest rectangular grid region R for all points in the grid i , and D i The location point in R i The density distribution information within each grid is used to generate a map that corresponds to D. i Corresponding density grayscale image I i Finally, we obtain the density grayscale image set I = {I1, I2, ..., I...} corresponding to each dataset in D. n}
[0010] (1c) Construct an image-grid binary sequence L = {L1, L2, ..., L...} based on the density grayscale image set I and the global grid coordinate system R. n}, where L i =(I i ,R i ) represents an image-grid pair, R i =(PL i ,PR i ), PL i and PRi R respectively i The grid coordinates of the lower left and upper right corners in the global grid coordinate system R.
[0011] The query execution phase of the spatial dataset includes the following steps:
[0012] (2a) For a given query sample dataset D e Generate a sample grayscale image I according to the grayscale image generation method described in step (1b). T And construct the sample image-grid tuple L T ={I T ,R T};
[0013] (2b) For each image-grid pair L in L i =(I i ,R i ), will L T The corresponding rectangular grid area R T With L i rectangular grid area R i Compare the two rectangular regions; if they overlap, then L... i Add candidate image-grid binary sequence L'.
[0014] (2c) For each candidate image-grid pair L', L' j =(I j ,R j ), calculate its corresponding dataset D j And query sample dataset D e The similarity with D. e The k datasets with the highest similarity are the query results.
[0015] A further improvement of the present invention is that: in step (1b), based on the ability to cover D i The smallest rectangular grid region R for all points in the grid i , and D i The location point in R i The density distribution information within each grid is used to generate a graph with D. i Corresponding density grayscale image I i Specifically, it includes the following steps:
[0016] (1b1) For spatial dataset D i Calculate the coverage of D in the global grid coordinate system R. i The smallest rectangular grid region R for all points in the grid i Let R be... iA rectangular grid region containing u rows and v columns.
[0017] (1b2) Construct a grayscale image I with resolution u×v i Each pixel is associated with R i The grids in the diagram correspond one-to-one. For I... i Each pixel p in x,y Count the D values contained in the grid corresponding to the pixel. i The number of location points c is determined, and the density value of the grid is calculated. |D i | represents D i The total number of location points included; then the pixel p x,y The grayscale value is set to 255*ρ. This completes the process for I. i The grayscale value settings for each pixel within the array.
[0018] A further improvement of the present invention is that, in step (2c), for each candidate image-grid pair L', j =(I j ,R j ), calculate its corresponding dataset D j And query sample dataset D e The similarity is determined by the following steps:
[0019] (2c1) For candidate image-grid tuple L j =(I j ,R j The sample image-mesh tuple L generated in step (2a) and step (2a) T ={I T ,R T}, constructed in the global grid coordinate system R that can simultaneously cover R T With R j The smallest rectangular grid region R s Let R be... s This is a rectangular grid region containing u' rows and v' columns.
[0020] (2c2) Refer to R j With R s Positional relationships in R, including grayscale image I j Enlarged to a grayscale image with resolution u'×v' j ', where it is related to the expanded region R s -R j The grayscale value of the pixel corresponding to the middle grid is set to the image I. j The mean grayscale value of all pixels in the image, R j The grayscale values of the pixels corresponding to the grid points in the region remain unchanged; following the same method, the grayscale image I is then...T Enlarged to a grayscale image with resolution u'×v' T ', and set the grayscale value of the expanded pixels. At this time, I j 'and I T The corresponding rectangular mesh pattern domain in R is R. s .
[0021] (2c3) Calculate I according to the following formula j 'and I T The similarity between ' and ' is denoted as the similarity of the corresponding dataset D. j With the query sample dataset D e The similarity.
[0022]
[0023] Where γ = u' × v', α t and β t I T 'and I j The grayscale value of the t-th pixel in ', μ T and μ j I T 'and I j The average grayscale value of all pixels in the image.
[0024] The beneficial effects of this invention are as follows: First, by converting the density information of location points into grayscale values to generate a density grayscale image, this invention can effectively reduce the computational load and complexity of queries. Second, the density grayscale image can intuitively represent the distribution of the dataset, which can be used not only for data preview and visualization but also for quickly locating and filtering data, providing more accurate and comprehensive query results. Furthermore, this invention can adjust the granularity of the spatial grid division through the parameter θ, thereby balancing the accuracy and efficiency of queries. Therefore, the spatial dataset query method of this invention also has flexibility and scalability. Attached Figure Description
[0025] Figure 1 This is a flowchart of the data processing and querying phases of the present invention.
[0026] Figure 2 This invention generates density grayscale images based on datasets.
[0027] Figure 3 This invention is an enlarged grayscale image. Detailed Implementation
[0028] The embodiments of the present invention will be disclosed below with reference to the drawings. For clarity, many practical details will be described in the following description. However, it should be understood that these practical details are not intended to limit the invention. That is, in some embodiments of the invention, these practical details are not essential.
[0029] For ease of description, the relevant symbols are defined as follows: Spatial database D = {D1, D2, ..., D...} n}, containing n datasets, D i ∈D is a spatial dataset containing several two-dimensional location points, D i ={(x1,y1),(x2,y2),…,(x mi ,y mi In D, the density grayscale image sets corresponding to each dataset are I={I1,I2,···,I}. n}; Query sample dataset D e And generate sample grayscale image I T .
[0030] This invention provides an efficient spatial dataset query method based on density grayscale images. The method comprises two stages: a first stage of data processing and a second stage of query execution. Specifically, it includes the following processes:
[0031] The data processing stage includes the following steps:
[0032] (1a) Given a spatial database D = {D1, D2, ..., D...} n}, D i ∈D is a spatial dataset containing several two-dimensional location points, D i ={(x1,y1),(x2,y2),…,(x mi ,y mi )}. Calculate {D1,D2,...,D n The smallest and largest x-coordinates and y-coordinates among all points in the array are x, x, and y, respectively. min x max and y min y max Using coordinates (x) min ,y min ) and (x max ,y max Construct a global rectangular region, and then divide this region into 2 based on the partitioning parameter θ. θ ×2 θ Construct a global grid coordinate system R using grids of equal size.
[0033] (1b) For each spatial dataset D in D iAccording to the ability to cover D i The smallest rectangular grid region R for all points in the grid i , and D i The location point in R i The density distribution information within each grid is used to generate a map that corresponds to D. i Corresponding density grayscale image I i ,like Figure 2 As shown in the example. Finally, we obtain the density grayscale image set I = {I1, I2, ..., I...} corresponding to each dataset in D. n}
[0034] In this step, based on the ability to cover D i The smallest rectangular grid region R for all points in the grid i , and D i The location point in R i The density distribution information within each grid is used to generate a graph with D. i Corresponding density grayscale image I i Specifically, it includes the following steps:
[0035] (1b1) For spatial dataset D i Calculate the coverage of D in the global grid coordinate system R. i The smallest rectangular grid region R for all points in the grid i Let R be... i A rectangular grid region containing u rows and v columns.
[0036] (1b2) Construct a grayscale image I with resolution u×v i Each pixel is associated with R i The grids in the diagram correspond one-to-one. For I... i Each pixel p in x,y Count the D values contained in the grid corresponding to the pixel. i The number of location points c is determined, and the density value of the grid is calculated. |D i | represents D i The total number of location points included; then the pixel p x,y The grayscale value is set to 255*ρ. This completes the process for I. i The grayscale value settings for each pixel within the array.
[0037] (1c) Construct an image-grid binary sequence L = {L1, L2, ..., L...} based on the density grayscale image set I and the global grid coordinate system R. n}, where L i =(I i ,R i ) represents an image-grid pair, R i=(PL i ,PR i ), PL i and PR i R respectively i The grid coordinates of the lower left and upper right corners in the global grid coordinate system R.
[0038] The query phase of the spatial dataset includes the following steps:
[0039] (2a) For a given query sample dataset D e Generate a sample grayscale image I according to the grayscale image generation method described in step (1b). T And construct the sample image-grid tuple L T ={I T ,R T Specifically, for a given query sample dataset D... e Based on the ability to cover the query sample dataset D e The smallest rectangular grid region R for all points in the grid T And query sample dataset D e The position point is in the smallest rectangular grid region R. T The density distribution information within each grid is used to generate a dataset D that corresponds to the query sample dataset. e Corresponding sample grayscale image I T A sample image-grid binary L is constructed based on the density grayscale image set I and the global grid coordinate system R. T ={I T ,R T}, where L T ={I T ,R T} represents the image-grid pair, R T =(PL T ,PR T ), PL T and PR T Representing the smallest rectangular grid region R respectively T The grid coordinates of the lower left and upper right corners in the global grid coordinate system R;
[0040] (2b) For each image-grid pair L in L i =(I i ,R i ), will L T The corresponding rectangular grid area R T With L i rectangular grid area R i Compare the two rectangular regions; if they overlap, then L... i Add candidate image-grid binary sequence L'.
[0041] (2c) For each candidate image-grid pair L', L' j =(I j ,R j ), calculate its corresponding dataset D j And query sample dataset D e The similarity with D. e The k datasets with the highest similarity are the query results.
[0042] In this step, for each candidate image-grid pair L' j =(I j ,R j ), calculate its corresponding dataset D j And query sample dataset D e The similarity is determined by the following steps:
[0043] (2c1) For candidate image-grid tuple L j =(I j ,R j The sample image-mesh tuple L generated in step (2a) and step (2a) T ={I T ,R T}, constructed in the global grid coordinate system R that can simultaneously cover R T With R j The smallest rectangular grid region R s Let R be... s This is a rectangular grid region containing u' rows and v' columns.
[0044] (2c2) Refer to R j With R s Positional relationships in R, including grayscale image I j Enlarged to a grayscale image with resolution u'×v' j ', where it is related to the expanded region R s -R j The grayscale value of the pixel corresponding to the middle grid is set to the image I. j The mean grayscale value of all pixels in the image, R j The grayscale values of the pixels corresponding to the grid points in the region remain unchanged; following the same method, the grayscale image I is then... T Enlarged to a grayscale image with resolution u'×v' T ', and set the grayscale value of the expanded pixels, such as Figure 3 As shown in the example. At this time, I j 'and I T The corresponding rectangular mesh pattern domain in R is R. s .
[0045] (2c3) Calculate I according to the following formula j 'and I T The similarity between ' and ' is denoted as the similarity of the corresponding dataset D. j With the query sample dataset D e The similarity.
[0046]
[0047] Where γ = u' × v', α t and β t I T 'and I j The grayscale value of the t-th pixel in ', μ T and μ j I T 'and I j The average grayscale value of all pixels in the image.
[0048] The spatial dataset query method proposed in this invention improves query efficiency by cross-integrating image matching and dataset.
[0049] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.
Claims
1. An efficient spatial dataset query method based on density grayscale images, characterized in that: The spatial dataset query method includes a data processing stage and a query execution stage. The data processing stage includes the following steps: Step 11: Given a spatial database D = {D1, D2, ..., D...} n }, D i Let ∈D be a spatial dataset containing several two-dimensional location points, and construct a global grid coordinate system R; Step 12: For each spatial dataset D in the spatial database D... i According to the spatial dataset D that can be covered i The smallest rectangular grid region R for all points in the grid i and spatial dataset D i The position point is in the rectangular grid area R. i The density distribution information within each grid is used to generate a map that corresponds to the spatial dataset D. i Corresponding density grayscale image I i Finally, the density grayscale image set I = {I1, I2, ..., I...} corresponding to each dataset in the spatial database D is obtained. n }; Step 13: Construct an image-grid binary sequence L = {L1, L2, ..., L...} based on the density grayscale image set I and the global grid coordinate system R. n }, where L i =(I i ,R i ) represents an image-grid pair, R i =(PL i ,PR i ), PL i and PR i Representing the smallest rectangular grid region R respectively i The grid coordinates of the lower left and upper right corners in the global grid coordinate system R; The query execution phase includes the following steps: Step 21: For the given query sample dataset D e Based on the ability to cover the query sample dataset D e The smallest rectangular grid region R for all points in the grid T And query sample dataset D e The position point is in the smallest rectangular grid region R. T The density distribution information within each grid is used to generate a dataset D that corresponds to the query sample dataset. e Corresponding sample grayscale image I T A sample image-grid binary L is constructed based on the density grayscale image set I and the global grid coordinate system R. T ={I T ,R T }, R T =(PL T ,PR T ), PL T and PR T Representing the smallest rectangular grid region R respectively T The grid coordinates of the lower left and upper right corners in the global grid coordinate system R; Step 22: For each image-grid pair L in the image-grid pair sequence L i =(I i ,R i ), and the sample image-grid tuple L T The corresponding rectangular grid area R T With image-grid binary L i rectangular grid area R i The two rectangular regions are compared; if they overlap, the image-grid tuple L is then used. i Add candidate image-grid binary sequence L'; Step 23: For each candidate image-grid pair L' in the candidate image-grid pair sequence L' j =(I j ,R j ), calculate its corresponding dataset D j And query sample dataset D e The similarity, where, with the query sample dataset D e The k datasets with the highest similarity are the query results.
2. The efficient spatial dataset query method based on density grayscale images according to claim 1, characterized in that: Step 11, constructing the global grid coordinate system R, specifically includes the following steps: Step 111: Given a spatial database D = {D1, D2, ..., D...} n }, D i ∈D is a spatial dataset containing several two-dimensional location points, D i ={(x1,y1),(x2,y2),…,(x mi ,y mi )}; Step 112: Calculate {D1, D2, ..., D...} n The smallest and largest x-coordinates and y-coordinates among all points in the array are x, x, and y, respectively. min x max and y min y max Using coordinates (x min ,y min ) and (x max ,y max Construct a global rectangular region; Step 113: Divide the region into 2 according to the partitioning parameter θ. θ ×2 θ Construct a global grid coordinate system R using grids of equal size.
3. A method for efficiently querying spatial datasets based on density grayscale images according to claim 1 or 2, characterized in that: In step 12, based on the spatial dataset D that can be covered... i The smallest rectangular grid region R for all points in the grid i and spatial dataset D i The location point in R i The density distribution information within each grid is used to generate a graph with D. i Corresponding density grayscale image I i Specifically, it includes the following steps: Step 121: For the spatial dataset D i Calculate the spatial dataset D that can be covered in the global grid coordinate system R. i The smallest rectangular grid region R for all points in the grid i Let the rectangular grid region R be... i A rectangular grid region containing u rows and v columns; Step 122: Construct a grayscale image I with a resolution of u×v i Each pixel is associated with a rectangular grid region R. i The grids in the image correspond one-to-one, for grayscale image I. i Each pixel p in x,y Statistical pixel p x,y The corresponding grid contains the spatial dataset D i The number of location points c is determined, and the density value of the grid is calculated. |D i |Representation space dataset D i The total number of location points, then the pixel p x,y The grayscale value is set to 255*ρ, and the grayscale image I is finally completed. i The grayscale value settings for each pixel within the array.
4. The efficient spatial dataset query method based on density grayscale images according to claim 1, characterized in that: In step 23, for each candidate image-grid pair L' in the candidate image-grid pair sequence L' j =(I j ,R j ), calculate its corresponding dataset D j And query sample dataset D e The similarity is determined by the following steps: Step 231: For the candidate image-grid binary L j =(I j ,R j ) and the sample image-grid binary L generated in step 21 T ={I T ,R T }, constructed in the global grid coordinate system R that can simultaneously cover R T With R j The smallest rectangular grid region R s Let R s A rectangular grid region containing u' rows and v' columns; Step 232, refer to R j With R s Positional relationships in R, including grayscale image I j Enlarged to a grayscale image with resolution u'×v' j ', where it is related to the expanded region R s -R j The grayscale value of the pixel corresponding to the middle grid is set to the image I. j The mean grayscale value of all pixels in the image, R j The grayscale values of the pixels corresponding to the grid points in the region remain unchanged; then the grayscale image I... T Enlarged to a grayscale image with resolution u'×v' T ', and set the grayscale value of the expanded pixels. At this time, I j 'and I T The corresponding rectangular mesh pattern domain in R is R. s ; Step 233, Calculate I j 'and I T The similarity between ' and ' is denoted as the similarity of the corresponding dataset D. j With the query sample dataset D e The similarity.
5. The efficient spatial dataset query method based on density grayscale images according to claim 4, characterized in that: In step 233, I j 'and I T The formula for calculating the similarity between ' and ' is: Where γ = u' × v', α t and β t I T 'and I j The grayscale value of the t-th pixel in ', μ T and μ j I T 'and I j The average grayscale value of all pixels in the image.
Citation Information
Patent Citations
Spatial image inquiring method and system
CN104778284A
A preference space Skyline query processing method based on a Spark environment
CN109947904A