A low-coupling spatial data processing method and mobile device
By using low-coupling spatial data processing methods on mobile terminals to generate and store raster tile files and custom vector spatial databases, the problems of low spatial data storage efficiency and poor stability on mobile terminals are solved, and an efficient and universal solution is achieved. Data management and retrieval, suitable for a variety of mobile terminals.
Patent Information
- Application Number
- CN202111160619.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-09-30
AI Technical Summary
The storage and computing space of mobile terminals is limited, which causes the traditional spatial data storage model to have problems such as lag in system response, slow data scheduling, low efficiency and poor stability on mobile terminals. Moreover, most mobile GIS products only support limited types of mobile terminals and lack of A unified, efficient and low-coupling approach to data storage management.
Using a low-coupling spatial data processing method, the raster data is processed by map caching to generate raster tile files of multiple preset scales, indexed and stored, a raster spatial database is created, and customization is created for vector data. Vector spatial database, compressed to improve data storage and retrieval efficiency.
It achieves efficient, low-coupling storage and retrieval of spatial data, has broad versatility and robust performance, does not rely on specific underlying interfaces or database formats, and can be applied to a variety of mobile terminals, improving data security and application stability. sex.
Smart Images

Figure CN113918564B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of geographic information, and in particular to a low-coupling spatial data processing method and a mobile device. Background Art
[0002] With the development of mobile Internet and the widespread popularity of smart terminals, mobile location services have become a new type of geographic information service format and have gradually developed into an important development direction in the GIS field.
[0003] In the actual process of mobile location services, due to the limited storage and computing space of mobile terminals, they cannot carry massive data, resulting in the application of spatial data storage mode on traditional PC devices to mobile terminals, which will cause problems such as system response lag and slow data scheduling of the mobile terminal. In addition, the spatial data query and analysis application process on the mobile terminal will also be restricted by the software and hardware conditions of the mobile terminal and the network performance, resulting in low efficiency and poor stability of the spatial data query function, which poses a certain threat to the security of spatial data. In addition, since most mobile GIS products currently only support a limited number of mobile terminals and cannot be applied to a larger number of mobile terminals, this also results in the lack of a unified, efficient and low-coupling data storage management method for spatial data, which limits the application of GIS products. Summary of the invention
[0004] The first technical problem to be solved by the present invention is to provide a low-coupling spatial data processing method for the above-mentioned prior art.
[0005] The second technical problem to be solved by the present invention is to provide a mobile device. The mobile device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned low-coupling spatial data processing method is implemented.
[0006] The technical solution adopted by the present invention to solve the first technical problem is: a low-coupling spatial data processing method, characterized in that it includes the following steps:
[0007] Step S1, performing map cache processing on the raster data in the spatial data to generate a plurality of raster tile files of preset scales;
[0008] Step S2, indexing each generated raster tile file in a hierarchical and framing manner, and mapping each raster tile file to a corresponding spatial data table one by one, and obtaining a metadata table corresponding to the spatial data table; wherein each record in the spatial data table corresponds to a raster tile file, and the metadata table records metadata information of the corresponding spatial data table;
[0009] Step S3, storing and processing all generated raster tile files;
[0010] Step S4, creating a raster spatial database according to the spatial data table and the metadata table corresponding to the spatial data table;
[0011] Step S5, performing raster tile file retrieval;
[0012] Step S6, creating a custom vector space database for the vector data in the spatial data;
[0013] Step S7, compressing the data in the raster space database and the custom vector space database respectively to obtain parsable compressed data packets.
[0014] Improved, in the low-coupling spatial data processing method, in step S1, the process of generating the raster tile file includes the following steps S11 to S19:
[0015] Step S11, selecting the original raster data with coordinate information of the target space range;
[0016] Step S12, determining the pixels of each raster tile file to be generated;
[0017] Step S13, determining the calculation origin of the grid tile file, and making the positions of the grid tile files in the same coordinate system uniform;
[0018] Step S14, according to different preset scales, respectively setting the level corresponding to each preset scale and the distance represented by the pixel of each raster tile file;
[0019] Step S15, obtaining the data range and pixel matrix of the original raster data by checking the file attributes, and calculating the representative distance of each pixel;
[0020] Step S16, calculating the total number of raster tile files corresponding to each level and the coordinate range of each raster tile file;
[0021] Step S17, calculating the row range and column range of each raster tile file in the original raster data;
[0022] Step S18, determining the sampling interval corresponding to sampling at each level;
[0023] Step S19, drawing a tile graphic; wherein the drawn tile graphic is the raster tile file.
[0024] Furthermore, in the low-coupling spatial data processing method, in step S3, the storage process of the raster tile file includes the following steps S31-S32:
[0025] Step S31, obtaining the row number and column number of each raster tile file according to the calculated coordinate range of each raster tile file;
[0026] Step S32: storing the obtained raster tile file, the row number and the column number of the raster tile file according to a preset storage path.
[0027] Further improved, in the low-coupling spatial data processing method, in step S4, the creation process of the grid spatial database is as follows: steps S41 to S43:
[0028] Step S41, setting the library format of the raster space database; wherein the raster space database includes a metadata table and a raster tile file storage table, and the structure fields of the raster tile file storage table include a level, a row number, a column number and raster tile file data;
[0029] Step S42, importing the generated raster tile file data, converting each generated raster tile file data into a binary data stream, and writing it into the metadata table;
[0030] Step S43, writing the metadata information in the metadata table into the raster tile file storage table; wherein the metadata information includes coordinate name, level, range, starting point coordinates and data name.
[0031] Improved, in the low-coupling spatial data processing method, in step S5, the process of performing raster tile file retrieval includes the following steps S51 to S53:
[0032] Step S51, determining the coordinates and level of any target point in the same coordinate system in the raster tile file;
[0033] Step S52, calculating the row number and column number of the raster tile file corresponding to any target point;
[0034] Step S53, based on the calculated row number, column number and level of the raster tile file, a record search is performed on the raster space database, and the image data of the raster tile file is read.
[0035] Further improved, in the low-coupling spatial data processing method, in step S6, the process of creating the custom vector space database includes the following steps S61 to S63:
[0036] Step S61, establishing a table structure, wherein each vector data corresponds to a data table;
[0037] Step S62, importing the attribute data of each vector data into the data table corresponding to the vector data;
[0038] Step S63, creating a SHAPE file for storing image data in each data table; wherein the name of each data table is the layer name.
[0039] As a further improvement, in the low-coupling spatial data processing method, after step S7, the method further includes: sending each compressed data packet to a server.
[0040] The technical solution adopted by the present invention to solve the second technical problem is: a mobile device, characterized in that it includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the low-coupling spatial data processing method is implemented.
[0041] Compared with the prior art, the advantages of the present invention are:
[0042] First, the spatial data processing method in the invention obtains the coordinate range and pixel size of each raster tile file corresponding to any raster data with spatial information, generates a raster tile file and stores the generated raster tile file, and for any vector data, only needs to read its coordinate sequence and attribute field to create a custom vector spatial database. Since the spatial data processing method does not rely on a specific underlying interface for data processing, it has wide versatility; and it is not targeted at a specific database format and a specific operating platform, any database can store the raster tile files and vector information generated by the method in the invention, and can generate a custom raster spatial database and a vector spatial database, thereby showing a good low coupling feature;
[0043] Secondly, the spatial data processing method in the invention stores raster tile files separately according to the spatial data table. Even if a retrieval error occurs in a data table storage, it will not affect the access and retrieval of other raster tile files. In addition, the raster tile files are stored according to resolution, level, and range. Users in need can obtain the corresponding raster tile file data according to specific needs. If an error or retrieval error occurs in a raster tile file, it will not affect the reading of other tiles. Of course, in the same coordinate system, the spatial data processing method in the invention can also update the raster tile files and vector information within any range on demand without affecting the data records outside the arbitrary range. In case of data file damage and deletion after decompression, the metafile in the database can be re-retrieved, re-decompressed and overwritten to ensure data integrity, thereby demonstrating strong robust performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 Schematic diagram of the flow of a low-coupling spatial data processing method in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The present invention is further described in detail below with reference to the accompanying drawings.
[0046] This embodiment first provides a low-coupling spatial data processing method. Figure 1 As shown, the low-coupling spatial data processing method includes the following steps S1 to S7:
[0047] Step S1, performing map cache processing on the raster data in the spatial data to generate a plurality of raster tile files of preset scales; wherein, specifically to this embodiment, the generation process of the raster tile files includes the following steps S11 to S19:
[0048] Step S11, selecting original raster data with coordinate information in the target spatial range; for example, the original raster data selected here is high-resolution image data;
[0049] Step S12, determining the pixels of each raster tile file to be generated; in this embodiment, the pixels of each raster tile file to be generated are uniformly set to 256*256 pixels;
[0050] Step S13, determining the calculation origin (X0, Y0) of the raster tile file, and making the positions of the raster tile files in the same coordinate system uniform;
[0051] Step S14, according to different preset scales, respectively set the level corresponding to each preset scale and the distance represented by the pixel of each raster tile file; for example, in this embodiment: the corresponding settings between the preset scale (scale), the level (level) and the distance represented by the pixel of each raster tile file (resolution) are as follows:
[0052] level scale resolution 0 1024000 0.0024365680699702068 1 512000 0.0012182840349851034 2 256000 0.00060914201749255169 3 128000 0.00030457100874627585 4 64000 0.00015228550437313792 5 32000 7.6142752186568962e-005 6 25600 6.0914201749255174e-005 … … …
[0053] Step S15, by checking the file attributes, the data range and pixel matrix of the original raster data are obtained, and the representative distance of each pixel is calculated; wherein, assuming that after checking the file attributes, the data range of the original raster data obtained is (X 0,min ,X 0,max ,Y 0,min ,Y 0,max ), the pixel matrix of the original raster data is (row Nrow*column Ncol); the representative distance of each pixel is marked as Resolution0, the number of rows of the pixel matrix of the original raster data is marked as Nrow, and the number of columns of the pixel matrix of the original raster data is marked as Ncol:
[0054] Resolution0=(X0,max -X 0,min ) / Ncol;
[0055] Step S16, calculating the total number of raster tile files corresponding to each level and the coordinate range of each raster tile file; wherein the total number of raster tile files corresponding to any level is marked as Num, and the coordinate range of the raster tile files at any level is marked as (EX min ,EX max ,EY min ,EY max ):
[0056] NR min =(Y 0,min -Y0) / (resolution*256);
[0057] NR max =(Y 0,max -Y0) / (resolution*256);
[0058] NC min =(X 0,min -X0) / (resolution*256);
[0059] NC max =(X 0,max -X0) / (resolution*256);
[0060] Num=(NR max -NR min )*(NC max -NC min );
[0061] EX min =m*(resolution*256);
[0062] EX max =m*(resolution*256)+(resolution*256);
[0063] EY min =n*(resolution*256);
[0064] EY max =n*(resolution*256)+(resolution*256);
[0065] NC min <m<NC max NR min <n<NR max ;
[0066] Step S17, calculating the row range and column range of each raster tile file in the original raster data; wherein, assuming that the row range and column range of any raster tile file in the original raster data are marked as (R min ,R max ,C min ,C max );
[0067] R min =(EY min -y0) / Resolution0;
[0068] R max =(EY max -yp) / Resolution0;
[0069] C min =(EX min -X0) / Resolution0;
[0070] C max =(EX max -X0) / Resolution0;
[0071] Step S18, determining the sampling interval corresponding to each level when sampling; wherein the sampling interval setting for each level is as follows:
[0072] RH=(R max -R min ) / 256;
[0073] CH=(C max -C min ) / 256;
[0074] Step S19, drawing a tile graphic; wherein the drawn tile graphic is the raster tile file; the tile file is a png picture with RBG color channels, and each pixel value is an RGB value:
[0075] R(i,j)=R0(r i ,c i );
[0076] G(i,j)=G0(r i ,c i );
[0077] B(i,j)=B0(r i ,c i );
[0078] r i =Rmin +RH*j;
[0079] c i =C min +CH*j;
[0080] 0 < i < 256, 0 < j < 256, G0 is the pixel of the original raster data;
[0081] Step S2, perform indexing processing on each generated raster tile file in the stratified and tiled manner, and map each raster tile file to the corresponding spatial data table one by one, and obtain the metadata table corresponding to the spatial data table; wherein, each record in the spatial data table corresponds to a raster tile file, and the metadata information of the corresponding spatial data table is recorded in the metadata table;
[0082] Step S3, perform storage processing on all the generated raster tile files; wherein, in this embodiment, the storage process of the raster tile files includes the following steps S31 - S32:
[0083] Step S31, obtain the row number and column number of each raster tile file according to the calculated coordinate range of each raster tile file;
[0084] Step S32, store the obtained raster tile file, the row number and column number of the raster tile file according to the preset storage path; for example, the preset storage path here is "level / row number / " + "column number" + ".png";
[0085] Step S4, create a raster spatial database according to the spatial data table and the metadata table corresponding to the spatial data table; wherein, the creation process of the raster spatial database here is as follows steps S41 - S43:
[0086] Step S41, set the library format of the raster spatial database; wherein, the raster spatial database includes a metadata table and a raster tile file storage table, and the structure fields of the raster tile file storage table include level, row number, column number, and raster tile file data;
[0087] Step S42, import the generated raster tile file data, and convert the generated data of each raster tile file into a binary data stream, and write it into the metadata table;
[0088] Step S43, write the metadata information in the metadata table into the raster tile file storage table; wherein, the metadata information includes coordinate name, level, range, starting coordinate, and data name;
[0089] Step S5, perform raster tile file retrieval; wherein, in this embodiment, the process of raster tile file retrieval includes the following steps S51 - S53:
[0090] Step S51, determining the coordinates and level of any target point in the same coordinate system in the raster tile file; for example, the coordinates of the any target point A determined here are (x, y), and the level of the any target point A is marked as level;
[0091] Step S52, calculating the row number and column number of the raster tile file corresponding to the arbitrary target point; wherein, specifically for the arbitrary target point A mentioned above, the row number of the raster tile file corresponding to the target point A is marked as R, and the column number of the raster tile file corresponding to the target point A is marked as C:
[0092] R = (Y-Y0) / 256*Resolution;
[0093] C = (X-X0) / 256*Resolution;
[0094] Step S53, searching the raster space database for records according to the calculated row number, column number and level of the raster tile file, and reading the image data of the raster tile file;
[0095] Step S6, creating a custom vector space database for the vector data in the spatial data; wherein the process of creating the custom vector space database includes the following steps S61 to S63:
[0096] Step S61, establishing a table structure, wherein each vector data corresponds to a data table;
[0097] Step S62, importing the attribute data of each vector data into the data table corresponding to the vector data;
[0098] Step S63, creating a SHAPE file storing image data in each data table; wherein the name of each data table is the layer name;
[0099] Step S7, compressing the data in the raster space database and the custom vector space database respectively to obtain parsable compressed data packets.
[0100] Of course, as needed, after executing step S7, each compressed data packet may be sent to the server.
[0101] In addition, this embodiment further provides a mobile device. Specifically, the mobile device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the above-mentioned low-coupling spatial data processing method is implemented.
[0102] Although the preferred embodiments of the present invention are described in detail above, it should be clearly understood that various modifications and variations are possible for those skilled in the art. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A low-coupling spatial data processing method, characterized in that: The steps include: Step S1, performing map cache processing on the raster data in the spatial data to generate a plurality of raster tile files of preset scales; Step S2, indexing each generated raster tile file in a hierarchical and framing manner, and mapping each raster tile file to a corresponding spatial data table one by one, and obtaining a metadata table corresponding to the spatial data table; wherein each record in the spatial data table corresponds to a raster tile file, and the metadata table records metadata information of the corresponding spatial data table; Step S3, storing and processing all generated raster tile files; Step S4, creating a raster spatial database according to the spatial data table and the metadata table corresponding to the spatial data table; Step S5, performing raster tile file retrieval; Step S6, creating a custom vector space database for the vector data in the spatial data; Step S7, compressing the data in the raster space database and the custom vector space database respectively to obtain a parsable compressed data packet; wherein: In step S1, the process of generating the raster tile file includes the following steps S11 to S19: Step S11, selecting the original raster data with coordinate information of the target space range; Step S12, determining the pixels of each raster tile file to be generated; Step S13, determining the calculation origin of the grid tile file, and making the positions of the grid tile files in the same coordinate system uniform; Step S14, according to different preset scales, respectively setting the level corresponding to each preset scale and the distance represented by the pixel of each raster tile file; Step S15, obtaining the data range and pixel matrix of the original raster data by checking the file attributes, and calculating the representative distance of each pixel; Step S16, calculating the total number of raster tile files corresponding to each level and the coordinate range of each raster tile file; Step S17, calculating the row range and column range of each raster tile file in the original raster data; Step S18, determining the sampling interval corresponding to sampling at each level; Step S19, drawing a tile graphic; wherein the drawn tile graphic is the raster tile file; In step S4, the creation process of the raster spatial database is as follows: steps S41 to S43: Step S41, setting the library format of the raster space database; wherein the raster space database includes a metadata table and a raster tile file storage table, and the structure fields of the raster tile file storage table include a level, a row number, a column number and raster tile file data; Step S42, importing the generated raster tile file data, converting each generated raster tile file data into a binary data stream, and writing it into the metadata table; Step S43, writing the metadata information in the metadata table into the raster tile file storage table; wherein the metadata information includes coordinate name, level, range, starting point coordinates and data name.
2. The low-coupling spatial data processing method according to claim 1, characterized in that: In step S3, the storage process of the grid tile file includes the following steps S31-S32: Step S31, obtaining the row number and column number of each raster tile file according to the calculated coordinate range of each raster tile file; Step S32: storing the obtained raster tile file, the row number and the column number of the raster tile file according to a preset storage path.
3. The low-coupling spatial data processing method according to claim 1, characterized in that: In step S5, the process of performing raster tile file retrieval includes the following steps S51 to S53: Step S51, determining the coordinates and level of any target point in the same coordinate system in the raster tile file; Step S52, calculating the row number and column number of the raster tile file corresponding to any target point; Step S53, based on the calculated row number, column number and level of the raster tile file, a record search is performed on the raster space database, and the image data of the raster tile file is read.
4. The low-coupling spatial data processing method according to claim 1, characterized in that: In step S6, the process of creating the custom vector space database includes the following steps S61 to S63: Step S61, establishing a table structure, wherein each vector data corresponds to a data table; Step S62, importing the attribute data of each vector data into the data table corresponding to the vector data; Step S63, creating a SHAPE file for storing image data in each data table; wherein the name of each data table is the layer name.
5. The low-coupling spatial data processing method according to any one of claims 1 to 4, characterized in that: After step S7, the method further includes: sending each compressed data packet to a server.
6. A mobile device, characterized in that The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the low-coupling spatial data processing method as claimed in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Storage and retrieval method and system for large-scale geographic space data
CN111782742A
Generalized, differentially encoded, indexed raster vector data and schema for maps on a personal digital assistant
US6674445B1
