Spherical distance determination method and device, electronic equipment and computer readable storage medium
By calculating the latitude and longitude coordinates and spherical radius of two points on the spherical surface, the calculation of spherical distance is simplified, and the problem of low calculation efficiency of massive latitude and longitude distances is solved, and efficient and accurate spherical distance calculation is achieved.
Patent Information
- Application Number
- CN202310664792.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2024-12-06
AI Technical Summary
In location-based services, the calculation of massive latitude and longitude distances between the store and the mobile terminal user consumes a large amount of computing resources, resulting in low computational efficiency of spherical distances.
By obtaining the latitude and longitude coordinates and spherical radius of two points on the spherical surface, the shortest arc length of the latitude and longitude plane is calculated, and the spherical distance calculation is simplified by using Pythagorean theorem and quadratic polynomial fitting method to reduce the calculation complexity.
The accuracy and speed of spherical distance calculations have been improved, the computing performance has been significantly optimized, especially in terms of real-time data calculation timeliness and accuracy.
Smart Images

Figure CN119089073A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of e-commerce technology, and in particular to a method and device for determining spherical distance, an electronic device, and a computer-readable storage medium. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] When carrying out online and offline e-commerce (O2O) marketing services based on location services (LBS), stores usually provide services to users within their coverage area (usually 3 kilometers, 5 kilometers, etc.).
[0004] With the rapid development of the business, the above business scenarios require a large number of distance calculations between the longitude and latitude of stores and mobile terminals to obtain the users covered by the stores. Due to the huge scale of stores and mobile terminal users, the distance calculation between a large number of longitudes and latitudes will consume a lot of computing resources, resulting in low efficiency in calculating spherical distances.
[0005] Therefore, the technical problem to be solved by the present application is how to increase the speed of spherical distance calculation. Summary of the invention
[0006] The purpose of the present disclosure is to provide a spherical distance determination method, device, electronic device and computer-readable storage medium, which can improve the accuracy and speed of spherical distance calculation.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0008] An embodiment of the present disclosure provides a method for determining spherical distance, including: obtaining the longitude and latitude coordinates of a first point on a spherical surface and the longitude and latitude coordinates of a second point on the spherical surface; obtaining the spherical radius of a sphere corresponding to the sphere; determining, on the spherical surface according to the spherical radius, the latitude coordinates of the first point and the latitude coordinates of the second point, a first shortest arc length of a latitude plane corresponding to the latitude of the second point from the first point to the second point, wherein all points with the same latitude as the second point are on the latitude plane corresponding to the latitude of the second point; determining, on the spherical surface according to the spherical radius, the longitude coordinates of the first point, the longitude coordinates of the second point and the latitude coordinates of the second point, a second shortest arc length of a longitude plane corresponding to the longitude of the first point from the second point to the first point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point; determining, on the spherical surface according to the first shortest arc length and the second shortest arc length, a spherical distance from the first point to the second point.
[0009] In some embodiments, the first shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point is determined on the spherical surface based on the radius of the sphere, the latitude coordinate of the first point and the latitude coordinate of the second point, including: determining the absolute value of the latitude difference between the first point and the second point based on the latitude coordinate of the first point and the latitude coordinate of the second point; converting the absolute value of the latitude difference into radians to obtain the absolute value of the latitude difference expressed in radians; determining the shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point on the spherical surface based on the absolute value of the latitude difference expressed in radians and the radius of the sphere.
[0010] In some embodiments, the second shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point is determined on the spherical surface based on the radius of the sphere, the longitude coordinate of the first point, the longitude coordinate of the second point and the latitude coordinate of the second point, including: determining the absolute value of the longitude difference between the first point and the second point based on the longitude coordinates of the first point and the longitude coordinates of the second point; converting the absolute value of the longitude difference into radians to obtain the absolute value of the longitude difference expressed in radians; determining the shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point on the spherical surface based on the absolute value of the longitude difference expressed in radians, the radius of the sphere and the latitude coordinate of the second point.
[0011] In some embodiments, the latitude of the second point is the line-plane angle between the line connecting the second point and the center of the sphere and the equatorial plane of the sphere; wherein, according to the absolute value of the longitude difference represented by the radian, the radius of the sphere and the latitude coordinate of the second point, the shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point to the first point is determined on the spherical surface, including: determining the cosine value corresponding to the line-plane angle; according to the radius of the sphere, the cosine value corresponding to the line-plane angle and the absolute value of the longitude difference represented by the radian, determining the shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point to the first point on the spherical surface.
[0012] In some embodiments, determining the cosine value corresponding to the line-plane angle includes: determining the cosine value of the line-plane angle corresponding to points at different latitudes on the spherical surface; performing linear fitting on the cosine values of the line-plane angle corresponding to points at different latitudes on the spherical surface to obtain a quadratic polynomial about the line-plane angle; inputting the line-plane angle corresponding to the second point into the quadratic polynomial to determine the cosine value of the line-plane angle corresponding to the latitude of the second point.
[0013] In some embodiments, the spherical distance from the first point to the second point is determined on the spherical surface based on the first shortest arc length and the second shortest arc length, including: determining the intersection point closest to the second point between the latitude plane and the longitude plane; constructing a triangle based on the first point, the second point and the intersection point; using the shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point as one right-angled side of the triangle; using the shortest arc length of the longitude plane corresponding to the longitude from the second point to the first point as the other right-angled side of the triangle; determining the length of the hypotenuse of the triangle based on the arc lengths of the two right-angled sides of the triangle, and using the length of the hypotenuse of the triangle as the shortest arc length from the first point to the second point.
[0014] In some embodiments, obtaining the longitude and latitude coordinates of a first point on a spherical surface and the longitude and latitude coordinates of a second point on the spherical surface includes: obtaining a product delivery distance query request sent by a first object; in response to the product delivery distance query request, determining the longitude and latitude coordinates of a second object that delivers the product, and using the longitude and latitude coordinates of the second object as the longitude and latitude coordinates of the first point; determining the longitude and latitude coordinates of the first object, and using the longitude and latitude coordinates of the first object as the longitude and latitude coordinates of the second point; wherein the spherical surface is the spherical surface of the earth; wherein obtaining the radius of a sphere corresponding to the spherical surface includes: obtaining the radius of the earth, so as to determine the shortest arc length of the distance between the second object and the first object on the earth based on the radius of the earth, the longitude and latitude coordinates of the first object and the longitude and latitude coordinates of the second object.
[0015] The embodiment of the present disclosure provides a device for determining spherical distance, including: a latitude and longitude coordinate module, a spherical radius acquisition module, a first arc length acquisition module, a second arc length acquisition module and a shortest arc length determination module.
[0016] Among them, the longitude and latitude coordinates module is used to obtain the longitude and latitude coordinates of the first point on the spherical surface and the longitude and latitude coordinates of the second point on the spherical surface; the spherical radius acquisition module can be used to obtain the spherical radius of the sphere corresponding to the spherical surface; the first arc length acquisition module can be used to determine the first shortest arc length of the latitude plane corresponding to the latitude of the first point to the second point on the spherical surface according to the spherical radius, the latitude coordinates of the first point and the latitude coordinates of the second point, wherein all points with the same latitude as the second point are on the latitude plane corresponding to the latitude of the second point; the second arc length acquisition module can be used to determine the second shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point to the first point on the spherical surface according to the spherical radius, the longitude coordinates of the first point, the longitude coordinates of the second point and the latitude coordinates of the second point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point; the shortest arc length determination module can be used to determine the spherical distance from the first point to the second point on the spherical surface according to the first shortest arc length and the second shortest arc length.
[0017] An embodiment of the present disclosure provides an electronic device, which includes: a memory and a processor; the memory is used to store computer program instructions; the processor calls the computer program instructions stored in the memory to implement any of the above-mentioned methods for determining spherical distance.
[0018] The embodiment of the present disclosure provides a computer-readable storage medium having computer program instructions stored thereon for implementing any of the above-described methods for determining spherical distance.
[0019] The embodiment of the present disclosure provides a computer program product or a computer program, which includes computer program instructions stored in a computer-readable storage medium. The computer program instructions are read from the computer-readable storage medium, and a processor executes the computer program instructions to implement the above-mentioned spherical distance determination method.
[0020] The spherical distance determination method, device, electronic device and computer-readable storage medium provided in the embodiments of the present disclosure can simply and accurately calculate the direct spherical distance between two points on the sphere through the latitude and longitude coordinates of the two points and the spherical radius.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0023] Figure 1 A schematic diagram of a scenario that can be applied to a spherical distance determination method or a spherical distance determination device in an embodiment of the present disclosure is shown.
[0024] Figure 2 The figure is a flow chart of a method for determining a spherical distance according to an exemplary embodiment.
[0025] Figure 3 It is a schematic diagram of a spherical structure according to an exemplary embodiment.
[0026] Figure 4 is a triangle schematic diagram shown according to an exemplary embodiment.
[0027] Figure 5 The present invention is a flowchart of a method for determining the shortest arc length of a latitude plane corresponding to the latitude of a first point to a second point according to an exemplary embodiment.
[0028] Figure 6 The present invention is a flowchart showing a method for determining the shortest arc length from a second point to a longitude plane corresponding to the longitude of a first point according to an exemplary embodiment.
[0029] Figure 7 The present invention is a flowchart of a method for determining a cosine value corresponding to a line-plane angle according to an exemplary embodiment.
[0030] Figure 8 is a graph showing how cosine values vary with latitude according to an exemplary embodiment.
[0031] Fig. 9 The figure is a flow chart of a method for determining a spherical distance according to an exemplary embodiment.
[0032] Fig.10 The figure is a block diagram of a device for determining a spherical distance according to an exemplary embodiment.
[0033] Fig.11 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0034] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0035] Those skilled in the art know that the implementation of the present application can be a system, device, equipment, method or computer program product. Therefore, the present application can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0036] The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0037] The accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0038] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and steps, nor must they be executed in the order described. For example, some steps can be decomposed, and some steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0039] In the description of the present application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is only a kind of association relationship describing the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "plurality" means two or more. The words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be different; the terms "comprising", "including" and "having" are used to express the meaning of open inclusion and mean that in addition to the listed elements / components / etc., there may be other elements / components / etc.
[0040] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0041] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0042] For example, when collecting user location information, we will obtain the user's consent in advance and use the location information only within the scope of the user's consent.
[0043] First, some terms involved in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0044] Location-based services (LBS) use various positioning technologies to obtain the current location of a device and provide information resources and basic services to the positioning device through the mobile Internet.
[0045] Longitude and latitude coordinates, a spherical coordinate system that uses a three-dimensional sphere to define space on the earth, can identify any location on the earth. Among them, the angle between a line connecting a point on the sphere to the center of the sphere and the equatorial plane is the latitude of the point. Longitude generally refers to the horizontal coordinate of the spherical coordinate system, specifically the degree east or west of a point on the sphere from a north-south line called the prime meridian.
[0046] Minor arc: An arc that is smaller than a semicircle is called a minor arc.
[0047] The least squares method is a mathematical optimization technique that aims to find the best matching function by minimizing the sum of squared errors. This method can be used to solve unknown data and minimize the error between these data and the actual data.
[0048] Quadratic polynomial fitting: A quadratic polynomial is a polynomial whose number of terms exceeds 1 and whose highest power is 2. The fitting process is as follows: First, set the function to be fitted f(x) = ax 2 +ax+c, and then use the least squares method to determine the coefficients a, b, c of f(x), and finally determine the function expression of f(x)
[0049] The foregoing introduces some terminology concepts involved in the embodiments of the present application. The following introduces the technical features involved in the embodiments of the present application.
[0050] In the related art, the distance between two longitude and latitude coordinates is generally calculated using a standard spherical model (such as the Haversine method): the standard spherical model calculation method regards the earth as a standard sphere, and the distance between two points on the sphere is the length of the minor arc between the two points. This method is widely used, and can be specifically referred to in formula (1).
[0051] AB=R·arccos(sin(lngA)·sin(lngB)+cos(latA)·cos(latB)cos(lngA-lngB))(1)
[0052] Where R is the radius of the earth, lngA, latA and lngB, latB are the longitude and latitude of points A and B respectively.
[0053] In some related technologies, the ellipsoid model calculation method is also used to calculate the direct distance between two points on the sphere, but this method is relatively complicated and will not be described in detail here.
[0054] The above two technical solutions have at least the following disadvantages: (1) Both the spherical model calculation method and the ellipsoid model calculation method use complex trigonometric function operations, which consume a lot of computing resources. When performing real-time or quasi-real-time data calculations, the timeliness is very poor and the accuracy cannot be guaranteed.
[0055] In view of the above problems, this solution proposes an efficient and accurate spherical distance approximate calculation method to calculate the distance between two longitude and latitude points on the earth's spherical surface.
[0056] This solution solves the problem of high complexity in calculating the spherical distance mentioned above, reduces the calculation time, and optimizes the calculation performance.
[0057] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0058] Figure 1 A schematic diagram of a scenario that can be applied to a spherical distance determination method or a spherical distance determination device in an embodiment of the present disclosure is shown.
[0059] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application.
[0060] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0061] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, wearable devices, virtual reality devices, smart homes, etc.
[0062] The server 105 may be a server that provides various services, such as a background management server that provides support for devices operated by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received request data, and feed back the processing results to the terminal device.
[0063] The server can be an independent physical server or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as basic cloud computing services such as big data and artificial intelligence platforms, etc. The present disclosure does not impose any restrictions on this.
[0064] The server 105 may, for example, obtain the longitude and latitude coordinates of the first point on the spherical surface and the longitude and latitude coordinates of the second point on the spherical surface; the server 105 may, for example, obtain the radius of the sphere corresponding to the sphere; the server 105 may, for example, determine the first shortest arc length of the latitude plane corresponding to the latitude of the second point from the first point on the spherical surface based on the radius of the sphere, the latitude coordinate of the first point and the latitude coordinate of the second point, wherein all points with the same latitude as the second point are on the latitude plane corresponding to the latitude of the second point; the server 105 may, for example, determine the second shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point on the spherical surface based on the radius of the sphere, the longitude coordinate of the first point, the longitude coordinate of the second point and the latitude coordinate of the second point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point; the server 105 may, for example, determine the spherical distance from the first point to the second point on the spherical surface based on the first shortest arc length and the second shortest arc length. It should be understood that Figure 1 The number of terminal devices, networks and servers in the figure is only for illustration. The server 105 may be a physical server or may be composed of multiple servers. According to actual needs, it may have any number of terminal devices, networks and servers.
[0065] Figure 2 is a flow chart of a method for determining spherical distance according to an exemplary embodiment. The method provided by the embodiment of the present disclosure can be executed by any electronic device with computing and processing capabilities. For example, the method can be executed by the above Figure 1 The server or terminal device in the embodiment may be executed, or the server and the terminal device may be executed together. In the following embodiments, the server is used as the execution subject for example, but the present disclosure is not limited to this.
[0066] Reference Figure 2 The method for determining spherical distance provided by the embodiment of the present disclosure may include the following steps.
[0067] Step S202, obtaining the longitude and latitude coordinates of a first point on the spherical surface and the longitude and latitude coordinates of a second point on the spherical surface.
[0068] like Figure 3 As shown, the longitude and latitude coordinates of point A and point B can be obtained. Point A and point B can be any two points on the sphere. The longitude and latitude of point A and point B are recorded as (ln,ln) and (lngB,latB) respectively.
[0069] Among them, if A and B are both in the northern hemisphere, the latitudes of point A and point B are both positive. If point A and point B are one in the southern hemisphere and one in the northern hemisphere or the southern hemisphere, the latitudes of point A and point B are one positive and one negative, and this application will not repeat them. Similarly, if A and B are both in the eastern hemisphere or the western hemisphere, the latitudes of point A and point B are both positive. If point A and point B are one in the eastern hemisphere and one in the western hemisphere, the latitudes of point A and point B are one positive and one negative, and this application will not repeat them.
[0070] This application will use the above-mentioned spherical surface as the surface of the earth as an example for explanation, but this application does not limit this. Any spherical surface is the spherical surface to be protected by this application.
[0071] Step S204, obtaining the radius of the sphere corresponding to the spherical surface.
[0072] Step S206, determining the first shortest arc length of the latitude plane corresponding to the latitude of the second point from the first point to the second point on the spherical surface according to the radius of the sphere, the latitude coordinate of the first point and the latitude coordinate of the second point, wherein all points with the same latitude as the second point are on the latitude plane corresponding to the latitude of the second point.
[0073] In some embodiments, Figure 3 As shown, if you want to calculate the distance between two points A and B on the sphere, you can first determine the distance between BC in the north-south direction.
[0074] In some embodiments, the first shortest arc length (e.g., Figure 3 AB in), the calculation process can refer to the following derivation process.
[0075] According to the arc length theorem, Where α is the central angle of BC in the great circle (such as the longitude plane corresponding to the longitude of the first point B), thus obtaining For the above formula, the angle is converted to radians, then BC=R|y A -y B |, where y A ,y B is the radian representation of latA and latB, that is R is the radius of the sphere.
[0076] Through the above derivation process, we can know that when the latitudes of the first point and the second point are known and the radius of the sphere is known, we can determine the shortest arc length of the latitude plane corresponding to the latitude of the first point to the second point (such as Figure 3 AB in).
[0077] Step S208, based on the radius of the sphere, the longitude coordinates of the first point, the longitude coordinates of the second point and the latitude coordinates of the second point, determine on the spherical surface the second shortest arc length from the second point to the longitude plane corresponding to the longitude of the first point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point.
[0078] Refer to the shortest arc length of the latitude plane corresponding to the latitude of the first point to the second point (such as Figure 3 The calculation process of AB in the figure can determine the shortest arc length in the longitude plane corresponding to the longitude from the second point to the first point on the spherical surface.
[0079] For example, when calculating the shortest arc length in the longitude plane corresponding to the longitude of the second point to the first point (such as Figure 3 When the value of AC) corresponding to the small and medium circle O1 is, the radius corresponding to the circle O1 is R1 = R·cosθ, then Then it is concluded where x A , x B is the radian representation of lngA and lngB, that is
[0080] Step S210: determining a spherical distance from a first point to a second point on a spherical surface according to the first shortest arc length and the second shortest arc length.
[0081] When calculating the distance between AB, first use Figure 4 The calculation is performed using the Pythagorean theorem as shown.
[0082] like Figure 4 As shown, the intersection point closest to the second point can be determined between the latitude plane and the longitude plane (such as Figure 3 C in ); construct a triangle based on the first point, the second point and the intersection point (such as Figure 4 The triangle shown in the figure); the shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point is a right-angled side of the triangle (such as Figure 3 and Figure 4 BC shown); the shortest arc length of the longitude plane corresponding to the longitude of the second point to the first point is the other right-angled side of the triangle (such as Figure 3 and Figure 4 AC shown); According to the arc lengths of the two right-angled sides of the triangle, determine the length of the hypotenuse of the triangle, and use the length of the hypotenuse of the triangle as the shortest arc length from the first point to the second point (such as Figure 3 and Figure 4 AB shown).
[0083] According to the Pythagorean theorem, the above process can be specifically expressed as formula (2):
[0084]
[0085] where y A ,y B , x A , x B are the radians of latA, latB, lngA, and lngB respectively, and θ is the latitude corresponding to AC.
[0086] Figure 5 The present invention is a flowchart of a method for determining the shortest arc length of a latitude plane corresponding to the latitude of a first point to a second point according to an exemplary embodiment.
[0087] refer to Figure 5 The method for determining the shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point may include the following steps.
[0088] Step S502: determining the absolute value of the latitude difference between the first point and the second point according to the latitude coordinate of the first point and the latitude coordinate of the second point.
[0089] In some embodiments, after the latitude coordinates of the first point and the second point are obtained, the absolute value of the latitude difference between the first point and the second point may be determined according to |latA-latB|.
[0090] Step S504: convert the absolute value of the latitude difference into radians to obtain the absolute value of the latitude difference expressed in radians.
[0091] In some embodiments, the Convert the absolute value of the latitude difference to radians to obtain the absolute value of the latitude difference expressed in radians.
[0092] Step S506, determining the first shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point on the spherical surface according to the absolute value of the latitude difference expressed in radians and the radius of the sphere.
[0093] In some embodiments, the Determine the first shortest arc length on the latitude plane corresponding to the latitude from the first point to the second point on the spherical surface.
[0094] Through the above method, the first shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point can be determined on the spherical surface through fewer calculation processes.
[0095] Figure 6 The present invention is a flowchart showing a method for determining the shortest arc length from a second point to a longitude plane corresponding to the longitude of a first point according to an exemplary embodiment.
[0096] refer to Figure 6The above method for determining the shortest arc length from the second point to the longitude plane corresponding to the longitude of the first point may include the following steps.
[0097] Step S602: determining the absolute value of the longitude difference between the first point and the second point according to the longitude coordinates of the first point and the longitude coordinates of the second point.
[0098] In some embodiments, the absolute value of the longitude difference between the first point and the second point may be determined by |lngA-lngB|.
[0099] Step S604, converting the absolute value of the longitude difference into radians to obtain the absolute value of the longitude difference expressed in radians.
[0100] In some embodiments, the The absolute value of the longitude difference is converted into radians to obtain the absolute value of the longitude difference expressed in radians.
[0101] Step S606, determining the second shortest arc length on the longitude plane corresponding to the longitude of the first point from the second point on the spherical surface according to the absolute value of the longitude difference expressed in radians, the radius of the sphere and the latitude coordinate of the second point.
[0102] In some embodiments, the Determine on the spherical surface the second shortest arc length from the second point to the longitude plane corresponding to the longitude of the first point.
[0103] Through the above method, the first shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point can be determined on the spherical surface through fewer calculation processes.
[0104] In the related art, when a computer directly calculates cosθ, it needs to decompose cosθ into Taylor formula for calculation. Among them, Taylor formula has many parameters, and calculating cosθ by Taylor formula will introduce many parameters, making the calculation speed of hardware equipment slower.
[0105] In order to solve the above problems, this application proposes the following solutions.
[0106] In some embodiments, the latitude of the second point is the line-plane angle between the line connecting the second point and the center of the sphere and the equatorial plane of the sphere. Then, the cosine value corresponding to the line-plane angle can be determined first; according to the radius of the sphere, the cosine value corresponding to the line-plane angle, and the absolute value of the longitude difference expressed in radians, the second shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point on the spherical surface is determined.
[0107] Among them, determining the cosine value corresponding to the line-surface angle can specifically include Figure 7 The process shown.
[0108] Figure 7The present invention is a flowchart of a method for determining a cosine value corresponding to a line-plane angle according to an exemplary embodiment.
[0109] refer to Figure 7 The method for determining the cosine value corresponding to the above-mentioned line-surface angle may include the following steps.
[0110] Step S702, determining the cosine values of the line-surface angles corresponding to points at different latitudes on the spherical surface.
[0111] Step S704, performing linear fitting on the cosine values of the line-plane angles corresponding to points at different latitudes on the spherical surface to obtain a quadratic polynomial about the line-plane angles.
[0112] like Figure 8 As shown, the horizontal axis is the radian corresponding to different latitudes on the sphere, and the vertical axis is the cosine value of the line angle corresponding to the latitude.
[0113] In some embodiments, the Figure 8 The cosine value corresponding to the latitude shown is linearly fitted to obtain a quadratic polynomial about the line-surface angle corresponding to the latitude.
[0114] Step S706, inputting the line-plane angle corresponding to the second point into a quadratic polynomial to determine the cosine value of the line-plane angle corresponding to the latitude of the second point.
[0115] For example, since the latitude interval of China is [3°31′, 53°33′], and the radians are expressed as [0.05, 0.93], the least squares method is used to fit a quadratic polynomial to cosθ in this domain, and the result is as follows: Figure 8 Results shown.
[0116] like Figure 8 As shown, in the domain [0.05, 0.93], it can be approximated by the polynomial f(t) = -0.418t 2 -0.04896t+1.00576 is used to replace f(t)=cost, so formula (2) can be replaced by formula (3)
[0117]
[0118] in,
[0119] The method of using formula (3) to replace formula (1) to calculate the spherical distance is verified by the following two points:
[0120] (1) Validation. The following five sets of data are used to compare the results of the two spherical distance calculation methods. For details, please refer to Table 1.
[0121] Table 1
[0122]
[0123]
[0124] (2) Performance verification. The hive execution engine is used to calculate the distance of 100 sets of longitude and latitude points in two ways. The calculation time comparison results under the same computing resources can be referred to in Table 2.
[0125] Table 2
[0126]
[0127] From the above conclusions, it can be concluded that when calculating the distance within a range of 5 kilometers, the error range of the calculation result of formula (3) is within 0.5 meters, the accuracy is extremely high, and the calculation efficiency is improved.
[0128] In the above embodiment, the Pythagorean theorem is first used to calculate the distance between two longitudes and latitudes, and further, a polynomial fitting method is used to replace trigonometric functions, thereby finally achieving simplified calculation.
[0129] Fig. 9 The figure is a flow chart of a method for determining a spherical distance according to an exemplary embodiment.
[0130] refer to Fig. 9 The above-mentioned method for determining the spherical distance may include the following steps.
[0131] Step S902: obtaining a product delivery distance query request sent by the first object.
[0132] The first object may be a user, such as a user who purchases takeout.
[0133] The commodity may be a commodity purchased by the first object.
[0134] Step S904, in response to the product delivery distance query request, determine the longitude and latitude coordinates of the second object of the delivered product, and use the longitude and latitude coordinates of the second object as the longitude and latitude coordinates of the first point.
[0135] Step S906, determining the longitude and latitude coordinates of the first object, and using the longitude and latitude coordinates of the first object as the longitude and latitude coordinates of the second point.
[0136] In some embodiments, the spherical surface may be taken as the spherical surface of the earth for illustration.
[0137] Step S908, obtaining the radius of the earth.
[0138] In some embodiments, the shortest arc length from the second object to the first object can be determined on the earth based on the earth radius, the latitude and longitude coordinates of the first object and the latitude and longitude coordinates of the second object. For details, refer to steps S910 to S912.
[0139] Step S910, based on the radius of the sphere, the longitude coordinates of the first point, the longitude coordinates of the second point and the latitude coordinates of the second point, determine on the spherical surface the second shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point.
[0140] Step S912: determining a spherical distance from the first point to the second point on the spherical surface according to the first shortest arc length and the second shortest arc length.
[0141] Step S914: determining a spherical distance from the first point to the second point on the spherical surface according to the first shortest arc length and the second shortest arc length.
[0142] It should be particularly pointed out that the various steps in the various embodiments of the above-mentioned method for determining the spherical distance can be mutually crossed, replaced, added, or deleted. Therefore, these reasonable permutations and combinations of the method for determining the spherical distance should also fall within the scope of protection of this application, and the scope of protection of this application should not be limited to the embodiments.
[0143] Based on the same inventive concept, the present disclosure also provides a spherical distance determination device, such as the following embodiment. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0144] Fig.10 is a block diagram of a spherical distance determination device according to an exemplary embodiment. Fig.10 The spherical distance determination device 1000 provided in the embodiment of the present disclosure may include: a latitude and longitude coordinate module 1001, a spherical radius acquisition module 1002, a first arc length acquisition module 1003, a second arc length acquisition module 1004 and a shortest arc length determination module 1005.
[0145] Among them, the longitude and latitude coordinates module 1001 can be used to obtain the longitude and latitude coordinates of the first point on the spherical surface and the longitude and latitude coordinates of the second point on the spherical surface; the spherical radius acquisition module 1002 can be used to obtain the spherical radius of the sphere corresponding to the spherical surface; the first arc length acquisition module 1003 can be used to determine the first shortest arc length of the latitude plane corresponding to the latitude of the first point to the second point on the spherical surface according to the spherical radius, the latitude coordinates of the first point and the latitude coordinates of the second point, wherein all points with the same latitude as the second point are on the latitude plane corresponding to the latitude of the second point; the second arc length acquisition module 1004 can be used to determine the second shortest arc length of the longitude plane corresponding to the longitude of the second point to the first point on the spherical surface according to the spherical radius, the longitude coordinates of the first point, the longitude coordinates of the second point and the latitude coordinates of the second point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point; the shortest arc length determination module 1005 can be used to determine the spherical distance from the first point to the second point on the spherical surface according to the first shortest arc length and the second shortest arc length.
[0146] It should be noted that the latitude and longitude coordinate module 1001, the spherical radius acquisition module 1002, the first arc length acquisition module 1003, the second arc length acquisition module 1004 and the shortest arc length determination module 1005 correspond to S202 to S210 in the method embodiment, and the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above method embodiment. It should be noted that the above modules as part of the device can be executed in a computer system such as a set of computer executable instructions.
[0147] In some embodiments, the first arc length acquisition module 1003 may include: a latitude difference absolute value determination submodule, a first radian conversion submodule and a first shortest arc length determination submodule.
[0148] Among them, the latitude difference absolute value determination submodule can be used to determine the absolute value of the latitude difference between the first point and the second point according to the latitude coordinates of the first point and the latitude coordinates of the second point; the first radian conversion submodule can be used to convert the absolute value of the latitude difference into radians to obtain the absolute value of the latitude difference expressed in radians; the first shortest arc length determination submodule can be used to determine the first shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point on the spherical surface according to the absolute value of the latitude difference expressed in radians and the radius of the sphere.
[0149] In some embodiments, the second arc length acquisition module 1004 may include: a longitude difference absolute value determination submodule, a second radian conversion submodule, and a second shortest arc length determination submodule.
[0150] Among them, the longitude difference absolute value determination submodule can be used to determine the absolute value of the longitude difference between the first point and the second point according to the longitude coordinates of the first point and the longitude coordinates of the second point; the second radian conversion submodule can be used to convert the absolute value of the longitude difference into radians to obtain the absolute value of the longitude difference expressed in radians; the second shortest arc length determination submodule can be used to determine the second shortest arc length on the spherical surface from the second point to the longitude plane corresponding to the longitude of the first point according to the absolute value of the longitude difference expressed in radians, the radius of the sphere and the latitude coordinates of the second point.
[0151] In some embodiments, the latitude of the second point is the line angle between the line connecting the second point and the center of the sphere and the equatorial plane of the sphere; wherein the second shortest arc length determination submodule may include: a cosine value determination unit and a shortest arc length determination unit.
[0152] Among them, the cosine value determination unit can be used to determine the cosine value corresponding to the line-plane angle; the shortest arc length determination unit can be used to determine the second shortest arc length in the longitude plane corresponding to the longitude of the first point from the second point on the spherical surface based on the radius of the sphere and the cosine value corresponding to the line-plane angle and the absolute value of the longitude difference expressed in radians.
[0153] In some embodiments, the cosine value determination unit may include: a cosine value determination subunit, a linear fitting subunit, and a binomial calculation subunit.
[0154] Among them, the cosine value determination subunit can be used to determine the cosine value of the line-plane angle corresponding to points at different latitudes on the sphere; the linear fitting subunit can be used to perform linear fitting on the cosine values of the line-plane angle corresponding to points at different latitudes on the sphere to obtain a quadratic polynomial about the line-plane angle; the binomial calculation subunit can be used to input the line-plane angle corresponding to the second point into the quadratic polynomial to determine the cosine value of the line-plane angle corresponding to the latitude of the second point.
[0155] In some embodiments, the shortest arc length determination module 1005 may include: an intersection determination submodule, a triangle construction submodule, a first right-angle side determination submodule, a second right-angle side determination submodule, and a Pythagorean calculation submodule.
[0156] Among them, the intersection determination submodule can be used to determine the intersection closest to the second point between the latitude plane and the longitude plane; the triangle construction submodule can be used to construct a triangle based on the first point, the second point and the intersection; the first right-angle side determination submodule can be used to use the shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point as a right-angle side of the triangle; the second right-angle side determination submodule can be used to use the shortest arc length of the longitude plane corresponding to the longitude from the second point to the first point as the other right-angle side of the triangle; the Pythagorean calculation submodule can be used to determine the length of the hypotenuse of the triangle based on the arc lengths of the two right-angle sides of the triangle, and use the length of the hypotenuse of the triangle as the shortest arc length from the first point to the second point.
[0157] In some embodiments, the latitude and longitude coordinate module 1001 may include: a query request acquisition submodule, a first point position determination submodule, and a second point position determination submodule.
[0158] Among them, the query request acquisition submodule can be used to obtain the product delivery distance query request sent by the first object; the first point position determination submodule can be used to respond to the product delivery distance query request, determine the longitude and latitude coordinates of the second object where the product is delivered, and use the longitude and latitude coordinates of the second object as the longitude and latitude coordinates of the first point; the second point position determination submodule can be used to determine the longitude and latitude coordinates of the first object, and use the longitude and latitude coordinates of the first object as the longitude and latitude coordinates of the second point.
[0159] In some embodiments, the spherical surface is the spherical surface of the earth.
[0160] In some embodiments, the sphere radius acquisition module 1002 may include: an earth radius acquisition submodule.
[0161] The earth radius acquisition submodule can be used to acquire the earth radius, so as to determine the shortest arc length of the second object from the first object on the earth according to the earth radius, the longitude and latitude coordinates of the first object and the longitude and latitude coordinates of the second object.
[0162] Since the functions of the device 1000 have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0163] The modules and / or submodules and / or units and / or subunits involved in the embodiments described in the present application may be implemented by software or by hardware. The modules and / or submodules and / or units and / or subunits described may also be arranged in a processor. The names of these modules and / or submodules and / or units and / or subunits do not, in certain circumstances, constitute limitations on the modules and / or submodules and / or units and / or subunits themselves.
[0164] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a part of a module or program segment, and a part of the above-mentioned module or program segment contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer program instructions.
[0165] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0166] Fig.11 The structure diagram of the electronic device suitable for implementing the embodiment of the present disclosure is shown. It should be noted that: Fig.11 The electronic device 1100 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0167] like Fig.11 As shown, the electronic device 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage part 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the electronic device 1100 are also stored. The CPU 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0168] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed, so that a computer program read therefrom is installed into the storage section 1108 as needed.
[0169] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains computer computer program instructions for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1109, and / or installed from a removable medium 1111. When the computer program is executed by a central processing unit (CPU) 1101, the above-mentioned functions defined in the system of the present application are executed.
[0170] It should be noted that the computer-readable storage medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program instruction. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The computer program instructions contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0171] As another aspect, the present application also provides a computer-readable storage medium, which may be included in the device described in the above embodiment; or may exist independently and not assembled into the device. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed by a device, the device can realize functions including: obtaining the longitude and latitude coordinates of the first point on the spherical surface and the longitude and latitude coordinates of the second point on the spherical surface; obtaining the spherical radius of the sphere corresponding to the sphere; determining the first shortest arc length of the latitude plane corresponding to the latitude of the first point to the second point on the spherical surface according to the spherical radius, the latitude coordinates of the first point and the latitude coordinates of the second point, wherein the points with the same latitude as the second point are all on the latitude plane corresponding to the latitude of the second point; determining the second shortest arc length of the longitude plane corresponding to the longitude of the second point to the first point on the spherical surface according to the spherical radius, the longitude coordinates of the first point, the longitude coordinates of the second point and the latitude coordinates of the second point, wherein the points with the same longitude as the first point are all on the longitude plane corresponding to the first point; determining the spherical distance from the first point to the second point on the spherical surface according to the first shortest arc length and the second shortest arc length.
[0172] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer program instructions, the computer program instructions being stored in a computer-readable storage medium. The computer program instructions are read from the computer-readable storage medium, and a processor executes the computer program instructions to implement the methods provided in various optional implementations of the above embodiments.
[0173] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of computer program instructions for enabling an electronic device (which can be a server or a terminal device, etc.) to execute the method according to the embodiment of the present disclosure.
[0174] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not applied for by the present disclosure. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0175] It should be understood that the present disclosure is not limited to the detailed structures, drawings or implementations shown herein, but rather the present disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A method for determining spherical distance, characterized in that: include: Obtaining the longitude and latitude coordinates of a first point on a spherical surface and the longitude and latitude coordinates of a second point on the spherical surface; Obtaining the spherical radius of the sphere corresponding to the spherical surface; Determine, on the spherical surface, according to the radius of the sphere, the latitude coordinate of the first point and the latitude coordinate of the second point, a first shortest arc length of a latitude plane corresponding to the latitude of the second point from the first point to the second point, wherein all points having the same latitude as the second point are on the latitude plane corresponding to the latitude of the second point; Determine, on the spherical surface, according to the radius of the sphere, the longitude coordinates of the first point, the longitude coordinates of the second point, and the latitude coordinates of the second point, the second shortest arc length from the second point to the longitude plane corresponding to the longitude of the first point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point; A spherical distance from the first point to the second point is determined on the spherical surface according to the first shortest arc length and the second shortest arc length.
2. The method according to claim 1, characterized in that: Determining, on the spherical surface, according to the spherical radius, the latitude coordinates of the first point and the latitude coordinates of the second point, a first shortest arc length of a latitude plane corresponding to the latitude from the first point to the second point, comprises: Determining an absolute value of a latitude difference between the first point and the second point according to the latitude coordinate of the first point and the latitude coordinate of the second point; Converting the absolute value of the latitude difference into radians to obtain the absolute value of the latitude difference expressed in radians; The shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point is determined on the spherical surface according to the absolute value of the latitude difference represented by the radian and the radius of the sphere.
3. The method according to claim 1, characterized in that: Determining, on the spherical surface, a second shortest arc length of a longitude plane corresponding to the longitude of the first point from the second point according to the spherical radius, the longitude coordinates of the first point, the longitude coordinates of the second point, and the latitude coordinates of the second point, comprises: Determine an absolute value of a longitude difference between the first point and the second point according to the longitude coordinate of the first point and the longitude coordinate of the second point; Convert the absolute value of the longitude difference into radians to obtain the absolute value of the longitude difference expressed in radians; The shortest arc length of the longitude plane corresponding to the longitude from the second point to the first point is determined on the spherical surface according to the absolute value of the longitude difference represented by the radian, the radius of the sphere and the latitude coordinate of the second point.
4. The method according to claim 3, characterized in that: The latitude of the second point is the line-plane angle between the line connecting the second point and the center of the sphere and the equatorial plane of the sphere; wherein, according to the absolute value of the longitude difference represented by the arc, the radius of the sphere and the latitude coordinate of the second point, determining the shortest arc length of the longitude plane corresponding to the longitude of the first point from the second point on the spherical surface comprises: Determine the cosine value corresponding to the line-plane angle; The shortest arc length of the longitude plane corresponding to the longitude from the second point to the first point is determined on the spherical surface according to the radius of the sphere, the cosine value corresponding to the line-plane angle, and the absolute value of the longitude difference represented by the radian.
5. The method according to claim 4, characterized in that: Determining the cosine value corresponding to the line-plane angle includes: Determine the cosine values of the line-surface angles corresponding to points at different latitudes on the spherical surface; Performing linear fitting on cosine values of line-surface angles corresponding to points at different latitudes on the spherical surface to obtain a quadratic polynomial about the line-surface angle; The line-plane angle corresponding to the second point is input into the quadratic polynomial to determine the cosine value of the line-plane angle corresponding to the latitude of the second point.
6. The method according to claim 1, characterized in that: Determining a spherical distance from the first point to the second point on the spherical surface according to the first shortest arc length and the second shortest arc length includes: Determine, between the latitude plane and the longitude plane, an intersection point closest to the second point; Construct a triangle according to the first point, the second point and the intersection point; The shortest arc length of the latitude plane corresponding to the latitude from the first point to the second point is a right-angled side of the triangle; The shortest arc length of the longitude plane corresponding to the longitude from the second point to the first point is another right-angled side of the triangle; The length of the hypotenuse of the triangle is determined according to the arc lengths of the two right-angled sides of the triangle, and the length of the hypotenuse of the triangle is used as the shortest arc length from the first point to the second point.
7. The method according to claim 1, characterized in that: Obtaining the longitude and latitude coordinates of a first point on a spherical surface and the longitude and latitude coordinates of a second point on the spherical surface includes: Obtaining a product delivery distance query request sent by the first object; In response to the commodity delivery distance query request, determining the longitude and latitude coordinates of a second object for delivering the commodity, and using the longitude and latitude coordinates of the second object as the longitude and latitude coordinates of the first point; Determine the longitude and latitude coordinates of the first object, and use the longitude and latitude coordinates of the first object as the longitude and latitude coordinates of the second point; Wherein, the spherical surface is the spherical surface of the earth; Wherein, obtaining the spherical radius of the sphere corresponding to the spherical surface includes: The radius of the earth is obtained, so as to determine the shortest arc length of the distance between the second object and the first object on the earth according to the radius of the earth, the longitude and latitude coordinates of the first object and the longitude and latitude coordinates of the second object.
8. A device for determining spherical distance, characterized in that: include: A latitude and longitude coordinate module, used to obtain the latitude and longitude coordinates of a first point on a spherical surface and the latitude and longitude coordinates of a second point on the spherical surface; A spherical radius acquisition module, used to acquire the spherical radius of the sphere corresponding to the spherical surface; A first arc length acquisition module, configured to determine, on the spherical surface, a first shortest arc length of a latitude plane corresponding to the latitude of the second point from the first point to the second point according to the radius of the sphere, the latitude coordinate of the first point, and the latitude coordinate of the second point, wherein all points having the same latitude as the second point are on the latitude plane corresponding to the latitude of the second point; A second arc length acquisition module, configured to determine, on the spherical surface, a second shortest arc length from the second point to the longitude plane corresponding to the longitude of the first point according to the spherical radius, the longitude coordinate of the first point, the longitude coordinate of the second point, and the latitude coordinate of the second point, wherein all points with the same longitude as the first point are on the longitude plane corresponding to the first point; The shortest arc length determination module is used to determine the spherical distance from the first point to the second point on the spherical surface according to the first shortest arc length and the second shortest arc length.
9. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, the processor being configured to execute the spherical distance determination method according to any one of claims 1 to 7 based on computer program instructions stored in the memory.
10. A computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method for determining spherical distance according to any one of claims 1 to 7.
