Proposal of the problem: known point P (latitude and longitude), find the nearest point D (point, line, surface), return the name of D and the direction of P, location and distance relationships. The total number of features is greater than 0.5 million
Problem:
I. Is it based on controls? What should I do based on controls and non-based controls?
Ii. What is the coordinate system? (Generally the WGS84 Coordinate System)
3. is the closest vertex D (point, line, and surface) the center or node of the line and surface object? (Only the central point may be discussed here, and the node is slightly complicated)
It may be a very simple question. Unfortunately, I will not ask for advice.
Idea: traverse. So how to optimize it?
I did this with MapX. First, I will briefly introduce my ideas.
The searchwithindistance method of MapX is used, but the following trade-offs are made. A search radius distance and the maximum number of searches are set.
Although it can be done simply, there are many problems. First, is the searchwithindistance method of MapX also a traversal implementation? Second, how can we balance distance and quantity?
In Case 1, I do not need to use the searchwithindistance method to traverse each vertex directly to find the distance. In Case 2, the distance between the nearest one and 1000 are certainly different. How can we set the distance and the number of controls?
There is another question: how to determine the direction.
I wanted to use an arcsin function, but I really couldn't think of it. For the Cartesian coordinate system, the angle can be used to determine the direction. For the spherical body, the Cartesian coordinate system is also used? At least it should be projected. So I want to know the cause of problem 2.
Please complete your questions in this direction. Thank you. For more information, see http://www.pep.com.cn/200503/ca688391.htm.
I personally feel that the searchwithindistance method also uses traversal. Therefore, it is better to directly traverse the searchwithindistance method.
If you have any good ideas, please add them. Thank you.
Forgot to postCode, Add:Http://files.cnblogs.com/Tangf/neardis.rar(Debugging is successful in the VB6 + mapx5.02 Chinese version environment, and calculation is incorrect in the file)
Optimization:
Personal thought 1: Start with raw data and split the data.
Many companies adopt this method, but I don't know how to operate it. I can only talk about my ideas.
If a known point is in Image A, the vertex from image a to image I is first traversed. If yes, the closest vertex is computed. If not, the vertex is expanded to a large circle to calculate the vertex.
Of course, the raw data may need to be processed here, not entirely based on topological relationship computing. If the vertex P is known, the image number of the vertex P is calculated first. If the result is a, all the frames around a and a are traversed. If the nearest vertex does not exist, traverse the peripheral images from B to I.
We recommend that you use a square image. Otherwise, an error may occur when the range is too large.