Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for publishing a tile map, so as to solve the problems that in the prior art, when a remote sensing image is published as a tile map, all remote sensing data is sliced, a large number of tile map files are generated in the slicing process, and a large amount of manpower, time and storage space are consumed. The specific scheme is as follows:
a method for publishing a tile map comprises the following steps:
when a target tile in a target area browsed by a user is detected, calculating a target space range of the target tile;
acquiring target remote sensing data matched with the target space range from a remote sensing database generated by a preset method according to the target space range;
cutting the target remote sensing data into intermediate data;
populating the intermediate data into the target tile.
The method optionally includes generating the remote sensing database by using a preset method, including:
analyzing the remote sensing data of the target area, and determining a layer contained in the remote sensing data;
acquiring a target space coordinate system of the layer and a space coordinate system of each remote sensing data in the layer;
recording the remote sensing data in the layer, which is different from the target space coordinate system, into the remote sensing database without recording, and recording first basic information and the layer of the rest remote sensing data into the remote sensing database, wherein the first basic information comprises: file path, spatial information, spatial range and spectral information;
and updating the spatial information boundary of the current updated layer in the remote sensing database.
Optionally, the method for obtaining target remote sensing data matched with the target space range from a remote sensing database generated by a preset method according to the target space range includes:
traversing the remote sensing database, and acquiring the spatial range of each remote sensing data of a specified layer in the remote sensing database;
comparing the target spatial range to each spatial range;
and taking the remote sensing data intersected with the target space range in each space range as target remote sensing data.
Optionally, the method for segmenting the target remote sensing data into intermediate data includes:
second basic information and a file list of the target tile are obtained, wherein the file list comprises target remote sensing data corresponding to the target tile, and the second basic information comprises: the spatial range, the length and width of the tile and the spectrum are in corresponding relation;
and traversing the file list, and performing region cutting on the remote sensing data according to the second basic information to obtain intermediate data.
The foregoing method, optionally, filling the intermediate data into the target tile, includes:
acquiring a spatial range of the intermediate data;
and filling the intermediate data into the target area according to the space range.
The method optionally further comprises
Judging whether the target area is completely filled;
if yes, acquiring a browsing format of the target tile;
and compressing the intermediate data according to the browsing format.
A distribution device of a tile map, comprising:
the calculation module is used for calculating a target space range of a target tile when the target tile in a target area browsed by a user is detected;
the acquisition module is used for acquiring target remote sensing data matched with the target space range from a remote sensing database generated by a preset method according to the target space range;
the segmentation module is used for segmenting the target remote sensing data into intermediate data;
a filling module for filling the intermediate data into the target tile.
The above apparatus, optionally, the obtaining module includes:
the layer determining unit is used for analyzing the remote sensing data of the target area and determining a layer contained in the remote sensing data;
the first acquisition unit is used for acquiring a target space coordinate system of the layer and a space coordinate system of each remote sensing data in the layer;
the recording unit is used for recording the remote sensing data in the layer, which is different from the target space coordinate system, into the remote sensing database without recording, and recording first basic information and the layer of the rest remote sensing data into the remote sensing database, wherein the first basic information comprises: file path, spatial information, spatial range and spectral information;
and the updating unit is used for updating the spatial information boundary of the current updated layer in the remote sensing database.
The above apparatus, optionally, the obtaining module includes:
the second acquisition unit is used for traversing the remote sensing database and acquiring the spatial range of each remote sensing data of the specified layer in the remote sensing database;
a comparison unit for comparing the target spatial range with each spatial range;
and the remote sensing data determining unit is used for taking the remote sensing data intersected with the target space range in each space range as target remote sensing data.
The above apparatus, optionally, the cutting module includes:
a third obtaining unit, configured to obtain second basic information of the target tile and a file list, where the file list includes target remote sensing data corresponding to the target tile, and the second basic information includes: the spatial range, the length and width of the tile and the spectrum are in corresponding relation;
and the cutting unit is used for traversing the file list and cutting the area of the remote sensing data according to the second basic information to obtain intermediate data.
Compared with the prior art, the invention has the following advantages:
the invention discloses a method for releasing a tile map, which comprises the following steps: when a target tile in a target area browsed by a user is detected, calculating a target space range of the target tile; acquiring target remote sensing data matched with the target space range from a remote sensing database generated by a preset method according to the target space range; cutting the target remote sensing data into intermediate data; populating the intermediate data into the target tile. According to the publishing method, the remote sensing data corresponding to the target tile can be segmented only when the user browses the target tile, all the remote sensing data of the target area do not need to be segmented in advance, the number of generated tile map files is small, and manpower, time and storage space are saved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention discloses a method and a device for publishing a tile map, which are applied to the process of publishing a remote sensing image as the tile map, wherein the tile map is a multi-resolution hierarchical model, the resolution is lower from the bottom layer to the top layer of a tile pyramid, and the represented geographical range is unchanged. The conventional release process needs a slicing process, namely slicing operation is carried out on all data of the remote sensing image according to the hierarchy. The generation of tile map files in the slicing process requires a large amount of labor, time, and storage space. The invention provides a method for issuing a tile map, which is used for solving the problems, and the execution flow of the issuing method is shown as a figure 1, and the method comprises the following steps:
s101, when a target tile in a target area browsed by a user is detected, calculating a target space range of the target tile;
in the embodiment of the present invention, the target area is an area currently browsed by a user, where the target area includes multiple tiles, the target tile is a tile that needs to be subjected to tile map publishing among the multiple tiles, there may be multiple target tiles, when the user browses the target tile in the target area, an access request is generated, and a corresponding relationship between RGB and a remote sensing spectrum is obtained by a map layer, an access level, a scale, a tile length and width, a tile row and column number, and spectrum information included in the access request. Parameters in the access request are distributed in advance according to an open Geospatial information consortium (ogc).
And acquiring an access level, a scale and a Tile row and column number in the access request, and calculating a target space range of the target Tile through the access level, the scale and the Tile row and column number according to a Map slicing service WMTS (Web Map Tile service) in the OGC. And the target control space range and the target tiles have a corresponding relation, and if the number of the target tiles is multiple, the number of the target space ranges is also multiple.
S102, acquiring target remote sensing data matched with the target space range from a remote sensing database generated by a preset method according to the target space range;
in the embodiment of the invention, according to the target space range, whether target remote sensing data intersected with the target space range exists in the remote sensing database or not is searched in the remote sensing database, if so, the target remote sensing data is obtained, otherwise, the target space range is subjected to default filling, wherein the default filling can be completely black, completely white or other preferred filling modes.
S103, dividing the target remote sensing data into intermediate data;
in the embodiment of the present invention, second basic information of the target tile and a file list are obtained, where the file list includes target remote sensing data corresponding to the target tile, and the second basic information includes: the file list is obtained by searching target remote sensing data matched with the target space range in the remote sensing database, and the number of the target remote sensing data in the file list can be multiple. Traversing the file list, and performing region cutting on the remote sensing data according to the corresponding relation of the space range, the tile length and width and the spectrum in the second basic information to obtain intermediate data.
The processing of the corresponding relation of the spectrums is added in the splitting process, so that browsing supporting different spectrum mappings can be realized, for example, a multispectral image contains 4 spectrum information: red, green, blue and near red, and if the output spectrum set in the slicing process is near red, green and blue, the output tile map no longer contains red wave information.
And S104, filling the intermediate data into the target tile.
In the embodiment of the invention, the spatial range of the intermediate data is obtained, the target tiles with the same spatial range are searched in the target tiles according to the spatial range, and the intermediate data is filled into the corresponding target tiles in the target area.
Further, for the same space range, it may include multiple pieces of intermediate data, for example, intermediate data at different times, and preferably, when filling is performed, the intermediate data at the latest time is filled, so as to avoid that the newly filled intermediate data is not covered, before each filling, it may be determined whether the target area is completely filled, and if so, the browsing format of the target tile is obtained, and the intermediate data is compressed according to the browsing format. And otherwise, acquiring next intermediate data adjacent to the intermediate data for judgment until the plurality of intermediate data are judged.
The invention discloses a method for releasing a tile map, which comprises the following steps: when a target tile in a target area browsed by a user is detected, calculating a target space range of the target tile; acquiring target remote sensing data matched with the target space range from a remote sensing database generated by a preset method according to the target space range; cutting the target remote sensing data into intermediate data; populating the intermediate data into the target tile. According to the publishing method, the remote sensing data corresponding to the target tile can be segmented only when the user browses the target tile, all the remote sensing data of the target area do not need to be segmented in advance, the number of generated tile map files is small, and manpower, time and storage space are saved.
In the embodiment of the present invention, the remote sensing database is pre-established by a preset method, and a specific establishment process is shown in fig. 2, and includes the steps of:
s201, analyzing the remote sensing data of the target area, and determining a layer contained in the remote sensing data;
in the embodiment of the invention, the remote sensing data of the target area is analyzed to obtain a storage path of the remote sensing data, the remote sensing data can be divided into a plurality of layers according to a folder or a space range stored by the remote sensing data under the storage path, preferably, all the remote sensing data in each layer can be traversed and arranged into a file list, wherein the file list comprises first basic information of the remote sensing data.
S202, acquiring a target space coordinate system of the layer and a space coordinate system of each remote sensing data in the layer;
in the embodiment of the present invention, preferably, a target spatial coordinate system is pre-allocated to each layer, and for each layer, a spatial coordinate system of each piece of remote sensing data included in the layer is acquired.
S203, recording the remote sensing data in the layer, which is different from the target space coordinate system, into the remote sensing database without recording first basic information and the layer of the rest remote sensing data;
in the embodiment of the present invention, for each layer, the target spatial coordinate system is compared with a spatial coordinate system of each piece of remote sensing data, when there exists remote sensing data with different spatial coordinate systems, the remote sensing data is not entered, and first basic information and the layer of the rest remote sensing data are entered into the remote sensing database, where the first basic information includes: file path, spatial information, spatial range, and spectral information. Preferably, when the remote sensing database is entered, a layer ID is allocated to each layer, and an index can be established according to the spatial information.
And S204, updating the spatial information boundary of the current updated layer in the remote sensing database.
In the embodiment of the invention, the spatial information boundaries of the layers are updated by adopting the spatial information boundaries of the file list file aiming at the current updated layer, and when the updating is completed, the construction of the remote sensing database is completed.
In the embodiment of the present invention, the issuing method submits the access request through the client in actual application, and a specific execution process of processing at the server includes the steps of:
s1 remote sensing data warehousing and publishing, comprising the steps of:
s11, submitting the issuing request: a user opens a system at a client, sets first basic information (such as a layer name and space coordinate system information) of data to be issued and a folder path contained in a 'layer', and sends a request to a server;
s12, establishing layer records: after receiving a user request, the server creates a layer record in a database and generates a serial number ID, and traverses all remote sensing image data in a folder specified in the layer and generates a file list;
s13, processing the remote sensing image file: the server sequentially accesses the files in the file list, when the spatial coordinate system of the files is consistent with the type of the layer spatial coordinate, the first basic information (including file paths, spatial information, spatial ranges and spectral information) and the layer numbers of the files are recorded into the database, and an index is created according to the spatial information.
S14, updating the spatial information boundary: and after the file list is traversed, the server updates the spatial information boundary of the layer by using the spatial information boundary of the warehousing list file, and completes the warehousing and release of the data.
S2 tile map request processing, comprising the steps of:
s21, submitting an access request by a user;
specifically, a user selects a layer to be browsed at a client and sends a tile map access request to a server, wherein the request parameters mainly comprise: layer ID, scale, access level, tile length and width, tile row and column number, spectral information or corresponding relation between RGB and remote sensing spectrum and the like;
s22: calculating a geospatial range;
specifically, after receiving a tile request sent by a user, a server calculates a spatial range corresponding to a tile area according to a service request level, a scale and a row and column number;
s23: submitting a tile generation request;
specifically, the server retrieves a remote sensing image file in a corresponding geographic range and request information (including tile spatial range, tile length and width, spectrum correspondence and the like) of a tile from a remote sensing database according to the layer ID and the spatial range, and packs the remote sensing image file and the request information as input information of the tile generation module;
s24: generating intermediate data;
specifically, after receiving the request, the server tile generation module parses the request parameters, and the tile generation module performs file clipping and tile synthesis according to the parameters, and then compresses the synthesized tiles.
S25: returning intermediate data:
and feeding back the map tiles to the user side.
The specific execution flow of S24 is shown in fig. 3, and includes the steps of: analyzing and acquiring second basic information of a tile to be generated and a file list required by the generation of the tile, acquiring the ith (i is initialized to be 0) file in the file list, wherein each file represents remote sensing data, performing area cutting according to set spectral color mapping by using a tile geographic range boundary, sequentially filling the cutting data into a map tile memory according to geographic positions, and judging whether the tile is filled or not? If the file list is full, compressing the tile content according to a set format and returning the compressed content, otherwise, judging whether the file list is completely accessed, and executing the tile content according to the set format and returning the compressed content after the access is finished.
The purpose of judging whether the tile is filled is to avoid repeatedly filling and covering the content which is expected to be displayed in the tile, for example, a tile map at the latest moment is already displayed in the current tile, and if the current tile does not correspond to other remote sensing data, the tile map at the latest moment may be covered, so that the content displayed by the map has deviation.
In the embodiment of the invention, the publishing method comprises the steps of firstly inputting the spatial coordinate information and the spectral information of the remote sensing data into a remote sensing database to establish a spatial index and publish the spatial index as a service, when a user browses a certain tile of a certain tile map service, calculating the spatial range of the tile according to the tile level, the row number and the column number, retrieving the remote sensing image data in the corresponding spatial range from the database, reading the image file as required according to the browsing request mode of the user and generating the tile map.
Based on the foregoing publishing method of the tile map, in an embodiment of the present invention, a publishing device of the tile map is further provided, and a structural block diagram of the publishing device is shown in fig. 4, where the publishing device includes:
a calculation module 301, an acquisition module 302, a segmentation module 303 and a filling module 304.
Wherein,
the calculating module 301 is configured to, when a target tile in a target area browsed by a user is detected, calculate a target spatial range of the target tile;
the obtaining module 302 is configured to obtain target remote sensing data matched with the target spatial range from a remote sensing database generated by using a preset method according to the target spatial range;
the segmentation module 303 is configured to segment the target remote sensing data into intermediate data;
the filling module 304 is configured to fill the intermediate data into the target tile.
The invention discloses a device for releasing a tile map, which comprises: when a target tile in a target area browsed by a user is detected, calculating a target space range of the target tile; acquiring target remote sensing data matched with the target space range from a remote sensing database generated by a preset method according to the target space range; cutting the target remote sensing data into intermediate data; populating the intermediate data into the target tile. According to the publishing device, the remote sensing data corresponding to the target tile can be segmented only when the user browses the target tile, all the remote sensing data of the target area do not need to be segmented in advance, the number of generated tile map files is small, and manpower, time and storage space are saved.
In this embodiment of the present invention, the obtaining module 302 includes:
a layer determining unit 305, a first obtaining unit 306, an entry unit 307, and an updating unit 308.
Wherein,
the layer determining unit 305 is configured to analyze the remote sensing data of the target area, and determine a layer included in the remote sensing data;
the first obtaining unit 306 is configured to obtain a target spatial coordinate system of the layer and a spatial coordinate system of each piece of remote sensing data in the layer;
the entry unit 307 is configured to not enter the remote sensing number in the layer, which is different from the target spatial coordinate system, and enter the first basic information of the remaining remote sensing data and the layer into the remote sensing database, where the first basic information includes: file path, spatial information, spatial range, and spectral information.
The updating unit 308 is configured to update the spatial information boundary of the current updated layer in the remote sensing database.
In this embodiment of the present invention, the obtaining module 302 includes:
a second acquisition unit 309, a comparison unit 310 and a remote sensing data determination unit 311.
Wherein,
the second obtaining unit 309 is configured to traverse the remote sensing database, and obtain a spatial range of each remote sensing data of a specified layer in the remote sensing database;
the comparing unit 310 is configured to compare the target spatial range with each spatial range;
and the remote sensing data determining unit 311 is configured to use the remote sensing data in each spatial range, which intersects with the target spatial range, as target remote sensing data.
In this embodiment of the present invention, the dividing module 303 includes:
a third acquisition unit 312 and a cropping unit 313.
Wherein,
the third obtaining unit 312 is configured to obtain second basic information of the target tile and a file list, where the file list includes target remote sensing data corresponding to the target tile, and the second basic information includes: the spatial range, the length and width of the tile and the spectrum are in corresponding relation;
and the cutting unit 313 is configured to traverse the file list, and perform area cutting on the remote sensing data according to the second basic information to obtain intermediate data.
It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The method and the device for publishing the tile map provided by the invention are described in detail, a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the embodiment is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.