C.3. Step 2: Calculate Axis Values for the BusinessEntities TableNow that you have your business listings available in the SQL table, run the following SQL query (either using the SQL Server Enterprise Manager or SQL Query Analyzer) to calculate the values for the columns XAxis, YAxis and ZAxis: UPDATE [BusinessEntity] SET XAxis = (cos(((4*((4*atn(1/5))- (atn(1/239))))/180)*[ BusinessEntity].Latitude)*cos(((4*((4*atn(1/5))- (atn(1/239))))/180)*[ BusinessEntity].Longitude)); UPDATE [BusinessEntity] SET YAxis = (cos(((4*((4*atn(1/5))- (atn(1/239))))/180)*[ BusinessEntity].Latitude)*sin(((4*((4*atn(1/5))- (atn(1/239))))/180)*[ BusinessEntity].Longitude)); UPDATE [BusinessEntity] SET ZAxis = (sin(((4*((4*atn(1/5))- (atn(1/239))))/180)*[ BusinessEntity].Latitude)); This query creates the values for the XAxis, YAxis, and ZAxis columns in the table. Now your data is ready to be searched for spatial proximity queries. |