Raster data vectorization method, equipment and medium

Through breadth-first search queues and specific sequential traversal, the problem of redundant segments and hole recognition in raster data to vectorization is solved, efficient vectorization and GeoJSON compatibility is achieved, and the accuracy and completeness of vector graphics are ensured.

CN120256533APending Publication Date: 2025-07-04INSPUR SMART TECH INNOVATION (SHANDONG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510305855.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

Existing raster data to vectorization methods are prone to generate redundant segments, and it is difficult to deal with the voids on the surface, and cannot be directly compatible with the void boundaries of complex structures in modern geographic data standards such as GeoJSON.

Method used

A breadth-first search queue is used to convert raster data into a matrix, group iterates through the numerical size of the element, and traverses eight domain elements in a specific order to generate a GeoJSON data structure to accurately represent the outer boundaries of the graph and the inner hollow boundaries.

Benefits of technology

Improve data conversion efficiency, avoid redundant lines in the result data, ensure that vector graphics accurately restore the original shape, and facilitate connection with formats such as GeoJSON, and realize the precise vectorization of complex planar graphics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256533A_ABST
    Figure CN120256533A_ABST
Patent Text Reader

Abstract

The invention discloses a raster data vectorization method and device and a medium, and the method comprises the steps: converting raster data to be vectorized into a matrix, grouping the elements of the matrix according to the numerical values of the elements, and sequentially inputting each group of elements into a breadth-first search queue; adding the four-corner coordinates of the queue head element of each group into an initialization result queue according to a certain sequence, judging whether eight field elements of the queue head element can be enqueued or not according to a certain sequence, adding the four-corner coordinates of the enqueued element into the initialization result queue, and judging whether the eight field elements of the enqueued element can be enqueued or not again, so as to circularly traverse; when elements do not exist in each group, obtaining a result queue of each group; and displaying each group of result queues through a planar vector diagram. Through the breadth-first search queue, the data conversion efficiency is improved, traversal is carried out in a specific sequence, and redundant lines in result data can be avoided. A plurality of sub-arrays are used in a GeoJSON data structure, so that a planar graph with voids is accurately represented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of geographic information systems, and in particular, to a method, device, and medium for raster data vectorization. Background Art

[0002] Raster data vectorization is a basic technology in the fields of geographic information systems (GIS), remote sensing image processing, and computer graphics. Its core goal is to convert pixel-based raster data into vector data composed of points, lines, and faces for spatial analysis, visualization, and data compression.

[0003] Currently, the graphic boundary is determined by pixel-by-pixel scanning, but its traversal order depends on the starting point selection, which is prone to generating redundant line segments in complex boundaries or intersection areas. Although some improved algorithms attempt to improve the vectorization accuracy by combining multiple rule judgments or hierarchical processing. However, it is still unable to effectively distinguish the boundaries between the outer contour and internal holes, and relies on post-processing steps to eliminate redundant line segments.

[0004] In addition, the vector data formats generated by existing methods (such as Shapefile) usually only support simple polygon representations, but it is difficult to directly be compatible with the complex structure of "nested holes in planar graphics" in modern geographic data standards (such as GeoJSON), and the ability to identify hole boundaries is limited. Summary of the Invention

[0005] Embodiments of this application provide a method, device, and medium for raster data vectorization to solve the problems that the existing raster-to-vector data method is prone to generating redundant line segments and cannot handle holes on the surface.

[0006] Embodiments of this application adopt the following technical solutions: On the one hand, embodiments of this application provide a method for raster data vectorization. The method includes: This application discloses a method, device, and medium for raster data vectorization. The method includes: converting the raster data to be vectorized into a matrix, grouping the elements of the matrix according to the element numerical size, and sequentially inputting the elements of each group into a breadth-first search queue; adding the four-corner coordinates of the head element of each group to the initialization result queue in order, and judging whether the eight-neighborhood elements of the head element can be enqueued in a certain order, adding the four-corner coordinates of the enqueued elements to the initialization result queue, and judging again whether the eight-neighborhood elements of the enqueued elements can be enqueued, and looping through this way until there are no elements in each group, obtaining the result queue of each group; respectively displaying the result queue of each group through a planar vector graph.

[0007] In one example, before grouping the elements of the matrix according to the element value size, the method further includes: determining whether the matrix is an empty matrix; if the matrix is a non-empty matrix, determining whether the matrix has only one element; if the matrix has only one element, displaying the one element through a planar vector diagram; if the matrix is an empty matrix, recycling the data to be vectorized.

[0008] In one example, before adding the four corner coordinates of the leading element of each group to the initialization result queue in the order of upper left, upper right, lower right, and lower left, the method further includes: determining whether the leading element of each group is an empty element; when the leading element is an empty element, re-specifying a new leading element until the leading element is in a non-empty state; when the leading element is a non-empty element, marking the leading element as a searched state.

[0009] In one example, determining whether the eight-neighborhood elements of the leading element can be enqueued in the order of up, down, left, right, upper right, upper left, lower right, and lower left specifically includes: in the order of up, down, left, right, upper right, upper left, lower right, and lower left, sequentially determining whether there are corresponding eight-neighborhood elements for the leading element in eight adjacent directions; when there are corresponding eight-neighborhood elements, determining whether the corresponding eight-neighborhood elements are in a searched state; when they are not in a searched state, determining the orientation of the corresponding eight-neighborhood elements, and according to the orientation of the corresponding eight-neighborhood elements, determining the starting and ending points of the corner coordinates and the corner coordinate search direction of the corresponding eight-neighborhood elements; according to the starting and ending points of the corner coordinates and the corner coordinate search direction of the corresponding eight-neighborhood elements, enqueuing the corresponding eight-neighborhood elements; when they are in a searched state, determining that the corresponding eight-neighborhood elements are not enqueued.

[0010] In one example, determining the starting and ending points of the corner coordinates of the corresponding eight-neighborhood elements according to the orientation of the corresponding eight-neighborhood elements specifically includes: if the orientation of the corresponding eight-neighborhood element is above, the corresponding starting and ending points of the corner coordinates are the upper left corner and the upper right corner of the leading element; if the orientation of the corresponding eight-neighborhood element is below, the corresponding starting and ending points of the corner coordinates are the lower right corner and the lower left corner of the leading element; if the orientation of the corresponding eight-neighborhood element is to the left, the corresponding starting and ending points of the corner coordinates are the lower left corner and the upper left corner of the leading element; if the orientation of the corresponding eight-neighborhood element is to the right, the corresponding starting and ending points of the corner coordinates are the upper right corner and the lower right corner of the leading element; if the orientation of the corresponding eight-neighborhood element is upper right, the corresponding starting and ending points of the corner coordinates are the upper right corner of the leading element; if the orientation of the corresponding eight-neighborhood element is upper left, the corresponding starting and ending points of the corner coordinates are the upper left corner of the leading element; if the orientation of the corresponding eight-neighborhood element is lower right, the corresponding starting and ending points of the corner coordinates are the lower right corner of the leading element; if the orientation of the corresponding eight-neighborhood element is lower left, the corresponding starting and ending points of the corner coordinates are the lower left corner of the leading element.

[0011] In one example, according to the orientation of the corresponding eight-neighborhood elements, determining the angular coordinate search direction of the corresponding eight-neighborhood elements specifically includes: If the search direction is downward and to the right, add the four corner coordinates of the head element of the queue to the result list in the order of the upper right corner, the lower right corner, the lower left corner, and the upper left corner; if the search direction is upward and to the right, add the four corner coordinates of the head element of the queue to the result list in the order of the upper left corner, the upper right corner, the lower right corner, and the lower left corner; if the search direction is downward and to the left, add the four corner coordinates of the head element of the queue to the result list in the order of the lower right corner, the lower left corner, the upper left corner, and the upper right corner; if the search direction is upward and to the left, add the four corner coordinates of the head element of the queue to the result list in the order of the lower left corner, the upper left corner, the upper right corner, and the lower right corner; if the search direction is to the right, add the four corner coordinates of the head element of the queue to the result list in the order of the upper right corner and the lower right corner; if the search direction is to the left, add the four corner coordinates of the head element of the queue to the result list in the order of the lower left corner and the upper left corner; if the search direction is upward, add the four corner coordinates of the head element of the queue to the result list in the order of the upper left corner and the upper right corner; if the search direction is downward, add the four corner coordinates of the head element of the queue to the result list in the order of the lower right corner and the lower left corner.

[0012] In one example, before grouping the elements of the matrix according to the element value size, the method further includes: If the matrix is a sparse matrix, record the positions and values of the non-zero elements in the form of key-value pairs to generate a matrix element record table; grouping the elements of the matrix according to the element value size specifically includes: grouping the elements of the matrix according to multiple preset element value intervals and the matrix element record table.

[0013] In one example, converting the raster data to be vectorized into a matrix specifically includes: determining the row-column structure of the raster and the row and column where each pixel is located in the matrix to convert the raster data to be vectorized into a matrix; the row number of the raster corresponds to the row index of the matrix, and the column number corresponds to the column index of the matrix; after converting the raster data to be vectorized into a matrix, the method further includes: If the matrix is a sparse matrix, record the positions and values of the non-zero elements in the form of key-value pairs.

[0014] On the other hand, an embodiment of the present application provides a raster data vectorization device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute a raster data vectorization method of any one of the above.

[0015] On the other hand, an embodiment of the present application provides a non-volatile computer storage medium for raster data vectorization, storing computer-executable instructions that can execute a raster data vectorization method of any one of the above.

[0016] The above at least one technical solution adopted in the embodiments of the present application can achieve the following beneficial effects: By adopting a breadth-first search queue, the present application improves the data conversion efficiency. Traversing in a specific order of up, down, left, right, upper right, upper left, lower right, and lower left can avoid redundant lines in the result data and ensure that the generated vector graphics can accurately restore the shape of the original graphics. By using multiple sub-arrays in the GeoJSON data structure, the first sub-array describes the outer boundary of the graphic, and the subsequent sub-arrays describe the boundaries of the internal "holes", accurately representing the planar graphic with holes. By converting the raster data into a matrix form, the breadth-first search algorithm can be directly applied to traverse adjacent elements. And it is convenient to dock with vector data formats such as GeoJSON to achieve the accurate vectorization of complex planar graphics (including holes). BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the present application, some embodiments of the present application will be described in detail below with reference to the drawings. In the drawings: Figure 1 is a schematic flowchart of a raster data vectorization method provided by an embodiment of the present application; Figure 2 is a matrix-to-GeoJSON diagram of a raster data vectorization method provided by an embodiment of the present application; Figure 3 is a diagram of breadth-first search traversal of matrix element grouping provided by an embodiment of the present application for a raster data vectorization method; Figure 4 is a diagram of adding the four-corner coordinates of elements to the result queue in order provided by an embodiment of the present application for a raster data vectorization method; Figure 5 is a diagram of enqueueing unvisited surrounding elements of an element provided by an embodiment of the present application for a raster data vectorization method; Figure 6 is a diagram of the result of traversing surrounding elements not in the specified order provided by an embodiment of the present application for a raster data vectorization method; Figure 7 is a diagram of the breadth-first search result provided by an embodiment of the present application for a raster data vectorization method; Figure 8 is a schematic structural diagram of a raster data vectorization device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts belong to the scope of protection of this application.

[0019] The following will refer to the drawings to elaborate on some embodiments of this application in detail.

[0020] Figure 1 It is a schematic flowchart of a raster data vectorization method provided by an embodiment of this application. This method can be applied to different business fields. Some input parameters or intermediate results in this process allow manual intervention and adjustment to help improve accuracy.

[0021] The implementation of the analysis method involved in the embodiments of this application can be a terminal device or a server, and this application does not impose special restrictions on this. For the convenience of understanding and description, the following embodiments will be described in detail taking the controller as an example.

[0022] It should be noted that: BFS (Breadth-First Search), that is, breadth-first search, is an algorithm used to traverse or search a tree or graph. Its basic idea is: starting from the root node (or the starting node), first visit all adjacent nodes of this node, and then visit these adjacent nodes one by one in the order they are discovered. For each visited node, then visit all its unvisited adjacent nodes, and so on, until all reachable nodes are visited.

[0023] Sparse matrix: The number of non-zero elements in the matrix is much less than the total number of matrix elements, and the distribution of non-zero elements has no pattern. Generally, when the ratio of the total number of non-zero elements in the matrix to the total number of all matrix elements is less than or equal to 0.05, the matrix is called a sparse matrix, and this ratio is called the density of this matrix. The storage method of the sparse matrix used in this article stores all-dimensional data using one-dimensional index compression, and uses index values and element value key values to represent all elements of the sparse matrix.

[0024] GeoJSON: A geospatial data interchange format based on JSON (JavaScript Object Notation). It is used to encode various geospatial data structures, such as geometric shapes like points, lines, and polygons, as well as the attribute information of these geometric shapes. A GeoJSON object can represent geometric objects (such as points, lines, polygons), features, or a feature collection. A feature object not only contains a geometric object but also the associated attribute information, such as a name, area, etc. A feature collection is a collection of features used to represent more complex geospatial regions or datasets and is commonly used for browser display of vector graphics.

[0025] Based on this, Figure 1 the process in S101: Convert the raster data to be vectorized into a matrix; there is a corresponding relationship between raster pixels and matrix elements.

[0026] It should be noted that in some embodiments of the present application, to convert raster data into a matrix, it is first necessary to determine the row-column structure of the raster and the row and column in the matrix where each pixel is located, so as to convert the raster data to be vectorized into a matrix; the row number of the raster corresponds to the row index of the matrix (such as the y coordinate), and the column number corresponds to the column index of the matrix (such as the x coordinate). The value of each pixel in the raster is used as the element value at the corresponding position in the matrix.

[0027] If the matrix is a sparse matrix, store the non-zero elements in the form of [dimension value 1, dimension value 2, element value] using key-value pairs to generate a matrix element record table; for multi-dimensional raster data (such as time series, multi-band remote sensing images), represent it by expanding the dimensions.

[0028] After mapping the raster to a matrix, the breadth-first search (BFS) algorithm can be directly applied to traverse adjacent elements, improving the data structure adaptation. The sparse matrix storage avoids redundant calculations. Combining with BFS can quickly identify the outer and inner boundaries (holes) of the graph. The matrix form is convenient for docking with vector data formats such as GeoJSON, realizing the accurate vectorization of complex planar graphs (including holes).

[0029] S102: Group the elements of the matrix according to the element numerical size, and sequentially input each group of elements into the breadth-first search queue.

[0030] It should be noted that in some embodiments of the present application, before grouping the elements of the matrix according to the element value size, it is necessary to first determine whether the transformed matrix is an empty matrix. If the matrix is a non-empty matrix, then it is determined whether the matrix has only one element. If the matrix has only one element, the single element is encapsulated into GeoJSON data in the form of a set and displayed through a polygon vector map; if the matrix is an empty matrix, the data to be vectorized is recycled.

[0031] If the matrix is a non-empty matrix and has multiple elements, then the elements of the matrix will be grouped according to the element value size, and the elements of the matrix will be grouped according to multiple preset element value intervals and the matrix element record table. For example: the elements with element values in the range of 0 to 10 form one polygon graphic, and the elements with element values in the range of 10 to 50 form another polygon graphic; the grouped elements are subjected to breadth-first search by group.

[0032] By grouping the elements, it is convenient to represent the hole part.

[0033] S103: Add the four corner coordinates of the head element of each group to the initialization result queue in the order of upper left, upper right, lower right, and lower left.

[0034] It should be noted that in some embodiments of the present application, before adding the four corner coordinates of the head element of each group to the initialization result queue in the order of upper left, upper right, lower right, and lower left, it is necessary to first determine whether the head element of each group is an empty element. Here, the head element is a randomly selected element within the group. When the head element is an empty element, a new head element will be re-specified until the head element is in a non-empty state; if the head element is a non-empty element, the head element is marked as the searched state. And the state of this element is stored in the set of searched elements. Then, the four corner coordinates of the marked non-empty head element are added to the initialization result queue in the order of upper left, upper right, lower right, and lower left.

[0035] By adding the four corner coordinates of the elements to the initialization result queue, the integrity of the vector graphic boundary is ensured; for example, when constructing the vector graphic of a lake, the four corner coordinates of each grid element representing the lake water area are combined to form the accurate boundary of the lake. If these coordinates are not recorded first, some boundary points may be missed during the subsequent search process, resulting in an incomplete boundary of the finally generated vector graphic.

[0036] S104: Determine whether the eight-neighborhood elements of the head element can be enqueued in the order of up, down, left, right, upper right, upper left, lower right, and lower left.

[0037] It should be noted that in some embodiments of the present application, in the order of up, down, left, right, upper right, upper left, lower right, and lower left, it is sequentially determined whether the leading element has corresponding eight-domain elements in eight adjacent directions. When there are corresponding eight-domain elements, it is determined whether the corresponding eight-neighborhood elements are in the searched state. When they are in the searched state, it is determined that the corresponding eight-neighborhood elements are not queued.

[0038] When they are not in the searched state, the directions of the corresponding eight-neighborhood elements are determined. According to the directions of the corresponding eight-neighborhood elements, the starting and ending points of the angular coordinates and the angular coordinate search direction of the corresponding eight-neighborhood elements are determined; according to the starting and ending points of the angular coordinates and the angular coordinate search direction of the corresponding eight-neighborhood elements, the corresponding eight-neighborhood elements are queued.

[0039] Regarding determining the starting and ending points of the angular coordinates of the corresponding eight-neighborhood elements according to the directions of the corresponding eight-neighborhood elements, specifically: if the direction of the corresponding eight-neighborhood element is upward, the starting and ending points of the angular coordinates are the upper left corner and the upper right corner of the leading element; if the direction of the corresponding eight-neighborhood element is downward, the starting and ending points of the angular coordinates are the lower right corner and the lower left corner of the leading element; if the direction of the corresponding eight-neighborhood element is leftward, the starting and ending points of the angular coordinates are the lower left corner and the upper left corner of the leading element; if the direction of the corresponding eight-neighborhood element is rightward, the starting and ending points of the angular coordinates are the upper right corner and the lower right corner of the leading element.

[0040] If the direction of the corresponding eight-neighborhood element is upper right, the starting and ending points of the angular coordinates are the upper right corner of the leading element; if the direction of the corresponding eight-neighborhood element is upper left, the starting and ending points of the angular coordinates are the upper left corner of the leading element; if the direction of the corresponding eight-neighborhood element is lower right, the starting and ending points of the angular coordinates are the lower right corner of the leading element; if the direction of the corresponding eight-neighborhood element is lower left, the starting and ending points of the angular coordinates are the lower left corner of the leading element.

[0041] Regarding determining the angular coordinate search direction of the corresponding eight-neighborhood elements according to the directions of the corresponding eight-neighborhood elements, specifically: if the search direction is from lower right to upper left, the four angular coordinates of the leading element are added to the result list in the order of upper right corner, lower right corner, lower left corner, and upper left corner; if the search direction is from upper right to lower left, the four angular coordinates of the leading element are added to the result list in the order of upper left corner, upper right corner, lower right corner, and lower left corner; if the search direction is from lower left to upper right, the four angular coordinates of the leading element are added to the result list in the order of lower right corner, lower left corner, upper left corner, and upper right corner; if the search direction is from upper left to lower right, the four angular coordinates of the leading element are added to the result list in the order of lower left corner, upper left corner, upper right corner, and lower right corner.

[0042] If the search direction is rightward, add the four-corner coordinates of the element at the head of the queue to the result list in the order of the upper right corner and the lower right corner; if the search direction is leftward, add the four-corner coordinates of the element at the head of the queue to the result list in the order of the lower left corner and the upper left corner; if the search direction is upward, add the four-corner coordinates of the element at the head of the queue to the result list in the order of the upper left corner and the upper right corner; if the search direction is downward, add the four-corner coordinates of the element at the head of the queue to the result list in the order of the lower right corner and the lower left corner.

[0043] By traversing in a specific order: up, down, left, right, upper right, upper left, lower right, lower left, redundant lines in the result data can be avoided, ensuring that the generated vector graphics can accurately restore the shape of the original graphics.

[0044] S105: Add the four-corner coordinates of the enqueued element in the eight-domain elements to the initialized result queue, and then determine again whether the eight-domain elements of the enqueued element can be enqueued. Traverse in this loop until there are no search elements in each group, and obtain the result queue for each group.

[0045] It should be noted that in some embodiments of the present application, after the element at the head of the queue is traversed, elements that can be enqueued in the eight domains will be obtained. Then, according to their positions, the elements that can be enqueued are inserted into the result queue with their four-corner coordinates according to certain rules. After that, using this enqueued element as the basis, determine whether the eight-domain elements can be enqueued in the order of up, down, left, right, upper right, upper left, lower right, lower left. Traverse in this loop until there are no search elements in each group, and obtain the result queue for each group.

[0046] S106: Encapsulate the result queue of each group into GeoJSON data in the form of a set, and display it through a planar vector map.

[0047] It should be noted that in some embodiments of the present application, after obtaining the result queue of each group, the result queue of each group is encapsulated into GeoJSON data in the form of a set. This GeoJSON data includes a main set and subsets. Then, it is displayed through a planar vector map according to the encapsulated GeoJSON data.

[0048] It should be noted that although the embodiments of the present application are described with reference to Figure 1 to introduce and explain steps S101 to S106 in sequence, this does not mean that steps S101 to S106 must be executed in a strict order. The reason why the embodiments of the present application introduce and explain steps S101 to S106 in the order shown in Figure 1 is to facilitate those skilled in the art to understand the technical solution of the embodiments of the present application. In other words, in the embodiments of the present application, the order between steps S101 to S106 can be appropriately adjusted according to actual needs.

[0049] By Figure 1 the method of, using a breadth - first search queue, the data conversion efficiency is improved. Traversing in a specific order: up, down, left, right, upper - right, upper - left, lower - right, lower - left, redundant lines in the result data can be avoided, ensuring that the generated vector graphics can accurately restore the shape of the original graphics. By using multiple sub - arrays in the GeoJSON data structure, the first sub - array describes the outer boundary of the graphic, and subsequent sub - arrays describe the boundaries of internal "holes", accurately representing a planar graphic with holes. By converting raster data into a matrix form, the breadth - first search algorithm can be directly applied to traverse adjacent elements. And it is convenient to dock with vector data formats such as GeoJSON to achieve the accurate vectorization of complex planar graphics (including holes).

[0050] Figure 2 It is a matrix - to - GeoJSON diagram of a raster data vectorization method provided by an embodiment of this application.

[0051] In Figure 2 , the steps start with judging whether the matrix is empty. If it is empty, the steps end directly; if it is not empty, judge whether the matrix has only one node. If it has only one node, generate a planar graphic of a raster point; if it does not have only one node, group the element data, and then perform a breadth - first search traversal on each group to generate a multi - faced GeoJSON result.

[0052] Figure 3 It is a diagram of breadth - first search traversal with matrix element grouping of a raster data vectorization method provided by an embodiment of this application.

[0053] In Figure 3 , the steps start with initializing the breadth - first search queue, initializing the result queue (Result), initializing the set of elements that have been searched (visited), and then dequeueing the head element of the queue. Judge whether the head element is empty. If it is empty, end directly; if it is not empty, mark the current element as searched, then add the four - corner coordinates of the current element to Result in the order of upper - left, upper - right, lower - right, lower - left, and enqueue the unsearched elements around the current element, and loop in this way.

[0054] Figure 4 It is a diagram of adding the four - corner coordinates of elements to the result queue in order of a raster data vectorization method provided by an embodiment of this application.

[0055] In Figure 4 , different coordinate routes corresponding to different search directions are shown.

[0056] Figure 5It is a diagram showing the enqueue processing of unvisited surrounding elements in a raster data vectorization method provided by an embodiment of the present application.

[0057] In Figure 5 it shows the process of whether the entire eight-field elements can be enqueued, and shows the start and end points of the insertion coordinates corresponding to each direction.

[0058] Figure 6 It is a diagram showing the result of traversing the surrounding elements not in the specified order in a raster data vectorization method provided by an embodiment of the present application.

[0059] In Figure 6 it shows the result of traversing the surrounding elements not in the specified order, with a red internal line appearing. The boundary of the planar graph will appear inside the graph, and such data will increase the pressure during the drawing process.

[0060] Figure 7 It is a diagram showing the breadth-first search result in a raster data vectorization method provided by an embodiment of the present application.

[0061] In Figure 7 it shows the vector graph generated after traversing according to the breadth-first search method, where a group of numerical grids in a certain area are surrounded by other numerical values and are shown as holes.

[0062] Figure 8 It is a schematic structural diagram of a raster data vectorization device provided by an embodiment of the present application, including: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute a raster data vectorization method as described in any one of the above.

[0063] A non-volatile computer storage medium for raster data vectorization provided by some embodiments of the present application stores computer-executable instructions that can execute a raster data vectorization method as described in any one of the above.

[0064] Each embodiment in the present application is described in a progressive manner. For the same or similar parts between the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments.

[0065] The devices, media, and methods provided by the embodiments of this application correspond one-to-one. Therefore, the devices and media also have beneficial technical effects similar to those of their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be elaborated here.

[0066] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0067] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0068] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0069] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0070] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0071] The memory may include non - permanent memory in the form of computer - readable media, random access memory (RAM), and non - volatile memory such as read - only memory (ROM) or flash RAM. Memory is an example of computer - readable media.

