The database records the longitude and latitude dimensions (for example, 116.412007, 39.947545) marked by sellers on Baidu ),
The original idea is to take the center of the center point as the center point and cycle the radius. Every time a pixel is added to the radius (tentatively 1 meter), the circle is made again, query the merchants of corresponding points in the database (it is a long cycle)
Similar articles on Baidu have a look
The general idea is to know a central point, a radius, and find the circle containing all the points in the parabolic circle. In this way, we need to know the vertex of the diagonal line of the circle, the problem is that the longitude and latitude are a point, and the radius is a distance.
Finally find the desired article
Http://digdeeply.org/archives/06152067.html
Refer to the original article lz to change to C # class
Code is not too much nonsense:
Degree( x, X = Y = { { x = { { y = EARTH_RADIUS = ; radians( d * Math.PI / degrees( d * ( / radLat1 = radLat2 = a = radLat1 - b = radians(Degree1.Y) - s = * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a / ), ) + Math.Cos(radLat1) * Math.Cos(radLat2) * Math.Pow(Math.Sin(b / ), s = s * s = Math.Round(s * ) / radLat1 = radLng1 = radLat2 = radLng2 = s = Math.Acos(Math.Cos(radLat1) * Math.Cos(radLat2) * Math.Cos(radLng1 - radLng2) + Math.Sin(radLat1) * s = s * s = Math.Round(s * ) / Degree[] GetDegreeCoordinates(Degree Degree1, dlng = * Math.Asin(Math.Sin(distance / ( * EARTH_RADIUS)) / dlng = degrees(dlng); dlat = distance / dlat = degrees(dlat); Degree[] { Degree(Math.Round(Degree1.X + dlat,), Math.Round(Degree1.Y - dlng,)), Degree(Math.Round(Degree1.X - dlat,), Math.Round(Degree1.Y - dlng,)), Degree(Math.Round(Degree1.X + dlat,), Math.Round(Degree1.Y + dlng,)), Degree(Math.Round(Degree1.X - dlat,), Math.Round(Degree1.Y + dlng,)) }
Test method:
Main( a = CoordDispose.GetDistance( Degree(, ), Degree(, )); b = CoordDispose.GetDistanceGoogle( Degree(, ), Degree(, Degree[] dd = CoordDispose.GetDegreeCoordinates( Degree(, ), Console.WriteLine(a+ + Console.WriteLine(dd[].X + + dd[ Console.WriteLine(dd[].X + + dd[ }
Lz tried many times with an error of about 1 meter.
It's easy to get the vertices of the circle.
If the database uses SQL 2008, it can directly index the latitude and longitude fields of the space, which should provide better performance (not tried)
It doesn't matter if the lz company's database is still 2005 old. The key is to split computing by latitude and longitude. This doesn't need to be said. There are many SQL statements on the Internet that were last implemented.
SELECT id,zuobiao FROM dbo.zuobiao WHERE zuobiao<>,)>,)<,)<,)>