Oracle geometric data transformation methods, devices, equipment, and storage media
By obtaining the geometry type of the Oracle geometry, parsing the parameters, and writing them into an intermediate geometry, an efficient conversion from Oracle geometric data to PostGIS geometric data was achieved, solving the problem of complex conversion process.
Patent Information
- Application Number
- CN202311763869.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-19
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-12-19
AI Technical Summary
In existing technologies, the process of converting Oracle geometric data to PostGIS geometric data is complex, difficult to operate, and inefficient.
By obtaining the geometry type of the Oracle geometry, parsing the geometry parameters, and writing the parameters into the intermediate geometry, a mapping relationship exists between the intermediate geometry and the PostGIS geometry. Finally, the intermediate geometry is converted into the PostGIS geometry.
It simplifies the conversion process from Oracle geometric data to PostGIS geometric data and improves conversion efficiency.
Smart Images

Figure CN117668088B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of geometric data processing technology, and in particular to a method, apparatus, device, and storage medium for converting Oracle geometric data. Background Technology
[0002] In scenarios involving data migration from Oracle spatial database to PostGIS spatial database, or in scenarios where PostGIS spatial database uses geometric data from Oracle spatial database, it is often necessary to first convert the Oracle geometric data in Oracle spatial database into PostGIS geometric data that is compatible with PostGIS spatial database for reading and writing.
[0003] Currently, the main method for converting PostGIS geometric data to Oracle geometric data is to directly write the parameters parsed from the geometry storing the PostGIS geometric data into the geometry storing the Oracle geometric data, based on the mapping relationship between the elements of the geometry storing the PostGIS geometric data and the geometry storing the Oracle geometric data.
[0004] This direct conversion method requires determining each parameter sequentially from the geometry storing the Oracle geometry data when data conversion is involved, and writing conversion statements based on the mapping relationship between the Oracle geometry and the PostGIS geometry for each parameter. However, geometric data comes in various types, and the parameters representing the storage method of geometric data in the geometry are different for each type. When dealing with a large amount of data conversion, writing conversion statements for each parameter of each geometric data undoubtedly makes the geometric data conversion process very complex, difficult to operate, and inefficient. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for converting Oracle geometric data, in order to solve the problems of complex, difficult-to-operate, and inefficient conversion processes for converting Oracle geometric data to PostGIS geometric data; and to simplify the complexity of the conversion process and improve conversion efficiency.
[0006] According to one aspect of the present invention, a method for converting Oracle geometric data is provided, comprising:
[0007] Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database;
[0008] Parse the Oracle geometry to obtain the geometry parameters;
[0009] The geometric parameters are written into the intermediate geometry corresponding to the geometric type. There is a mapping relationship between the geometric elements of the intermediate geometry and the second geometric structure corresponding to the PostGIS spatial database.
[0010] The intermediate geometry is converted into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by the second geometric structure.
[0011] According to another aspect of the present invention, an apparatus for converting Oracle geometric data is provided, comprising:
[0012] The data acquisition module is used to acquire Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by a first geometric structure corresponding to the Oracle spatial database;
[0013] The parameter parsing module is used to parse the Oracle geometry to obtain the geometry parameters;
[0014] The parameter writing module is used to write the geometry parameters into the intermediate geometry corresponding to the geometry type. There is a mapping relationship between the geometry elements of the intermediate geometry and the second geometric structure corresponding to the PostGIS spatial database.
[0015] The data conversion module is used to convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by the second geometric structure.
[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0017] At least one processor; and
[0018] A memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the Oracle geometry data conversion method according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the Oracle geometry data conversion method according to any embodiment of the present invention.
[0021] The technical solution of this invention involves obtaining an Oracle geometry and its geometry type. The Oracle geometry is geometric data represented by a first geometric structure corresponding to the Oracle spatial database. The Oracle geometry is parsed to obtain geometry parameters, which are then written into an intermediate geometry corresponding to the geometry type. A mapping relationship exists between the intermediate geometry and the geometry elements of a second geometric structure corresponding to the PostGIS spatial database. Based on this mapping relationship, the intermediate geometry is converted into a PostGIS geometry. The PostGIS geometry is geometric data represented by the second geometric structure. By defining an intermediate geometry and using it to convert Oracle geometry to PostGIS geometry, the problem of complex, difficult-to-operate, and inefficient conversion processes for converting Oracle geometric data to PostGIS geometric data is solved. This achieves the technical effect of simplifying the complexity of the Oracle geometric data to PostGIS geometric data conversion process and improving conversion efficiency.
[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of an Oracle geometric data conversion method provided in Embodiment 1 of the present invention;
[0025] Figure 2 This is a flowchart of an Oracle geometric data conversion method provided in Embodiment 2 of the present invention;
[0026] Figure 3 This is a flowchart of a method for converting point-type Oracle geometric data according to Embodiment 3 of the present invention;
[0027] Figure 4This is a flowchart of a method for converting line-type Oracle geometric data according to Embodiment 2 of the present invention;
[0028] Figure 5 This is a flowchart of a method for converting surface-type Oracle geometric data according to Embodiment 2 of the present invention;
[0029] Figure 6 This is a flowchart of a method for converting Oracle geometric data of a polyhedral surface type according to Embodiment 2 of the present invention;
[0030] Figure 7 This is a flowchart of a method for converting Oracle geometric data of a set geometry type, provided in Embodiment 2 of the present invention;
[0031] Figure 8 This is a schematic diagram of the structure of an Oracle geometric data conversion device provided in Embodiment 3 of the present invention;
[0032] Figure 9 This is a schematic diagram of the structure of an electronic device that implements the Oracle geometric data conversion method of this invention. Detailed Implementation
[0033] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0035] Example 1
[0036] Figure 1This is a flowchart of an Oracle geometric data conversion method provided in Embodiment 1 of the present invention. This embodiment is applicable to converting Oracle geometric data into PostGIS geometric data. The method can be executed by an Oracle geometric data conversion device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0037] S110. Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database.
[0038] In this context, PostGIS geometric data refers to geometric data represented by the first geometric structure corresponding to the PostGIS spatial database. PostGIS geometric data can be two-dimensional, three-dimensional, or four-dimensional. Oracle Spatial Database is an Oracle database management system capable of storing and managing spatial data. Generally, the first geometric structure corresponding to an Oracle spatial database is the SDO_GEOMETRY structure. A structure (struct) is a collection of data consisting of a series of data of the same or different types.
[0039] The first geometry structure is the structure used in the Oracle spatial database to store geometric data. The first geometry structure defines how geometric data is stored in the Oracle spatial database. Generally, the Oracle spatial database uses the SDO_GEOMETRY structure to store geometric data. In this embodiment, the Oracle geometry can be obtained directly from the Oracle spatial database as a structure-represented Oracle geometry, i.e., geometric data represented by the first geometry structure; or it can be obtained by accessing the Oracle spatial database to obtain well-known binary (WKB) geometric data and converting the binary geometric data into an Oracle geometry. The geometry type of the Oracle geometry can be determined based on the parameters of the geometry type variables contained in the Oracle geometry. Geometry types include: points, lines, faces, polyhedral surfaces, and set geometry.
[0040] Optionally, the geometry types include: point type, line type, face type, polyhedral surface type, and collection geometry type; point type includes: single point type (point) and multi-point type (mpoint); line type includes: single line type (line) and multi-line type (mline); face type includes: single face type (poly) and multi-face type (mpoly); polyhedral surface type includes: single polyhedral surface type (psurface) and multi-polyhedral surface type (msurface); collection geometry type (lwcollection) includes at least two of the following types: point type, line type, face type, and polyhedral surface type.
[0041] S120. Parse Oracle geometry to obtain geometry parameters.
[0042] In this embodiment, the Oracle geometry is used to store geometric data, so the geometry parameters can be obtained by parsing the geometry variables of the Oracle geometry.
[0043] Optionally, the geometry variables of an Oracle geometry include: the first geometry coordinate system variable sdo_srid, the first geometry dimension variable sdo_dim, the first geometry type variable sdo_type, the first geometry coordinate variable sdo_p, the second geometry coordinate variable sdo_ord, and the second geometry coordinate interpretation variable sdo_ele.
[0044] The first geometric coordinate variable, `sdo_p`, is generally used to store the coordinates of a single point. The second geometric coordinate variable, `sdo_ord`, is used to store the coordinates of other geometric objects besides those of single-point types; sometimes it can also be used for geometric objects that contain single-point types. The second geometric coordinate interpretation variable, `sdo_ele`, is used to represent information about the elements contained within the geometric object.
[0045] Because the intermediate geometry contains different geometric elements depending on the type of geometry, the geometric parameters obtained through parsing are not entirely the same. The parsed geometric parameters can include: geometry coordinate system parameter `srid`, geometry dimension `dim`, geometry type parameter `type`, and geometry coordinate parameter `ord`; they can also include: geometry ring parameter `nrings` or geometry composite parameter `ngeoms`.
[0046] S130. Write the geometry parameters into the intermediate geometry corresponding to the geometry type; there is a mapping relationship between the structure elements of the intermediate geometry and the second geometric structure corresponding to the PostGIS spatial database.
[0047] Intermediate geometry is a structure defined for data conversion between Oracle geometry and PostGIS geometry, such as the `geo_struct_t` structure. There is a mapping relationship between the structure elements of the intermediate geometry and the structure elements of the corresponding second geometry structure in the PostGIS spatial database. Geometry parameters are parameters defined in the intermediate geometry regarding geometry attributes. The second geometry structure is the structure used in the PostGIS spatial database to store geometric data. The second geometry structure defines the storage method for geometric data in the PostGIS spatial database. Generally, the PostGIS spatial database uses the `Gserialized` structure to store geometric data.
[0048] Optionally, the intermediate geometry corresponding to the geometry type of the Oracle geometry includes:
[0049] The types of intermediate geometry are: single-point intermediate geometry (lwpoint_derive), single-line intermediate geometry (lwline_derive), single-face intermediate geometry (lwpoly_derive), multi-point intermediate geometry (lwmpoint_derive), multi-line intermediate geometry (lwmline_derive), multi-face intermediate geometry (lwmpoly_derive), single polyhedral surface intermediate geometry (lwpsurface_derive), multi-polyhedral surface intermediate geometry (lwmsurface_derive), and collection intermediate geometry (lwcollection_derive).
[0050] Among them, a multi-point intermediate geometry (lwmpoint_derive) is an intermediate geometry composed of multiple single points; a multi-line intermediate geometry (lwline_derive) is an intermediate geometry composed of multiple single lines; a multi-faceted intermediate geometry (lwmpoly_derive) is an intermediate geometry composed of multiple single faces; a single polyhedral surface intermediate geometry (lwpsurface_derive) refers to an intermediate geometry composed of a single polyhedral surface; a multi-polyhedral surface intermediate geometry (lwmsurface_derive) refers to an intermediate geometry composed of multiple polyhedral surfaces; and a collection intermediate geometry (lwcollection_derive) is an intermediate geometry composed of a collection of points, lines, faces, or polyhedral surfaces.
[0051] Optionally, the structure elements of an intermediate geometry include: intermediate geometry variables and the parameter types corresponding to each intermediate geometry variable. For single-point or single-line intermediate geometries, the intermediate geometry variables include: an intermediate geometry coordinate list (geo_pointlist), an intermediate geometry coordinate system variable (geo_srid), an intermediate geometry dimension variable (geo_dim), an intermediate geometry entity identifier variable (geo_is_solid), and an intermediate geometry type variable (geo_type). For single-face intermediate geometries, the intermediate geometry variables may further include: an intermediate geometry ring variable (geo_nrings); the intermediate geometry ring variable (geo_nrings) is a parameter used to represent the number of rings in the geometry. For intermediate geometries of composite geometry types, the intermediate geometry variables may further include: intermediate geometry composite variables (ngeoms). Intermediate geometries of composite geometry types include: multi-point intermediate geometries, multi-line intermediate geometries, multi-faceted intermediate geometries, set intermediate geometries, single polyhedral surface intermediate geometries, or multiple polyhedral surface intermediate geometries.
[0052] In an optional embodiment, the parameter type of the intermediate geometry coordinate list is represented by a floating-point data storage structure; the floating-point data storage structure is used to define the storage method of floating-point data.
[0053] The definition of intermediate geometry is roughly as follows:
[0054] typedef unsigned char byte;
[0055] typedef unsigned int dword;
[0056] typedef struct
[0057] {
[0058] void*data;
[0059] dword srid;
[0060] byte dim;
[0061] bool is_solid;
[0062] byte type;
[0063] };
[0064] lwgeom_derive.
[0065] Among them, lwgeom can be derived into lwpoint_derive, lwline_derive, lwpoly_derive, lwmpoint_derive, lwmline_derive, lwmpoly_derive, lwpsurface_derive, lwmsurface_derive, and lwcollection_derive.
[0066] The definition of a three-dimensional single-point data storage geometry is as follows:
[0067] struct point{
[0068] double x;
[0069] double y;
[0070] double z;
[0071] };
[0072] typedef struct point point_t.
[0073] The definition of the floating-point data storage geometry structure is as follows:
[0074] typedef struct point point_t;
[0075] struct arr{
[0076] dword arr_num;
[0077] double*arr_element;
[0078] };
[0079] typedef struct arr arr_t.
[0080] S140. Convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure.
[0081] In PostGIS, geometry is geometric data represented using a second geometric structure. Generally, the second geometric structure corresponding to a PostGIS spatial database is the lwgeom structure.
[0082] In this embodiment, after determining the intermediate geometry, the structure variables of the intermediate geometry are mapped to the geometry variables of the PostGIS geometry according to the mapping relationship between the structure elements of the intermediate geometry and the structure elements of the corresponding second geometry structure in the PostGIS spatial database, thereby realizing the conversion of Oracle geometry into PostGIS geometry through the intermediate geometry.
[0083] The technical solution of this invention involves obtaining an Oracle geometry and its geometry type; the Oracle geometry is geometric data represented by a first geometric structure corresponding to the Oracle spatial database; parsing the Oracle geometry to obtain geometry parameters; writing the geometry parameters into an intermediate geometry corresponding to the geometry type, where a mapping relationship exists between the intermediate geometry and the geometry elements of a second geometric structure corresponding to the PostGIS spatial database; and converting the intermediate geometry into a PostGIS geometry based on the mapping relationship; the PostGIS geometry is geometric data represented by the second geometric structure. By defining an intermediate geometry and using it to convert Oracle geometry into PostGIS geometry, the complexity of the conversion process from Oracle geometric data to geometric data is simplified, and the conversion efficiency is improved.
[0084] Example 2
[0085] Figure 2 This is a flowchart of an Oracle geometric data conversion method provided in Embodiment 2 of the present invention. This embodiment further defines S120 of the above embodiment. Figure 2 As shown, the method includes:
[0086] S210. Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database.
[0087] S220. Parse Oracle geometry to obtain geometry parameters.
[0088] In this embodiment, the geometric parameters obtained by parsing may include: geometric coordinate system parameter srid, geometric dimension dim, geometric type parameter type, and geometric coordinate parameter ord; it may also include: geometric ring parameter nrings or geometric composite parameter ngeoms.
[0089] The geometry type parameter is used to represent the geometry type, which can include: point type, line type, face type, polyhedral surface type, and set geometry type; point type includes: single point type (point) and multi-point type (mpoint); line type includes: single line type (line) and multi-line type (mline); face type includes: single face type (poly) and multi-face type (mpoly); polyhedral surface type includes: single polyhedral surface type (psurface) and multi-polyhedral surface type (msurface).
[0090] S230. Determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry.
[0091] The composite intermediate geometry includes: single-point intermediate geometry, single-line intermediate geometry, single-face intermediate geometry, and single polyhedral surface intermediate geometry; the basic intermediate geometry includes: multi-point intermediate geometry, multi-line intermediate geometry, multi-face intermediate geometry, multi-polyhedral surface intermediate geometry, and aggregate intermediate geometry.
[0092] For example, the way to determine whether an intermediate geometry is a composite intermediate geometry or a basic intermediate geometry is to determine the geometry type based on the geometry type parameter obtained from the parsing, and then determine whether the intermediate geometry corresponding to the geometry type belongs to the composite intermediate geometry or the basic intermediate geometry based on the predefined composite intermediate geometry and basic intermediate geometry.
[0093] S240. When the intermediate geometry is the base intermediate geometry, write the geometry parameters into the base intermediate geometry.
[0094] In this embodiment, if the intermediate geometry is a basic intermediate geometry, that is, an intermediate geometry that is a single-point intermediate geometry, a single-line intermediate geometry, a single-face intermediate geometry, or a single polyhedral surface intermediate geometry, the geometry parameters are directly written into the basic intermediate geometry corresponding to the geometry type parameters.
[0095] S250. When the intermediate geometry is a composite intermediate geometry, split the composite intermediate geometry into multiple basic intermediate geometries; write the geometry parameters into each basic intermediate geometry; pass each basic intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0096] In this embodiment, if the intermediate geometry is a composite geometry, i.e., the intermediate geometry type is a multi-point intermediate geometry, a multi-line intermediate geometry, a multi-faceted intermediate geometry, a multi-polyhedral surface intermediate geometry, or a set intermediate geometry, it is first necessary to split the composite geometry into multiple basic intermediate geometries according to its geometry type. Then, the geometry parameters are written into the split basic intermediate geometries, and the basic intermediate geometries are passed as pointers to the upper-level composite intermediate geometry. Finally, the parsed composite geometry parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0097] For example, a multi-point intermediate geometry can be split into multiple single-point intermediate geometries; a multi-line intermediate geometry can be split into multiple single-line intermediate geometries; a multi-faceted intermediate geometry can be split into multiple single-faceted intermediate geometries; a multi-polyhedral surface intermediate geometry can be split into multiple single-polyhedral surface intermediate geometries; and a set of intermediate geometries can be split into at least two intermediate geometries among single-point intermediate geometries, single-line intermediate geometries, single-faceted intermediate geometries, and single-polyhedral surface intermediate geometries.
[0098] In an optional embodiment, before splitting the composite intermediate geometry into multiple basic intermediate geometries, the method further includes: determining the intermediate geometry as a geometry to be split, determining whether the geometry to be split is a composite intermediate geometry; if so, splitting the composite intermediate geometry into at least two sub-intermediate geometries; and using the sub-intermediate geometries as geometry to be split, and returning to the step of determining whether the geometry to be split is a conforming intermediate geometry, until each of the sub-intermediate geometries is a basic intermediate geometry.
[0099] S260. Convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure.
[0100] The technical solution of this invention involves obtaining an Oracle geometry and its geometry type; the Oracle geometry is geometric data represented by a first geometric structure corresponding to an Oracle spatial database; parsing the Oracle geometry to obtain geometry parameters; determining whether an intermediate geometry is a composite intermediate geometry or a basic intermediate geometry; if the intermediate geometry is a composite intermediate geometry, splitting it into multiple basic intermediate geometries; for each basic intermediate geometry, writing geometry parameters into it; passing the basic intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assigning the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry; if the geometry type is a basic intermediate geometry type, writing geometry parameters into the intermediate geometry corresponding to the basic intermediate geometry type; and converting the intermediate geometry into a PostGIS geometry according to a mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure. By defining intermediate geometry and converting composite intermediate geometry into basic intermediate geometry, and then using the method of calling basic intermediate geometry to convert Oracle geometry into PostGIS geometry, the complexity of the conversion process from Oracle geometric data to geometric data is further simplified, and the conversion efficiency is improved.
[0101] Example 3
[0102] Figure 3 This is a flowchart of a method for converting point-type Oracle geometric data according to Embodiment 4 of the present invention. This embodiment further defines the Oracle geometric data conversion method of the above embodiments for point-type Oracle geometric data. Figure 3 As shown, the method includes:
[0103] S310. Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database.
[0104] In this embodiment, the geometry type of the Oracle geometry is a point type, which includes single-point type and multi-point type.
[0105] S320. Parse Oracle geometry to obtain geometry parameters.
[0106] In this embodiment, geometry parameters are obtained by parsing geometry variables in Oracle geometry.
[0107] Optionally, when the geometry type is a single-point type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable sdo_srid in the Oracle geometry to obtain the geometry coordinate system parameter srid; parsing the first geometry dimension variable sdo_dim in the Oracle geometry to obtain the geometry dimension dim; parsing the first geometry type variable sdo_type in the Oracle geometry to obtain the geometry type parameter type; and parsing the first geometry coordinate variable sdo_p or the second geometry coordinate variable sdo_ord in the Oracle geometry to obtain the geometry coordinate parameter ord.
[0108] In an optional embodiment, parsing the first or second geometry coordinate variable in the Oracle geometry to obtain geometry coordinate parameters includes:
[0109] Determine whether the parameter of the second geometric coordinate variable in the Oracle geometry is empty;
[0110] If not, then the second geometry coordinate variable and the second geometry coordinate interpretation variable in the Oracle geometry are parsed to obtain the geometry coordinate parameters; the second geometry coordinate interpretation variable is used to interpret the second geometry coordinate variable;
[0111] If so, parse the first geometry coordinate variable in the Oracle geometry to obtain the geometry coordinate parameters.
[0112] In this embodiment, the geometric coordinates of a single-point Oracle geometry may be stored in either a first geometric coordinate variable or a second geometric coordinate variable. For a multi-point Oracle geometry, the geometric coordinates are generally stored in the second geometric coordinate variable. Therefore, it is determined whether the parameter of the second geometric coordinate variable in the Oracle geometry is empty. If it is not empty, it means that the geometric coordinate parameters are stored in the second geometric coordinate variable. The second geometric coordinate variable and the second geometric coordinate interpretation variable in the Oracle geometry are parsed, and the geometric coordinate parameters are obtained from the second geometric coordinate variable based on the interpretation of the second geometric coordinate variable by the second geometric coordinate interpretation variable. If it is empty, it means that the geometric coordinate parameters are stored in the first geometric coordinate variable. The geometric coordinate parameters are obtained by parsing the first geometric coordinate variable in the Oracle geometry.
[0113] Optionally, when the geometry type is a multi-point type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable sdo_srid in the Oracle geometry to obtain the geometry coordinate system parameter srid; parsing the first geometry dimension variable sdo_dim in the Oracle geometry to obtain the geometry dimension dim; parsing the first geometry type variable sdo_type in the Oracle geometry to obtain the geometry type parameter type; and parsing the second geometry coordinate variable sdo_ord and the second geometry coordinate interpretation variable sdo_ele in the Oracle geometry to obtain the geometry coordinate parameter ord and the geometry composite parameter geoms.
[0114] The geometry composite parameter geoms represents the number of geometries contained in the composite geometry.
[0115] For example, the process of parsing the second geometry coordinate variable sdo_ord and the second geometry coordinate interpretation variable sdo_ele in the Oracle geometry to obtain the geometry coordinate parameter ord and the geometry composite parameter geoms can be as follows: determine whether there is a composite geometry in the Oracle geometry; if Sdo_geometry->ele.arr_element[1]==4, increment the geometry composite parameter geoms by 1. If there is no composite geometry, the Oracle geometry is a set of single points, and the number of single points is Sdo_geometry->ele.arr_num / 3; combine the points of each group into a new Sdo_geometry to obtain the geometry coordinate parameter ord. If there is a composite geometry, obtain the number of basic geometries contained in the composite geometry, i.e. geoms, according to the third data in the triplet of the composite geometry, and traverse the basic geometries contained in the composite geometry to form a new Sdo_geometry to obtain the geometry coordinate parameter ord.
[0116] S330. Determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry.
[0117] In this embodiment, when the geometry type parameter is a single-point type, the corresponding intermediate geometry is a single-point intermediate geometry, which belongs to the basic intermediate geometry. When the geometry type parameter is a multi-point type, the corresponding intermediate geometry is a multi-point intermediate geometry, which belongs to the composite intermediate geometry.
[0118] S340. For a single-point intermediate geometry, write the geometry parameters into the single-point intermediate geometry.
[0119] In an optional embodiment, for a single-point intermediate geometry, writing geometry parameters into the single-point intermediate geometry includes:
[0120] Assign the coordinate system parameters of the geometric body to the intermediate geometric body coordinate system variables of the basic intermediate geometric body;
[0121] Assign the geometric dimension to the intermediate geometric dimension variable of the basic intermediate geometry;
[0122] The intermediate geometry entity identifier variable of the basic intermediate geometry is assigned the entity parameter corresponding to the geometry type;
[0123] Assign the geometry type parameter to the intermediate geometry type variable of the basic intermediate geometry;
[0124] Write the coordinates of the first geometric object into the intermediate geometric object coordinate list of the basic intermediate geometry.
[0125] The entity identifier is used to determine whether a geometry is a solid, and it can be determined based on the geometry type parameter. The geometry type parameter indicates both the geometry type and whether it is a solid. For example, a polyhedron surface type can be either a solid or a non-solid. The entity identifier can be 0 or False to represent a non-solid, and 1 or True to represent a solid.
[0126] In a specific embodiment, a single-point intermediate geometry is defined as
[0127] typedef struct
[0128] {
[0129] arr_t*geo_pointlist;
[0130] dword geo_srid;
[0131] byte geo_dim
[0132] bool geo_is_solid;
[0133] byte geo_type;
[0134] }
[0135] lwpoint_derive.
[0136] Write the geometry parameters into the single-point intermediate geometry representation.
[0137] lwpoint_derive
[0138] {
[0139] geo__pointlist = ord;
[0140] geo_srid = srid;
[0141] geo_dim = dim;
[0142] geo_is_solid = 0;
[0143] geo_type = type;
[0144] }
[0145] S350. For a multi-point intermediate geometry, split the multi-point intermediate geometry into multiple single-point intermediate geometries; write the geometry parameters into the single-point intermediate geometry; pass the single-point intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0146] In this embodiment, for a multi-point intermediate geometry, the multi-point intermediate geometry is split into multiple single-point intermediate geometries. According to S350, the geometry parameters are written into the single-point intermediate geometry, the single-point intermediate geometry is passed as a pointer to the upper-level composite intermediate geometry, and the geometry composite parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0147] In one specific embodiment, the multi-point intermediate geometry is defined as
[0148] typedef struct
[0149] {
[0150] lwpoint_derive**geo_pointlist; / / Calls the intermediate geometry of a single point and writes the coordinate parameters of the intermediate geometry.
[0151] dword geo_srid;
[0152] byte geo_dim;
[0153] bool geo_is_solid;
[0154] byte geo_type;
[0155] dword geo_ngeoms;
[0156] }
[0157] lwmpoint_derive.
[0158] S360. Convert the intermediate geometry into a PostGIS geometry based on the mapping relationship; a PostGIS geometry is geometric data represented by a second geometric structure.
[0159] The technical solution of this invention involves obtaining Oracle geometry and its geometry type; Oracle geometry is geometric data represented by a first geometric structure corresponding to an Oracle spatial database; parsing the Oracle geometry to obtain geometry parameters; determining whether the intermediate geometry corresponding to the geometry type parameters is a composite intermediate geometry or a basic intermediate geometry; for single-point intermediate geometry, writing the geometry parameters into the single-point intermediate geometry; for multi-point intermediate geometry, splitting the multi-point intermediate geometry into multiple single-point intermediate geometry; writing the geometry parameters into the single-point intermediate geometry; passing the single-point intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assigning the composite geometry parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry; converting the intermediate geometry into a PostGIS geometry according to the mapping relationship; PostGIS geometry is geometric data represented by a second geometric structure; by defining intermediate geometry and converting composite intermediate geometry into basic intermediate geometry, and using the method of calling basic intermediate geometry to convert point-type Oracle geometry into PostGIS geometry, the complexity of the conversion process from point-type Oracle geometric data to geometric data is further simplified, and the conversion efficiency is improved.
[0160] Example 4
[0161] Figure 4 This is a flowchart of a method for converting line-type Oracle geometric data according to Embodiment 4 of the present invention. This embodiment further defines the Oracle geometric data conversion method of the above embodiments for line-type Oracle geometric data. Figure 4 As shown, the method includes:
[0162] S410. Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database.
[0163] In this embodiment, the geometry type of the Oracle geometry is a line type, which includes single-line type and multi-line type.
[0164] S420. Parse Oracle geometry to obtain geometry parameters.
[0165] In this embodiment, geometry parameters are obtained by parsing geometry variables in Oracle geometry.
[0166] Optionally, when the geometry type is a single-line type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable sdo_srid in the Oracle geometry to obtain the geometry coordinate system parameter srid; parsing the first geometry dimension variable sdo_dim in the Oracle geometry to obtain the geometry dimension dim; parsing the first geometry type variable sdo_type in the Oracle geometry to obtain the geometry type parameter type; and parsing the second geometry coordinate variable sdo_ord in the Oracle geometry to obtain the geometry coordinate parameter ord.
[0167] Optionally, when the geometry type is a multiline type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable sdo_srid in the Oracle geometry to obtain the geometry coordinate system parameter srid; parsing the first geometry dimension variable sdo_dim in the Oracle geometry to obtain the geometry dimension dim; parsing the first geometry type variable sdo_type in the Oracle geometry to obtain the geometry type parameter type; parsing the second geometry coordinate variable sdo_ord in the Oracle geometry to obtain the geometry coordinate parameter ord; and parsing the second geometry coordinate interpretation variable sdo_ele to obtain the geometry composite parameter geoms.
[0168] For example, the geometry composite parameter geoms is used to represent the number of geometries contained in the composite geometry.
[0169] For example, the process of parsing the second geometry coordinate variable `sdo_ord` and the second geometry coordinate interpretation variable `sdo_ele` in an Oracle geometry to obtain the geometry coordinate parameter `ord` and the geometry composite parameter `geoms` can be specifically as follows: Determine if a composite geometry exists in the Oracle geometry; if `Sdo_geometry->ele.arr_element[3*I+1]` equals 4, increment the geometry composite parameter `geoms` by 1, where `I` represents the I-th group of the second geometry coordinate interpretation variable, initially group 0. If no composite geometry exists, the Oracle geometry is a set of single lines, with the number of single lines being `Sdo_geometry->ele.arr_num / 3`; combine the lines from each group into a new `Sdo_geometry` to obtain the geometry coordinate parameter `ord`. If a composite geometry exists, based on the third data in the triplet of the composite geometry, obtain the number of basic geometries contained in the composite geometry, i.e., `geoms`; traverse the basic geometries contained in the composite geometry to form a new `Sdo_geometry` to obtain the geometry coordinate parameter `ord`.
[0170] S430. Determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry.
[0171] In this embodiment, when the geometry type parameter is single-line, the corresponding intermediate geometry is a single-line intermediate geometry, which belongs to the basic intermediate geometry. When the geometry type parameter is multi-line, the corresponding intermediate geometry is a multi-line intermediate geometry, which belongs to the composite intermediate geometry.
[0172] S440. For a single-line intermediate geometry, write the geometry parameters into the single-line intermediate geometry.
[0173] In an optional embodiment, for a single-line intermediate geometry, writing the geometry parameters into the single-line intermediate geometry includes: assigning the geometry coordinate system parameter to the intermediate geometry coordinate system variable of the basic intermediate geometry; assigning the geometry dimension to the intermediate geometry dimension variable of the basic intermediate geometry; assigning the intermediate geometry entity identifier variable of the basic intermediate geometry to the entity parameter corresponding to the geometry type parameter; assigning the geometry type parameter to the intermediate geometry type variable of the basic intermediate geometry; and writing the first geometry coordinates into the intermediate geometry coordinate list of the basic intermediate geometry.
[0174] In one specific embodiment, the single-line intermediate geometry is defined as
[0175] typedef struct
[0176] {
[0177] arr_t*geo_pointlist;
[0178] dword geo_srid;
[0179] byte geo_dim
[0180] bool geo_is_solid;
[0181] byte geo_type;
[0182] }
[0183] lwline_derive.
[0184] Write the geometry parameters into the single-line intermediate geometry representation.
[0185] lwline_derive
[0186] {
[0187] geo__pointlist = ord;
[0188] geo_srid = srid;
[0189] geo_dim = dim;
[0190] geo_is_solid = 0;
[0191] geo_type = type;
[0192] }
[0193] S450. For a multi-line intermediate geometry, split the multi-line intermediate geometry into multiple single-line intermediate geometries; write the geometry parameters into the single-line intermediate geometry; pass the single-line intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0194] In this embodiment, for a multi-line intermediate geometry, the multi-line intermediate geometry is split into multiple single-line intermediate geometries. According to S450, the geometry parameters are written into the single-line intermediate geometry, the single-line intermediate geometry is passed as a pointer to the upper-level composite intermediate geometry, and the geometry composite parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0195] In one specific embodiment, the multi-line intermediate geometry is defined as
[0196] typedef struct
[0197] {
[0198] lwline_derive**geo_pointlist; / / Calls the intermediate geometry of a single line and writes the coordinate parameters of the intermediate geometry.
[0199] dword geo_srid;
[0200] byte geo_dim;
[0201] bool geo_is_solid;
[0202] byte geo_type;
[0203] dword geo_ngeoms;
[0204] }
[0205] lwmline_derive.
[0206] S460. Convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure.
[0207] The technical solution of this invention involves obtaining an Oracle geometry and its geometry type; the Oracle geometry is geometric data represented by a first geometric structure corresponding to the Oracle spatial database; parsing the Oracle geometry to obtain geometry parameters; determining whether the intermediate geometry corresponding to the geometry type parameters is a composite intermediate geometry or a basic intermediate geometry; for single-line intermediate geometry, writing the geometry parameters into the single-line intermediate geometry; for multi-line intermediate geometry, splitting the multi-line intermediate geometry into multiple single-line intermediate geometry; writing the geometry parameters into the single-line intermediate geometry; passing the single-line intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assigning the composite geometry parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry; and converting the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure. By defining intermediate geometry and converting composite intermediate geometry into basic intermediate geometry, and using the method of calling basic intermediate geometry to convert line-type Oracle geometry into PostGIS geometry, the complexity of the conversion process from line-type Oracle geometric data to geometric data is further simplified, and the conversion efficiency is improved.
[0208] Example 5
[0209] Figure 5 This is a flowchart of a method for converting face-type Oracle geometric data according to Embodiment 5 of the present invention. This embodiment further defines the Oracle geometric data conversion method of the above embodiments for face-type Oracle geometric data. Figure 5 As shown, the method includes:
[0210] S510. Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database.
[0211] In this embodiment, the geometry type of the Oracle geometry is a face type, and the line types include single-face type and multi-face type.
[0212] S520: Parse Oracle geometry to obtain geometry parameters.
[0213] In this embodiment, geometry parameters are obtained by parsing geometry variables in Oracle geometry.
[0214] Optionally, when the geometry type is a single-face type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable sdo_srid in the Oracle geometry to obtain the geometry coordinate system parameter srid; parsing the first geometry dimension variable sdo_dim in the Oracle geometry to obtain the geometry dimension dim; parsing the first geometry type variable sdo_type in the Oracle geometry to obtain the geometry type parameter type; parsing the second geometry coordinate variable sdo_ord in the Oracle geometry to obtain the geometry coordinate parameter ord; and parsing the second geometry coordinate interpretation variable sdo_ele to obtain the geometry ring parameter nrings.
[0215] For example, the geometry ring parameter nrings is obtained based on the second geometry coordinate interpretation variable sdo_ele->ele.arr_num / 3. The geometry coordinate parameter ord is determined based on the second geometry coordinate variable sdo_ord and the geometry ring parameter nrings.
[0216] Optionally, when the geometry type is a multifaceted type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable sdo_srid in the Oracle geometry to obtain the geometry coordinate system parameter srid; parsing the first geometry dimension variable sdo_dim in the Oracle geometry to obtain the geometry dimension dim; parsing the first geometry type variable sdo_type in the Oracle geometry to obtain the geometry type parameter type; parsing the second geometry coordinate variable sdo_ord in the Oracle geometry to obtain the geometry coordinate parameter ord; and parsing the second geometry coordinate interpretation variable sdo_ele to obtain the geometry ring parameter nrings and the geometry composite parameter geoms.
[0217] S530. Determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry.
[0218] In this embodiment, when the geometry type parameter is single-faceted, the corresponding intermediate geometry is a single-faceted intermediate geometry, which belongs to the basic intermediate geometry. When the geometry type parameter is multi-faceted, the corresponding intermediate geometry is a multi-faceted intermediate geometry, which belongs to the composite intermediate geometry.
[0219] S540. For a single-sided intermediate geometry, write the geometry parameters into the single-sided intermediate geometry.
[0220] In an optional embodiment, for a single-sided intermediate geometry, writing geometry parameters into the single-sided intermediate geometry includes: assigning the geometry coordinate system parameter to the intermediate geometry coordinate system variable of the basic intermediate geometry; assigning the geometry dimension to the intermediate geometry dimension variable of the basic intermediate geometry; assigning the intermediate geometry entity identifier variable of the basic intermediate geometry to the entity parameter corresponding to the geometry type parameter; assigning the geometry type parameter to the intermediate geometry type variable of the basic intermediate geometry; and, if the basic intermediate geometry is a single-sided intermediate geometry, determining the geometry type parameter based on the second geometry coordinate variable. The single-face subtype of the single-face type includes: rectangular face and non-rectangular face; when the single-face subtype is a rectangular face, the geometry loop parameter is assigned to the intermediate geometry loop variable of the basic intermediate geometry; the rectangular face coordinates are determined according to the first geometry coordinates and the intermediate geometry loop variable, and the rectangular face coordinates are written into the intermediate geometry coordinate list of the basic intermediate geometry; when the single-face subtype is a non-rectangular face, the non-rectangular face coordinates are determined according to the intermediate geometry loop variable and the intermediate geometry dimension variable, and the non-rectangular face coordinates are written into the intermediate geometry coordinate list of the basic intermediate geometry.
[0221] In one specific embodiment, a single-sided intermediate geometry is defined as
[0222] typedef struct
[0223] {
[0224] arr_t*geo_pointlist;
[0225] dword geo_srid;
[0226] byte geo_dim
[0227] bool geo_is_solid;
[0228] byte geo_type;
[0229] }
[0230] lwpoly_derive.
[0231] The geometric parameters are written into the representation of the single-sided intermediate geometry.
[0232] lwline_derive
[0233] {
[0234] geo__pointlist = ord1;
[0235] geo_srid = srid;
[0236] geo_dim = dim;
[0237] geo_is_solid = 0;
[0238] geo_type = type;
[0239] }
[0240] For example, the geometric coordinates Ord1 can be determined based on the geometric coordinate parameter ord and the geometric ring parameter nrings. For 3D surface types, they can be divided into 3D rectangular outer ring, 3D rectangular inner ring, and ordinary surface. The outer ring indicates that the coordinate data is read in a clockwise direction, and the inner ring indicates that the coordinate data is read in a counterclockwise direction.
[0241] For a regular surface, the coordinate data of the number of loop points multiplied by the number of dimensions can be directly written into lwpoly_derive->pointlist[i].
[0242] For the rectangular surface of the outer ring of a 3D rectangle, the geometric coordinates Ord1 are:
[0243] Double rectanglepoint_3d
[15]
[0244] rectanglepoint_3d[0]=sdo_geometry->ord.arr_element[j+0];
[0245] rectanglepoint_3d[1]=sdo_geometry->ord.arr_element[j+1];
[0246] rectanglepoint_3d[2]=sdo_geometry->ord.arr_element[j+2];
[0247] rectanglepoint_3d[3]=sdo_geometry->ord.arr_element[j+3];
[0248] rectanglepoint_3d[4]=sdo_geometry->ord.arr_element[j+1];
[0249] rectanglepoint_3d[5]=sdo_geometry->ord.arr_element[j+2];
[0250] rectanglepoint_3d[6]=sdo_geometry->ord.arr_element[j+3];
[0251] rectanglepoint_3d[7]=sdo_geometry->ord.arr_element[j+4];
[0252] rectanglepoint_3d[8]=sdo_geometry->ord.arr_element[j+5];
[0253] rectanglepoint_3d[9]=sdo_geometry->ord.arr_element[j+0];
[0254] rectanglepoint_3d
[10] =sdo_geometry->ord.arr_element[j+4];
[0255] rectanglepoint_3d
[11] =sdo_geometry->ord.arr_element[j+5];
[0256] rectanglepoint_3d
[12] =sdo_geometry->ord.arr_element[j+0];
[0257] rectanglepoint_3d
[13] =sdo_geometry->ord.arr_element[j+1];
[0258] rectanglepoint_3d
[14] =sdo_geometry->ord.arr_element[j+2];
[0259] if(sdo_geometry->ord.arr_element[3*i]==sdo_geometry->ord.arr_element[3*i+3]
[0260] {
[0261] rectanglepoint_3d[5]=sdo_geometry->ord.arr_element[j+5];
[0262] rectanglepoint_3d
[11] =sdo_geometry->ord.arr_element[j+2];
[0263] }
[0264] Where j represents the position of the first coordinate read by this loop in the array, and i represents the i-th loop in the geometric loop parameters. For example, if the first coordinate read by the i-th loop is the 5th coordinate, then j = 5.
[0265] Write the array data obtained above into lwpoly_derive->pointlist[i] (i represents the i-th ring) in sequence, thereby completing the writing of the geometric coordinates of the rectangular face of the 3D rectangular outer ring.
[0266] For the rectangular face of the inner ring of a 3D rectangle, the geometric coordinates Ord1 are:
[0267] Double rectanglepoint_3d
[15]
[0268] rectanglepoint_3d[0]=sdo_geometry->ord.arr_element[j+0];
[0269] rectanglepoint_3d[1]=sdo_geometry->ord.arr_element[j+1];
[0270] rectanglepoint_3d[2]=sdo_geometry->ord.arr_element[j+2];
[0271] rectanglepoint_3d[3]=sdo_geometry->ord.arr_element[j+0];
[0272] rectanglepoint_3d[4]=sdo_geometry->ord.arr_element[j+4];
[0273] rectanglepoint_3d[5]=sdo_geometry->ord.arr_element[j+5];
[0274] rectanglepoint_3d[6]=sdo_geometry->ord.arr_element[j+3];
[0275] rectanglepoint_3d[7]=sdo_geometry->ord.arr_element[j+4];
[0276] rectanglepoint_3d[8]=sdo_geometry->ord.arr_element[j+5];
[0277] rectanglepoint_3d[9]=sdo_geometry->ord.arr_element[j+3];
[0278] rectanglepoint_3d
[10] =sdo_geometry->ord.arr_element[j+1];
[0279] rectanglepoint_3d
[11] =sdo_geometry->ord.arr_element[j+2];
[0280] rectanglepoint_3d
[12] =sdo_geometry->ord.arr_element[j+0];
[0281] rectanglepoint_3d
[13] =sdo_geometry->ord.arr_element[j+1];
[0282] rectanglepoint_3d
[14] =sdo_geometry->ord.arr_element[j+2];
[0283] if(sdo_geometry->ord.arr_element[3*i]==sdo_geometry->ord.arr_element[3*i+3]
[0284] {
[0285] rectanglepoint_3d[5]=sdo_geometry->ord.arr_element[j+2];
[0286] rectanglepoint_3d
[11] =sdo_geometry->ord.arr_element[j+5];
[0287] }。
[0288] Write the array data obtained above into lwpoly_derive->pointlist[i] (i represents the i-th ring) in sequence, thereby completing the writing of the geometric coordinates of the rectangular face of the inner ring of the 3D rectangle.
[0289] S550. For a multi-faceted intermediate geometry, split the multi-faceted intermediate geometry into multiple single-faceted intermediate geometries; write the geometry parameters into the single-faceted intermediate geometry; pass the single-faceted intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0290] In this embodiment, for a multi-faceted intermediate geometry, the multi-faceted intermediate geometry is split into multiple single-faceted intermediate geometries. According to S550, the geometry parameters are written into the single-faceted intermediate geometry, the single-faceted intermediate geometry is passed as a pointer to the upper-level composite intermediate geometry, and the geometry composite parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0291] In one specific embodiment, the multifaceted intermediate geometry is defined as
[0292] typedef struct
[0293] {
[0294] lwpoly_derive**geo_pointlist; / / Calls the intermediate geometry of a single-sided surface and writes the coordinate parameters of the intermediate geometry.
[0295] dword geo_srid;
[0296] byte geo_dim;
[0297] bool geo_is_solid;
[0298] byte geo_type;
[0299] dword geo_ngeoms;
[0300] }
[0301] lwmpoly_derive.
[0302] S560. Convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure.
[0303] The technical solution of this invention involves obtaining an Oracle geometry and its geometry type; the Oracle geometry is geometric data represented by a first geometric structure corresponding to the Oracle spatial database; parsing the Oracle geometry to obtain geometry parameters; determining whether the intermediate geometry corresponding to the geometry type parameters is a composite intermediate geometry or a basic intermediate geometry; for single-sided intermediate geometry, writing the geometry parameters into the single-sided intermediate geometry; for multi-sided intermediate geometry, splitting the multi-sided intermediate geometry into multiple single-sided intermediate geometry; writing the geometry parameters into the single-sided intermediate geometry; passing the single-sided intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assigning the composite geometry parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry; converting the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure. By defining intermediate geometry and converting composite intermediate geometry into basic intermediate geometry, and using the method of calling basic intermediate geometry to convert face-type Oracle geometry into PostGIS geometry, the complexity of the conversion process from face-type Oracle geometric data to geometric data is further simplified, and the conversion efficiency is improved.
[0304] Example 6
[0305] Figure 6 This is a flowchart of a method for converting Oracle geometric data of a polyhedral surface type according to Embodiment Six of the present invention. This embodiment further defines the Oracle geometric data conversion method of the above embodiments for Oracle geometric data of a polyhedral surface type. Figure 6 As shown, the method includes:
[0306] S610. Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database.
[0307] In this embodiment, the geometry type of the Oracle geometry is a polyhedral surface type, and the line types include single polyhedral surface type and multi-polyhedral surface type.
[0308] S620. Parse Oracle geometry to obtain geometry parameters.
[0309] In this embodiment, geometry parameters are obtained by parsing geometry variables in Oracle geometry.
[0310] Optionally, when the geometry type is a single polyhedral surface type or a multi-polyhedral surface type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable in the Oracle geometry to obtain geometry coordinate system parameters; parsing the first geometry dimension variable in the Oracle geometry to obtain geometry dimensions; parsing the first geometry type variable in the Oracle geometry to obtain geometry type parameters; and parsing the second geometry coordinate variable and the second geometry coordinate interpretation variable to obtain geometry coordinate parameters and geometry composite parameters.
[0311] For example, based on the number of instances where sdo_geometry->ele.arr_element[3*I+1] equals 1006 or 2006, the number of single polyhedral surface types in the polyhedral surface type is determined, i.e., the geometry composite parameter geoms. Then, by taking the next digit of the data equal to 1006 or 2006, the number of face types contained in each single polyhedral surface type is obtained, i.e., the geometry composite parameter geoms. Next, using the single-face type parsing method, the second geometry coordinate variable sdo_ord in the Oracle geometry is parsed to obtain the geometry coordinate parameter ord, and the second geometry coordinate interpretation variable sdo_ele is parsed to obtain the geometry ring parameter nrings.
[0312] S630. Determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry.
[0313] In this embodiment, when the geometry type parameter is a single polyhedral surface type, the corresponding intermediate geometry is a single polyhedral surface intermediate geometry, which is a composite intermediate geometry. When the geometry type parameter is a multi-polyhedral surface type, the corresponding intermediate geometry is a multi-polyhedral surface intermediate geometry, which is also a composite intermediate geometry.
[0314] S640. For a single polyhedral surface intermediate geometry, split the single polyhedral surface intermediate geometry into a multi-faceted intermediate geometry; split the multi-faceted intermediate geometry into multiple single-faced intermediate geometries; write the geometry parameters into the single-faced intermediate geometry; pass the single-faced intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0315] In this embodiment, for a single polyhedral surface intermediate geometry, the single polyhedral surface intermediate geometry is split into multiple single-sided intermediate geometries. According to S550 in the above embodiment, the geometry parameters are written into the single-sided intermediate geometry, the single-sided intermediate geometry is passed as a pointer to the upper-level composite intermediate geometry, and the geometry composite parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0316] In one specific embodiment, the intermediate geometry of a single polyhedral surface is defined as follows:
[0317] typedef struct
[0318] {
[0319] lwmpoly_derive**geo_pointlist; / / Calls the intermediate geometry of the polyface and writes the coordinate parameters of the intermediate geometry.
[0320] dword geo_srid;
[0321] byte geo_dim;
[0322] bool geo_is_solid;
[0323] byte geo_type;
[0324] dword geo_ngeoms;
[0325] }
[0326] lwpsurface_derive.
[0327] The multi-faceted intermediate geometry lwmpoly can be further subdivided into a single-faceted intermediate geometry lwpoly, which can then be called to write the intermediate geometry coordinate parameters into the single polyhedron surface intermediate geometry.
[0328] S640. For a polyhedral surface intermediate geometry, split the polyhedral surface intermediate geometry into multiple single polyhedral surface intermediate geometries; split the single polyhedral surface intermediate geometry into multi-faceted intermediate geometries; split the multi-faceted intermediate geometry into multiple single-faceted intermediate geometries; write the geometry parameters into the single-faceted intermediate geometry; pass the single-faceted intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0329] In one specific embodiment, the intermediate geometry of the polyhedron surface is defined as follows:
[0330] typedef struct
[0331] {
[0332] lwpsurface_derive**geo_pointlist; / / Calls the intermediate geometry of a single polyhedron surface and writes the coordinate parameters of the intermediate geometry.
[0333] dword geo_srid;
[0334] byte geo_dim;
[0335] bool geo_is_solid;
[0336] byte geo_type;
[0337] dword geo_ngeoms;
[0338] }
[0339] lwmsurface_derive.
[0340] The single polyhedral surface intermediate geometry lwpsurface can be further subdivided into a multi-faceted intermediate geometry lwmpoly; the multi-faceted intermediate geometry lwmpoly can be further subdivided into multiple single-faced intermediate geometries lwpoly. Thus, the coordinate parameters of the intermediate geometry can be written into the multi-polyhedral surface intermediate geometry by calling the single-faced intermediate geometry lwpoly.
[0341] S660. Convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure.
[0342] The technical solution of this invention involves obtaining an Oracle geometry and its geometry type; the Oracle geometry is geometric data represented by a first geometric structure corresponding to an Oracle spatial database; parsing the Oracle geometry to obtain geometry parameters; determining whether the intermediate geometry corresponding to the geometry type parameters is a composite intermediate geometry or a basic intermediate geometry; for a single polyhedral surface intermediate geometry, splitting the single polyhedral surface intermediate geometry into a multi-faceted intermediate geometry; splitting the multi-faceted intermediate geometry into multiple single-faceted intermediate geometries; writing the geometry parameters into the single-faceted intermediate geometry; passing the single-faceted intermediate geometry as a pointer to the upper-level composite intermediate geometry, and then... The parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry. For polyhedral surface intermediate geometry, it is split into multiple single polyhedral surface intermediate geometry; the single polyhedral surface intermediate geometry is split into multi-faceted intermediate geometry; and the multi-faceted intermediate geometry is split into multiple single-faceted intermediate geometry. The geometry parameters are written to the single-faceted intermediate geometry; the single-faceted intermediate geometry is passed as a pointer to the upper-level composite intermediate geometry, and the geometry composite parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry. Based on the mapping relationship, the intermediate geometry is converted into a PostGIS geometry. PostGIS geometry is geometric data represented using a second geometric structure. By defining intermediate geometry and converting composite intermediate geometry into basic intermediate geometry, and using the method of calling basic intermediate geometry to convert Oracle geometry of polyhedral surface type into PostGIS geometry, the complexity of the conversion process from Oracle geometric data of polyhedral surface type to geometric data is further simplified, and the conversion efficiency is improved.
[0343] Example 7
[0344] Figure 7 This is a flowchart of a method for converting Oracle geometric data of a set geometry type according to Embodiment 7 of the present invention. This embodiment further defines the Oracle geometric data conversion method of the above embodiment for Oracle geometric data of a set geometry type. Figure 7 As shown, the method includes:
[0345] S710. Obtain the Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database.
[0346] In this embodiment, the geometry type of the Oracle geometry is a collection geometry type; the collection geometry type (lwcollection) includes at least two types from point type, line type, face type and polyhedral surface type.
[0347] S720: Parse Oracle geometry to obtain geometry parameters.
[0348] In this embodiment, geometry parameters are obtained by parsing geometry variables in Oracle geometry.
[0349] Optionally, when the geometry type is a set geometry type, parsing the Oracle geometry to obtain geometry parameters includes: parsing the first geometry coordinate system variable in the Oracle geometry to obtain geometry coordinate system parameters; parsing the first geometry dimension variable in the Oracle geometry to obtain geometry dimensions; parsing the first geometry type variable in the Oracle geometry to obtain geometry type parameters; and parsing the second geometry coordinate variable and the second geometry coordinate interpretation variable to obtain geometry coordinate parameters and geometry composite parameters.
[0350] For example, the number of ord and ele values for each subtype in the collection type is obtained to obtain the geometry composite parameter geoms; then, for each subtype geometry type parameter, the corresponding geometry parameter is obtained according to the geometry parameter parsing method in the above embodiment.
[0351] S730. Determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry.
[0352] In this embodiment, when the geometry type parameter is a set geometry type, the corresponding intermediate geometry is a set intermediate geometry, which belongs to a composite intermediate geometry.
[0353] S740. Split the set of intermediate geometry into multiple basic intermediate geometry; write the geometry parameters into the basic intermediate geometry; pass the basic intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0354] In this embodiment, the set of intermediate geometries is split into multiple basic intermediate geometries one or more times. The basic intermediate geometries can be single-point type, single-line type, or single-face type. The basic intermediate geometries in the above embodiment are called, the corresponding geometry parameters are written into each basic intermediate geometries, each basic intermediate geometries is passed as a pointer to the upper-level composite intermediate geometries, and the geometry composite parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometries.
[0355] In one specific embodiment, the intermediate geometry of the set is defined as
[0356] typedef struct
[0357] {
[0358] lwgeom_derive**geo_pointlist; / / Calls the basic intermediate geometry obtained from the splitting and writes the intermediate geometry coordinate parameters;
[0359] dword geo_srid;
[0360] byte geo_dim;
[0361] bool geo_is_solid;
[0362] byte geo_type;
[0363] dword geo_ngeoms;
[0364] }
[0365] lwcollection_derive_derive.
[0366] S750. Convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure.
[0367] The technical solution of this invention involves obtaining an Oracle geometry and its geometry type; the Oracle geometry is geometric data represented by a first geometric structure corresponding to the Oracle spatial database; parsing the Oracle geometry to obtain geometry parameters; determining whether the intermediate geometry corresponding to the geometry type parameters is a composite intermediate geometry or a basic intermediate geometry; splitting the collection intermediate geometry into multiple basic intermediate geometries; writing the geometry parameters into the basic intermediate geometry; passing the basic intermediate geometry as a pointer to the upper-level composite intermediate geometry, and assigning the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry; converting the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by a second geometric structure; by defining intermediate geometry and converting the composite intermediate geometry into a basic intermediate geometry, and using the method of calling the basic intermediate geometry to convert the collection geometry type Oracle geometry into PostGIS geometry, the complexity of the conversion process from collection geometry type Oracle geometry data to geometric data is further simplified, and the conversion efficiency is improved.
[0368] Example 8
[0369] Figure 8 This is a schematic diagram of the structure of an Oracle geometric data conversion device provided in Embodiment 3 of the present invention. Figure 8 As shown, the device includes: a data acquisition module 810, a parameter parsing module 820, a parameter writing module 830, and a data conversion module 840, wherein...
[0370] The data acquisition module 810 is used to acquire Oracle geometry and the geometry type of the Oracle geometry; the Oracle geometry is geometric data represented by a first geometric structure corresponding to the Oracle spatial database;
[0371] Parameter parsing module 820 is used to parse the Oracle geometry to obtain geometry parameters;
[0372] The parameter writing module 830 is used to write the geometry parameters into the intermediate geometry corresponding to the geometry type. The intermediate geometry and the second geometric structure corresponding to the PostGIS spatial database have a mapping relationship between their geometry elements.
[0373] The data conversion module 840 is used to convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; the PostGIS geometry is geometric data represented by the second geometric structure.
[0374] Optionally, the intermediate geometry corresponding to the geometry type of the Oracle geometry includes:
[0375] Single-point intermediate geometry, single-line intermediate geometry, single-face intermediate geometry, multi-point intermediate geometry, multi-line intermediate geometry, multi-face intermediate geometry, single polyhedral surface intermediate geometry, multiple polyhedral surface intermediate geometry, and set intermediate geometry.
[0376] Optionally, the geometric elements of the intermediate geometry include: intermediate geometry variables and the parameter type corresponding to each intermediate geometry variable;
[0377] For the single-point intermediate geometry or the single-line intermediate geometry, the intermediate geometry variables include: intermediate geometry coordinate list, intermediate geometry coordinate system variable, intermediate geometry dimension variable, intermediate geometry entity identifier variable, and intermediate geometry type variable;
[0378] For the single-sided intermediate geometry, the intermediate geometry variables include: intermediate geometry coordinate list, intermediate geometry coordinate system variable, intermediate geometry dimension variable, intermediate geometry entity identifier variable, intermediate geometry type variable, and intermediate geometry ring variable;
[0379] For intermediate geometries of composite geometry type, the intermediate geometry variables include: intermediate geometry coordinate list, intermediate geometry coordinate system variable, intermediate geometry dimension variable, intermediate geometry entity identifier variable, intermediate geometry type variable, and intermediate geometry composite variable; the intermediate geometry of composite geometry type includes: multi-point intermediate geometry, multi-line intermediate geometry, multi-faceted intermediate geometry, set intermediate geometry, single polyhedral surface intermediate geometry, or multi-polyhedral surface intermediate geometry;
[0380] The parameter type of the intermediate geometry coordinate list is represented by a floating-point data storage structure; the floating-point data storage structure is used to define the storage method of floating-point data.
[0381] Optional, the parsing and writing module 820 includes:
[0382] The coordinate system resolution unit is used to resolve the first geometric coordinate system variables in the Oracle geometry to obtain the geometric coordinate system parameters;
[0383] The dimension parsing unit is used to parse the first geometry dimension variable in the Oracle geometry to obtain the geometry dimension.
[0384] The type resolution unit is used to parse the first geometry type variable in the Oracle geometry to obtain the geometry type parameter.
[0385] Optionally, the parameter parsing module 820 also includes:
[0386] The single-point coordinate parsing unit is used to parse the first or second geometric coordinate variable in the Oracle geometry to obtain geometric coordinate parameters when the geometry type is a single-point type.
[0387] The single-line coordinate parsing unit is used to parse the second geometry coordinate variable in the Oracle geometry to obtain the geometry coordinate parameters when the geometry type is single-line.
[0388] The single-sided coordinate parsing unit is used to parse the second geometric coordinate variable in the Oracle geometry to obtain geometric coordinate parameters when the geometry type is single-sided; and to parse the second geometric coordinate interpretation variable to obtain geometric ring parameters.
[0389] The composite coordinate analysis unit, when the geometry type is a composite geometry type, further includes: analyzing the second geometry coordinate variable and the second geometry coordinate interpretation variable to obtain geometry coordinate parameters and geometry composite parameters; the composite geometry type includes: multi-point type, multi-line type, multi-face type, multi-faceted surface type, and set geometry type.
[0390] Optional, single-point coordinate analysis unit, specifically used for:
[0391] If the geometry type is a single point type, determine whether the parameter of the second geometric coordinate variable in the Oracle geometry is empty;
[0392] If not, then the second geometry coordinate variable and the second geometry coordinate interpretation variable in the Oracle geometry are parsed to obtain the geometry coordinate parameters; the second geometry coordinate interpretation variable is used to interpret the second geometry coordinate variable;
[0393] If so, parse the first geometry coordinate variable in the Oracle geometry to obtain the geometry coordinate parameters.
[0394] Optionally, the parameter writing module 830 includes:
[0395] The judgment unit is used to determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry.
[0396] The first parameter writing unit is used to split the composite intermediate geometry into multiple basic intermediate geometries when the intermediate geometry is a composite intermediate geometry; write the geometry parameters into the basic intermediate geometry; pass the basic intermediate geometry as a pointer to the upper-level composite intermediate geometry; and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
[0397] The second parameter writing unit is used to write the geometry parameters into the basic intermediate geometry when the intermediate geometry is the basic intermediate geometry;
[0398] The basic intermediate geometry includes: single-point intermediate geometry, single-line intermediate geometry, and single-face intermediate geometry; the composite intermediate geometry includes: multi-point intermediate geometry, multi-line intermediate geometry, multi-face intermediate geometry, single polyhedral surface intermediate geometry, multiple polyhedral surface intermediate geometry, and aggregate intermediate geometry.
[0399] Optionally, the second parameter is written to the unit, specifically used for:
[0400] Assign the coordinate system parameters of the geometric body to the intermediate geometric body coordinate system variables of the basic intermediate geometric body;
[0401] Assign the geometric dimension to the intermediate geometric dimension variable of the basic intermediate geometry;
[0402] The intermediate geometry entity identifier variable of the basic intermediate geometry is assigned the entity parameter corresponding to the geometry type parameter;
[0403] Assign the geometry type parameter to the intermediate geometry type variable of the basic intermediate geometry.
[0404] Optionally, the second parameter writing unit is also used for:
[0405] If the basic intermediate geometry is a single-point intermediate geometry or a single-line intermediate geometry, the coordinates of the first geometry are written into the intermediate geometry coordinate list of the basic intermediate geometry.
[0406] When the basic intermediate geometry is a single-sided intermediate geometry, the single-sided subtype of the single-sided type is determined according to the coordinate variables of the second geometry. The single-sided subtype includes: rectangular face and non-rectangular face.
[0407] When the single-face subtype is a rectangular face, the geometry ring parameter is assigned to the intermediate geometry ring variable of the basic intermediate geometry; the rectangular face coordinates are determined according to the first geometry coordinates and the intermediate geometry ring variable, and the rectangular face coordinates are written into the intermediate geometry coordinate list of the basic intermediate geometry;
[0408] When the single-face subtype is a non-rectangular face, the coordinates of the non-rectangular face are determined according to the intermediate geometry ring variable and the intermediate geometry dimension variable, and the coordinates of the non-rectangular face are written into the intermediate geometry coordinate list of the basic intermediate geometry.
[0409] The Oracle geometric data conversion device provided in this embodiment of the invention can execute the Oracle geometric data conversion method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0410] Example 9
[0411] Figure 9A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0412] like Figure 9 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0413] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0414] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as methods for transforming Oracle geometric data.
[0415] In some embodiments, the Oracle geometry data conversion method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the Oracle geometry data conversion method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the Oracle geometry data conversion method by any other suitable means (e.g., by means of firmware).
[0416] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0417] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0418] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0419] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0420] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0421] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0422] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0423] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for converting Oracle geometric data, characterized in that, include: Obtain the Oracle geometry and the geometry type of the Oracle geometry; The Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database; Parse the Oracle geometry to obtain the geometry parameters; The geometric parameters are written into the intermediate geometry corresponding to the geometric type. There is a mapping relationship between the geometric elements of the intermediate geometry and the second geometric structure corresponding to the PostGIS spatial database. The intermediate geometry is converted into a PostGIS geometry based on the mapping relationship. The PostGIS geometry is geometric data represented using the second geometric structure; The step of writing the geometry parameters into the intermediate geometry corresponding to the geometry type includes: Determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry; When the geometry type is a composite geometry type, the geometry parameters include composite geometry parameters, which are used to represent the number of geometry elements contained in the composite geometry. When the intermediate geometry is the base intermediate geometry, the geometry parameters are written into the base intermediate geometry; When the intermediate geometry is a composite intermediate geometry, the composite intermediate geometry is split into multiple basic intermediate geometries; the geometry parameters are written into the basic intermediate geometry; the basic intermediate geometry is passed as a pointer to the upper-level composite intermediate geometry, and the geometry composite parameters are assigned to the intermediate geometry composite variable of the upper-level composite intermediate geometry.
2. The method according to claim 1, characterized in that, The intermediate geometries corresponding to the geometry types of the Oracle geometry include: Single-point intermediate geometry, single-line intermediate geometry, single-face intermediate geometry, multi-point intermediate geometry, multi-line intermediate geometry, multi-face intermediate geometry, single polyhedral surface intermediate geometry, multiple polyhedral surface intermediate geometry, and set intermediate geometry.
3. The method according to claim 2, characterized in that, The geometric elements of the intermediate geometry include: intermediate geometry variables and the parameter types corresponding to each intermediate geometry variable; For the single-point intermediate geometry or the single-line intermediate geometry, the intermediate geometry variables include: intermediate geometry coordinate list, intermediate geometry coordinate system variable, intermediate geometry dimension variable, intermediate geometry entity identifier variable, and intermediate geometry type variable; For the single-sided intermediate geometry, the intermediate geometry variables include: intermediate geometry coordinate list, intermediate geometry coordinate system variable, intermediate geometry dimension variable, intermediate geometry entity identifier variable, intermediate geometry type variable, and intermediate geometry ring variable; For intermediate geometries of composite geometry type, the intermediate geometry variables include: intermediate geometry coordinate list, intermediate geometry coordinate system variable, intermediate geometry dimension variable, intermediate geometry entity identifier variable, intermediate geometry type variable, and intermediate geometry composite variable; the intermediate geometry of composite geometry type includes: multi-point intermediate geometry, multi-line intermediate geometry, multi-faceted intermediate geometry, set intermediate geometry, single polyhedral surface intermediate geometry, or multi-polyhedral surface intermediate geometry; The parameter type of the intermediate geometry coordinate list is represented by a floating-point data storage structure; the floating-point data storage structure is used to define the storage method of floating-point data.
4. The method according to claim 1, characterized in that, Parsing the Oracle geometry to obtain geometry parameters includes: The coordinate system parameters of the first geometry are obtained by parsing the first geometry coordinate system variables in the Oracle geometry. The geometry dimension is obtained by parsing the first geometry dimension variable in the Oracle geometry. The geometry type parameter is obtained by parsing the first geometry type variable in the Oracle geometry.
5. The method according to claim 4, characterized in that, Parsing the Oracle geometry to obtain geometry parameters also includes: When the geometry type is a single point type, the geometry coordinate parameters are obtained by parsing the first geometry coordinate variable or the second geometry coordinate variable in the Oracle geometry; When the geometry type is single-line, obtain the geometry coordinate parameters by parsing the second geometry coordinate variable in the Oracle geometry. When the geometry type is a single-face type, the geometry coordinate parameters are obtained by parsing the second geometry coordinate variable in the Oracle geometry; the geometry loop parameters are obtained by parsing the second geometry coordinate interpretation variable. When the geometry type is a composite geometry type, the method further includes: parsing the second geometry coordinate variables and the second geometry coordinate interpretation variables to obtain geometry coordinate parameters and geometry composite parameters; the composite geometry type includes: multi-point type, multi-line type, multi-face type, multi-faceted surface type, and set geometry type.
6. The method according to claim 5, characterized in that, When the geometry type is a single-point type, the geometry coordinate parameters are obtained by parsing the first or second geometry coordinate variable in the Oracle geometry, including: If the geometry type is a single point type, determine whether the parameter of the second geometric coordinate variable in the Oracle geometry is empty; If not, then the second geometry coordinate variable and the second geometry coordinate interpretation variable in the Oracle geometry are parsed to obtain the geometry coordinate parameters; the second geometry coordinate interpretation variable is used to interpret the second geometry coordinate variable; If so, parse the first geometry coordinate variable in the Oracle geometry to obtain the geometry coordinate parameters.
7. The method according to claim 1, characterized in that, The basic intermediate geometry includes: single-point intermediate geometry, single-line intermediate geometry, and single-face intermediate geometry; the composite intermediate geometry includes: multi-point intermediate geometry, multi-line intermediate geometry, multi-face intermediate geometry, single polyhedral surface intermediate geometry, multiple polyhedral surface intermediate geometry, and aggregate intermediate geometry.
8. The method according to claim 7, characterized in that, Writing the geometric parameters into the basic intermediate geometry includes: Assign the coordinate system parameters of the geometric body to the intermediate geometric body coordinate system variables of the basic intermediate geometry; Assign the geometry dimension to the intermediate geometry dimension variable of the basic intermediate geometry; The intermediate geometry entity identifier variable of the basic intermediate geometry is assigned the entity parameter corresponding to the geometry type parameter; Assign the geometry type parameter to the intermediate geometry type variable of the basic intermediate geometry.
9. The method according to claim 8, characterized in that, Writing the geometric parameters into the basic intermediate geometry also includes: When the basic intermediate geometry is a single-point intermediate geometry or a single-line intermediate geometry, the coordinates of the first geometry are written into the intermediate geometry coordinate list of the basic intermediate geometry; When the basic intermediate geometry is a single-sided intermediate geometry, the single-sided subtype of the single-sided type is determined according to the coordinate variables of the second geometry. The single-sided subtype includes: rectangular face and non-rectangular face. When the single-face subtype is a rectangular face, the geometry ring parameter is assigned to the intermediate geometry ring variable of the basic intermediate geometry; the rectangular face coordinates are determined according to the first geometry coordinates and the intermediate geometry ring variable, and the rectangular face coordinates are written into the intermediate geometry coordinate list of the basic intermediate geometry; When the single-face subtype is a non-rectangular face, the coordinates of the non-rectangular face are determined according to the intermediate geometry ring variable and the intermediate geometry dimension variable, and the coordinates of the non-rectangular face are written into the intermediate geometry coordinate list of the basic intermediate geometry.
10. A device for converting Oracle geometric data, characterized in that, include: The data acquisition module is used to acquire the Oracle geometry and the geometry type of the Oracle geometry; The Oracle geometry is geometric data represented by the first geometric structure corresponding to the Oracle spatial database; The parameter parsing module is used to parse the Oracle geometry to obtain the geometry parameters; The parameter writing module is used to write the geometry parameters into the intermediate geometry corresponding to the geometry type. There is a mapping relationship between the geometry elements of the intermediate geometry and the second geometric structure corresponding to the PostGIS spatial database. The data conversion module is used to convert the intermediate geometry into a PostGIS geometry according to the mapping relationship; The PostGIS geometry is geometric data represented using the second geometric structure; The parameter writing module includes: The judgment unit is used to determine whether the intermediate geometry corresponding to the geometry type parameter is a composite intermediate geometry or a basic intermediate geometry; when the geometry type is a composite geometry type, the geometry parameter includes a geometry composite parameter; the geometry composite parameter is used to indicate the number of geometry contained in the composite geometry; The first parameter writing unit is used to split the composite intermediate geometry into multiple basic intermediate geometries when the intermediate geometry is a composite intermediate geometry; write the geometry parameters into the basic intermediate geometry; pass the basic intermediate geometry as a pointer to the upper-level composite intermediate geometry; and assign the geometry composite parameters to the intermediate geometry composite variable of the upper-level composite intermediate geometry. The second parameter writing unit is used to write the geometry parameters into the basic intermediate geometry when the intermediate geometry is the basic intermediate geometry.
11. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the Oracle geometry data conversion method according to any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the method for converting Oracle geometric data as described in any one of claims 1-9.
Citation Information
Patent Citations
Geometric feature description data file generation method and geometric feature format conversion method
CN115100357A
Heterogeneous spatial database data synchronization method and device and electronic equipment
CN115455111A