[0072] Computer - readable media includes permanent and non - permanent, removable and non - removable media that can store information by any method or technology. The information can be computer - readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase - change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read - only memory (ROM), electrically erasable programmable read - only memory (EEPROM), flash memory or other memory technologies, compact disc read - only memory (CD - ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non - transitory media that can be used to store information that can be accessed by a computing device. As defined herein, computer - readable media does not include transitory media such as modulated data signals and carrier waves.

[0073] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non - exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0074] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modifications, equivalent replacements, improvements, etc. made within the technical principles of the present application shall fall within the protection scope of the present application.

Claims

1. A raster data vectorization method, characterized in that The method includes: Converting the raster data to be vectorized into a matrix; there is a corresponding relationship between raster pixels and matrix elements; Grouping the elements of the matrix according to the element numerical values, and sequentially inputting the elements of each group into a breadth-first search queue; Adding the four-corner coordinates of the leading element of each group to the initialization result queue in the order of upper left, upper right, lower right, and lower left; Judging whether the eight-neighborhood elements of the leading element can be queued in the order of up, down, left, right, upper right, upper left, lower right, and lower left; Adding the four-corner coordinates of the queued elements among the eight-neighborhood elements to the initialization result queue, and again judging whether the eight-neighborhood elements of the queued elements can be queued, and looping through in this way until there are no search elements in each group, to obtain the result queue of each group; Encapsulating the result queue of each group into GeoJSON data in the form of a set, and displaying it through a polygon vector map.

