* snapshot taken from Movable Type Script site
Following is the calculation in OracleDV to compute the distance between two lat longs using Haversine formula:
WHEN Source_Lat=Dest_Lat AND Source_Long=Dest_Long
* COS(RADIANS(Source_Long-Dest_Long)) )
In this formula:
Source_lat refers to Source Latitude
Source_Long refers to Source Longitude
Dest_Lat refers to Destination Latitude
Dest_Long refers to Destination Longitude
Please note that Source and destination are used only for naming convenience, they can actually be used interchangeably. Distance computed using lat long may differ from the actual driving distance between two points depending on various factors such as road connectivity and presence of other geographic bodies. Here is a snapshot of the project on Oracle DV Desktop.
Applications: Ability of OracleDV to handle such distance calculated formulae demonstrates the capability of DV to perform spatial analytic operations which involve calculating the number of stores/customers within a radius of certain driving distance etc. To demonstrate this capability better we have implemented a sample project using this formula to find out what are the establishments within 2 mile radius of WESTERN STATE BANK. Here is a snapshot:
We have attached the .dva project as well. You can download it from here and play with it.