In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
What is the basic operation of Oracle Spatial? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Spatial mainly manages spatial data through metadata tables, spatial data fields (i.e. sdo_Geometry fields) and spatial index, and provides a series of spatial query and spatial analysis packages on this basis, allowing users to carry out deeper GIS application development. Oracle
Spatial uses spatial field sdo_Geometry to store spatial data, uses metadata table to manage spatial data table with sdo_Geometry field, and uses R-tree index and quadtree index technology to improve the speed of spatial query and spatial analysis.
1. Metadata table description
Oracle
The metadata table of Spatial stores information such as data table name, spatial field name, coordinate range of spatial data, coordinate system and coordinate dimension description. Users must go through the metadata table to know whether there is Oracle in the Oracle database
Spatial data information of Spatial. Access the metadata table through the metadata View (USER_SDO_GEOM_METADATA). The basic definition of a metadata view is:
2. Spatial field analysis
Oracle
The spatial data of Spatial is stored in the spatial field sdo_Geometry. To understand sdo_Geometry is to write Oracle.
The key to the Spatial program. Sdo_Geometry is an object defined according to the Open GIS specification, and its original creation is as follows.
one
Sdo_Gtype
Is a numeric value of type number that defines the type of geometric object to be stored. Sdo_Gtype is a four-digit integer in the format dltt, where d represents the dimension of a geometric object; l represents a linear reference value in a three-dimensional linear reference system, which needs to be set when d is 3D or 4D, which is generally empty; tt is the type of geometric object, Oracle
Spatial defines seven types of geometric types. Currently, tt uses 00 to 07, of which 08 to 99 is Oracle.
The number retained by Spatial for future expansion of geometric objects.
two
Sdo_Srid
Sdo_Srid is also a numeric value of number type, which is used to identify the spatial coordinate system associated with geometric objects. If sdo_Srid is empty (null), there is no coordinate system associated with the geometric object; if the value is not empty, the value must be a value of the SRID field in the MDSYS.CS_ SRS table, which must be added to the SRID field of the USER_SDO_GEOM_METADATA view that describes the spatial data table metadata when creating a table that contains geometric objects. For Longitude/Latitude (8307), Oracle, which we usually use the international standard
Spatial states that all geometric objects in a geometric field must have the same sdo_ Grid value.
③ sdo_Point
Sdo_Point is an object that contains numerical information of three-dimensional coordinate X _ (Magi) Y _ (Z) Z, which is used to represent geometric objects with geometric types of points. If both the sdo_Elem_Info and SDO_ORDINATES arrays are empty, the XMagi Ypenz in sdo_Point is the coordinate value of the point object, otherwise, the value of sdo_Point will be ignored (represented by NULL). Oracle
Spatial strongly requires that sdo_Point be used to store spatial data of point type, which can greatly optimize Oracle.
Storage performance and query efficiency of Spatial.
four
Sdo_Elem_Info
Sdo_Elem_Info is a variable-length array, with every three numbers as an element unit, indicating how the coordinates are stored in the SDO_ORDINATES array. In this paper, the three numbers that make up an element are called three tuples. A 3-tuple contains the following three parts:
◇
SDO_STARTING_OFFSET
SDO_STARTING_OFFSET
Indicates where the first coordinate of each geometric element is stored in the SDO_ORDINATES array. Its value starts at 1 and increases gradually.
◇
SDO_ETYPE
SDO_ETYPE is used to represent the geometric type of each constituent element in a geometric object. When its value is 1, 2
1003 and 2003 show that this geometric element is a simple element. If SDO_ETYPE is 1003, the polygon is an outer ring (the first number is 1 for the outer ring), and the coordinate values are stored counterclockwise; if SDO_ETYPE is 2003, the polygon is an inner ring (the first number is 2 for the inner ring), and the coordinate values are stored clockwise. When SDO_ETYPE is 4
In 1005 and 2005, it shows that this geometric element is a complex element. It contains at least one triple to indicate how many geometrically simple elements the complex element has. Similarly, 1005 indicates that the polygon is an outer ring with coordinate values stored counterclockwise, and 2005 indicates that the polygon is an inner ring and coordinate values are stored clockwise.
◇
SDO_INTERPRETATION
SDO_INTERPRETATION has two meanings, and the specific function is determined by whether SDO_ETYPE is a complex element or not. If SDO_ETYPE is a complex element (4
1005 and 2005), SDO_INTERPRETATION indicates that several child triples behind it belong to this complex element. If SDO_ETYPE is a simple element (1,2)
1003 and 2003), SDO_INTERPRETATION represents how the coordinate values of the element are arranged in SDO_ORDINATES.
It is important to note that for a complex element, the child elements that make up it are continuous, and the last point of one child element is the starting point of the next child element. The last coordinate of the last child element is either the same as the SDO_STARTING_OFFSET value of the next element minus 1, or the last coordinate of the entire SDO_ORDINATES array.
five
Sdo_Ordinates
SDO_ORDINATES is a variable-length array that stores the actual coordinates of geometric objects. It is an array of type Number with a maximum length of 1048576.
SDO_ORDINATES must be used in conjunction with the sdo_Elem_Info array to make sense. The coordinate storage of SDO_ORDINATES is determined by the dimension of the geometric object. If the geometric object is two-dimensional, the coordinate of SDO_ORDINATES is {
X1, y1, x2, y2, … } arranged sequentially, if the geometric object is three-dimensional, the coordinates of SDO_ORDINATES are {x1, y1, z1, x2, y2, z2
... The order of}.
3. Spatial indexing technology:
Oracle
Spatial provides R-tree index and quad-tree index to improve the speed of spatial query and spatial analysis. Users need to create different indexes according to different spatial data types. When the spatial data type is more complex, if you choose the index type incorrectly, it will make Oracle
The process of creating an index in Spatial becomes very slow.
Third, convert longitude and latitude into place names
At present, all kinds of location services LBS finally return longitude and latitude within the allowable range of error, such as GPS vehicle terminals, mobile phone positioning and other mobile devices, which can be transformed into specific place names or nearby landmarks through certain technical algorithms. Or according to the need to return the current location of users concerned about the surrounding information, such as hospitals, hotels, gas stations, bus stations and so on.
1. Spatial data to Oracle
Import of Spatial
At present, the process of establishing thematic spatial database includes technical design, data preparation, data acquisition, data storage and so on. Data acquisition can often take advantage of the existing GIS
Professional software such as GeoStar, MAPGIS, SUPERMAP, ARCGIS, etc. The obtained data is uploaded to Oracle through a spatial data engine (such as Easyloader).
In the database, Oracle Spatial is used to store and manage spatial data. The MAPORA engine is to upload spatial data to Oracle by programming the plain code format of MAPGIS.
A method of Spatial.
2. The whole process of location service
3 、 Oracle
The packages used for the Spatial association:
◆ sdo_Geom.Relate (sdo_Geometry1, 'MASK'
Sod_Geometry2, tolerance
): used to determine the relationship between one geometry and another, we used to determine whether the current point is on a certain face (province, county and city, township).
◇
Sdo_Geometry1,sdo_Geometry2 is the geometric object corresponding to spatial data.
◇ Tolerance:
Allowable range of accuracy
◇
MASK=Anyinteract/Contains/Coveredby/Covers/Disjoint/
○ Anyinteract:
The sdo_Geometry2 falls on the sdo_Geometry1 surface and is included on the edge.
○ Contains:
Sdo_Geometry2 is completely contained in sdo_Geometry1 geometric objects, and the edges of the two geometric objects do not intersect.
○ Coveredby:
Sdo_Geometry1 is completely contained in sdo_Geometry2, and the edges of these two geometric objects have one or more points that overlap each other.
○ Covers:
Sdo_Geometry2 is completely contained in sdo_Geometry1, and the edges of these two geometric objects have one or more points that overlap each other.
○ Disjoint:
The two geometries do not overlap, nor do they have common edges.
○ Equal: two geometries are equal.
○ Inside:
Sdo_Geometry1 is completely contained in sdo_Geometry2 geometric objects, and the edges of the two geometric objects do not intersect.
○ On:
The edges and inner lines of the sdo_Geometry1 are entirely on the sdo_Geometry2.
○ Overlapbdydisjoint:
Two geometric objects overlap, but the edges do not cross.
○ Overlapbdyintersect:
Two geometric objects overlap and the edges partially intersect.
○ Touch: two geometric objects have common edges but do not intersect.
◆ sdo_nn (
Sdo_Geometry1, sdo_Geometry2, 'sdo_num_res', Tolerance
): returns what other sets of geometry are around the geometry sdo_Geometry2.
◇
Sdo_Geometry1,sdo_Geometry2 is the geometric object corresponding to spatial data.
◇ Tolerance:
Allowable range of accuracy
◇ sdo_num_res=n: returns n geometry, and = 1 returns only one.
◆
Sdo_Geom.Within_Distance (sdo_Geometry1, Distance, sdo_Geometry2, Tolerance
'unit') is used to determine what other sets of geometry sdo_Geometry2 are near the perimeter of the specified distance Distance.
◇
Sdo_Geometry1,sdo_Geometry2 is the geometric object corresponding to spatial data.
◇ Tolerance:
Allowable range of accuracy
◇ Distance: specified distanc
◇ Unit: the unit used to represent distance, which may be Unit=M/
A unit of length equal to Unit=KM, but must be one of the units listed in the SDO_DIST_ units table.
4. Returned information:
The returned information can return all the information associated with the spatial information according to the business needs, and then combine it into a paragraph by syllogism, and return to the mobile terminal through SMS and other ways.
◆
It can be the location information of the current location, such as place name, city landmark, custom landmark, road name, etc.
◆
It can be the surrounding information of the current location: hospitals, hotels, gas stations, bus stops, etc.
IV. Concluding remarks
Adopt Oracle
Spatial
Storing and managing spatial data is easy to solve the problems of data sharing, distributed processing, network communication, open development, concurrency control, network integration, cross-platform operation and data security recovery mechanism.
Can be directly through Oracle
Spatial has powerful spatial analysis.
Spatial analysis: shortest path analysis, connectivity analysis, least transfer algorithm in traffic system and its implementation.
LBS business has a broad development prospect, and the current commercial LBS industry competition has also reached a considerable degree of penetration. LBS service involves many fields, which need to be realized by the combination of mobile communication field and GIS field. At present, China attaches great importance to the development of GIS field, and there are quite a lot of GIS manufacturers with certain strength and development potential in China. It is believed that with the continuous growth of LBS business demand and the continuous development and improvement of GIS field in our country, LBS service will be more widely used.
After reading the above, have you mastered the basic operation of Oracle Spatial? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.