2. The method according to claim 1, wherein Before grouping the elements of the matrix according to the element numerical values, the method further includes: Judging whether the matrix is an empty matrix; If the matrix is a non-empty matrix, judging whether the matrix has only one element; If the matrix has only one element, displaying the one element through a polygon vector map; If the matrix is an empty matrix, recycling the data to be vectorized.

3. The method according to claim 1, wherein Before adding the four-corner coordinates of the leading element of each group to the initialization result queue in the order of upper left, upper right, lower right, and lower left, the method further includes: Judging whether the leading element of each group is an empty element; When the leading element is an empty element, re-specifying a new leading element until the leading element is in a non-empty state; When the leading element is a non-empty element, marking the leading element as a searched state.

4. The method according to claim 1, characterized in that, The step of judging whether the eight-neighborhood elements of the leading element can be queued in the order of up, down, left, right, upper right, upper left, lower right, and lower left specifically includes: Sequentially judging whether there are respectively corresponding eight-neighborhood elements of the leading element in the eight adjacent directions in the order of up, down, left, right, upper right, upper left, lower right, and lower left; When there are corresponding eight-neighborhood elements, judging whether the corresponding eight-neighborhood elements are in a searched state; When it is in a non-searched state, determining the direction of the corresponding eight-neighborhood element, and according to the direction of the corresponding eight-neighborhood element, determining the starting and ending points of the corner coordinates and the corner coordinate search direction of the corresponding eight-neighborhood element; According to the starting and ending points of the corner coordinates and the corner coordinate search direction of the corresponding eight-neighborhood element, queuing the corresponding eight-neighborhood element; When it is in a searched state, determining that the corresponding eight-neighborhood element is not queued.

5. The method according to claim 4, wherein Determining the starting and ending points of the corner coordinates of the corresponding eight-neighborhood element according to the direction of the corresponding eight-neighborhood element, specifically including: If the orientation of the corresponding eight-neighborhood element is upward, the starting and ending points of the corresponding corner coordinates are the upper left corner and the upper right corner of the leading element; if the orientation of the corresponding eight-neighborhood element is downward, the starting and ending points of the corresponding corner coordinates are the lower right corner and the lower left corner of the leading element; if the orientation of the corresponding eight-neighborhood element is leftward, the starting and ending points of the corresponding corner coordinates are the lower left corner and the upper left corner of the leading element; if the orientation of the corresponding eight-neighborhood element is rightward, the starting and ending points of the corresponding corner coordinates are the upper right corner and the lower right corner of the leading element. If the orientation of the corresponding eight-neighborhood element is upper right, the starting and ending points of the corresponding corner coordinates are the upper right corner of the leading element; if the orientation of the corresponding eight-neighborhood element is upper left, the starting and ending points of the corresponding corner coordinates are the upper left corner of the leading element; if the orientation of the corresponding eight-neighborhood element is lower right, the starting and ending points of the corresponding corner coordinates are the lower right corner of the leading element; if the orientation of the corresponding eight-neighborhood element is lower left, the starting and ending points of the corresponding corner coordinates are the lower left corner of the leading element.

6. The method according to claim 4, wherein According to the orientation of the corresponding eight-neighborhood element, determine the corner coordinate search direction of the corresponding eight-neighborhood element, specifically including: If the search direction is lower right, add the four corner coordinates of the leading element to the result list in the order of upper right corner, lower right corner, lower left corner, and upper left corner; if the search direction is upper right, add the four corner coordinates of the leading element to the result list in the order of upper left corner, upper right corner, lower right corner, and lower left corner; if the search direction is lower left, add the four corner coordinates of the leading element to the result list in the order of lower right corner, lower left corner, upper left corner, and upper right corner; if the search direction is upper left, add the four corner coordinates of the leading element to the result list in the order of lower left corner, upper left corner, upper right corner, and lower right corner. If the search direction is rightward, add the four corner coordinates of the leading element to the result list in the order of upper right corner and lower right corner; if the search direction is leftward, add the four corner coordinates of the leading element to the result list in the order of lower left corner and upper left corner; if the search direction is upward, add the four corner coordinates of the leading element to the result list in the order of upper left corner and upper right corner; if the search direction is downward, add the four corner coordinates of the leading element to the result list in the order of lower right corner and lower left corner.

7. The method according to claim 1, characterized in that, Before grouping the elements of the matrix according to the element value size, the method further includes: If the matrix is a sparse matrix, record the positions and values of non-zero elements in the form of key-value pairs to generate a matrix element record table. Grouping the elements of the matrix according to the element value size specifically includes: Group the elements of the matrix according to multiple preset element value intervals and the matrix element record table.

8. The method according to claim 1, characterized in that, Converting the raster data to be vectorized into a matrix specifically includes: Determine the row-column structure of the raster and the row and column where each pixel is located in the matrix to convert the raster data to be vectorized into a matrix; the row number of the raster corresponds to the row index of the matrix, and the column number corresponds to the column index of the matrix.

9. A raster data vectorization device, characterized in that, Including: At least one processor; And, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute a raster data vectorization method according to any one of claims 1-8 above.

10. A raster data vectorization storage medium stores computer-executable instructions, characterized in that, The computer-executable instructions can execute a raster data vectorization method according to any one of claims 1-8 above.