Calculate distance between Latitude and Longitude

Hi All,
I have one Latitude and Longitude points. I need to calculate distance between them.
Right now we are using HAVERSINE formula but the query takes longer time to complete.
Reference: http://www.movable-type.co.uk/scripts/latlong.html
Please assist on this.
Thanks in advance.

Check this link...
http://www.mrexcel.com/forum/excel-questions/202255-calculating-distance-between-two-latitude-longitude-points.html
I never did this before, but gave it a try using the formula mentioned in that link..
Data:
                   Lat                      Long                               R =  6,371 (Radius of earth (approximated)) 
Origin:        44.844263(B2)      -92.914803(C2) 
Destination: 44.822075(B3)     -92.912498(C3)
Formula used:
A: =SIN(ABS(B3-B2)*PI()/180/2)^2+COS(B2*PI()/180)*COS(B3*PI()/180)*SIN(ABS(C3-C2)*PI()/180/2)^2
B: =2*ATAN2(SQRT(1-A),SQRT(A))
C: =R*B                  --->  DISTANCE!!!!
WITH t AS
        (SELECT POWER (
                   SIN (ABS (44.822075 - 44.844263) * ( (22 / 7) / 180 / 2)),
                   2)
                + COS (44.844263 * ( (22 / 7) / 180))
                  * COS (44.822075 * ( (22 / 7) / 180))
                  * POWER (
                       SIN (
                          ABS (-92.912498 - (-92.914803))
                          * ( (22 / 7) / 180 / 2)),
                       2)
                   E2
           FROM DUAL)
SELECT (2 * ATAN2 (SQRT ( (1 - E2)), SQRT (E2))) * 6371
  FROM t;
Check if this gives correct values... (I did not verify this properly.. ) And this is faster in my opinion..
Please post your code for better suggestions from volunteers...
Cheers,
Manik.

Similar Messages

  • How to find the latitude and longitude based on the Customer's address

    Hi All,
    I have a requirement where in I need to maintain the latitude and longitude for a Customer in the database table. I need these details for calculating the distance between the Customer and the nearest plant for the organisation to deliver from the nearest plant.
    Can someone help  me as to how to go about this.
    Thanks and Regards,
    Deepika

    Hi Zhenglin,
    You meen to say we have to create two custom fields, one each for the latitude and longituude. Once created, how do we upload the latitude and longitude based on address could you please expalin by giving some sample code.
    Thanks in advance.
    Thanks and regards,
    Deepika C

  • Latitude and longitude co-ordinates not appearing correctly

    I am trying to allocate a 'place' to a photograph by inputting the latitude and longitude. The place is 'The Needles" at the extreme western point of the Isle of Wight, the co-ordinates being 50.3973N and 01.3552W. However, when I enter these co-ordinates in the format as indicated in the 'help' section of iphoto (i.e. 50.3973, 01.3552), the place comes up somewhere off the coast of France in the English Channel! Can anyone please advise me if I am not entering the numbers correctly or is there a problem with iphoto?

    When I show extended photo info on a photo that is correctly positioned it displays as
    GPS Latitude l.llllll˚ N
    GPS longitude n.nnnnn˚ W
    Have you tried with a space between the digits and the N or W?
    Also you might try experimenting with adding a minus sign to one or the other of the fields although that does not sound correct off the top of my head
    If you have a photo that is correctly located there you can use HoudahGeo - http://www.houdah.com/houdahGeo/ - to locate the rest of the photos from the correct photo's location - this is a very useful function to take lots of photos with a non GPS camera and take one with your iPhone and use its location for the others
    LN

  • Plotting Latitude and  Longitude  in Screen

    Hi ,
    Iam trying to implement applet application reads Latitude and Longitude from database and plots in the screen.
    For this i converted Latitude and Longitude To Screen X and Y.
    Some how when draw its always out of window.
    Is there a way by which we can do it only using java.
    Please guide
    Thanks,
    arvin

    aravind123 wrote:
    Thanks for the suggestion,
    The objective is i want to plot a route (set of lat lon ) using applet.
    Below is the code used for that,
    double newLon= (180 + Lon );
    double screenX = newLon* (screenHeight / 360);
    double newLat= (90 + Lat );
    double screenY = newLat* (screenWidth / 180);Lat and Lon in degrees.
    Iam i doing correctly?
    Please help,It's going to be upside down for a start, since Y position is measured downward from the top of the screen.
    It can be complex issue, though, plotting coordinates which refer to positions on a round planet on a flat screen. The transformations are called geographical projections and there about a half dozen kinds in common usage with names like "Transverse Mercator" and "Albers Equal Area". Different projections suit different maps. For example maps of North America typically use Albers Equal Area (because it works best with areas with more East to West than North to South, but maps of Britain, a North to South country, almost always use Transverse Mercator.
    However maps of the whole world typically use on of the the Mercator projection, which is essentially plotting latitude and longitude directly (or you can use the sin of the latitude, which gives a slightly more realistic impression of areas). However you would still need to think about the relationship between horizontal and vertical scale, if makes quite a difference to the appearance of the map. The Mercator is mathematically simple, but often very misleading.

  • Custom Map using latitude and longitude data points

    Hi,
    I am new to Apex and I want to lost custom data points using latitude and longitude data points. I
    have seen posts referring to the chart example (http://apex.oracle.com/pls/apex/f?p=36648:65:2214483882702::NO:::) ; could someone help me with the following:
    1) How to add On Demand Application Process to a map page (step 4 in the demo)
    2) What is a hidden item and how to add it to a page (step 6)
    Any help would be greatly appreciated.
    Kind regards,
    Lisa

    I am trying to do the same thing. I have got the get_data function working to create the desired output. However when I replace the xml <data> block with &P65_DATA, it does not work. If I display P65_DATA on the page, it has correct output. If I cut and paste the output into custom XML, it works fine. Anyone have come across this issue..any ideas how to fix it?

  • Getting Power View on Sharepoint to interpret latitude and longitude correctly

    After pulling my hair for a few dozen hours I come here with a simple question.
    I have a SQL Server 2012 View - joining 3 different tables, one of which contains latitude and longitude in Decimal(9,6) format.
    I have a Tabular model using this view which I push to Analysis services and further on to Sharepoint 2013.
    However, when I pull the longitude and latitude columns to the corresponding fields in Power View, the data is just placed standardly in the Artic Sea. Now I have tried changing to and from commas and periods as decimal separator but nothing seems to work. 
    I can get it to work using Power Map and Power View for Excel 2013 but not on Sharepoint.
    I have spent a great deal of time on Google searching for answers but nothing seems to adress this issue, despite it being asked before 

    I too have been frustrated by this behavior. I also have issues with locations in Puerto Rico showing up in Europe using the zip code and/or state. I've found when I use lat/long things look correct which makes resolving this
    issue even more pressing for me.
    Unfortunately in the SharePoint construct you cannot control how the api interrupts the address like you can in Excel. I think that is why models in excel recognize latitude and longitude without issue but in SharePoint it's a no go. I have
    not tried to see if the tabular construct recognizes lat/long.

  • XMP metadata: latitude and longitude

    I have tried to pull in latitude/longitude data on a photo. Most of the XMP fields are not populated. I am wondering if the XML is correct within FCS... It could be my issue though. I used my iPhone to test. iPhoto is able to read the coordinates as well as photoshop. Why can't FCS pull this information in?
    This is going to be a very important function for us in the very near future. Any help would be greatly appreciated. Thanks!

    So if I'm right, the Latitude and Longitude from the photo you posted maps to location in South Florida.
    The XMP EXIF GPS Dynamic metadata values are completely wrong in FCSvr. The timestamp is set to 12/31/69 for some reason, but inspecting the file via the mdls command in the terminal
    i.e.
    mdls iphonephotogps.jpg
    Reveals the following Latitude and Longitude values.
    kMDItemLatitude = 28.59650039672852
    kMDItemLongitude = -81.36000061035156
    If this is correct, then you could write a script that could slurp the Spotlight Metadata from the file and inject it into FCSvr.
    I have a script that does something very similar for extracting audio files. I wrote this for a client, so I can't open source it, but if you contact me offline, I may be able to customize it for your needs and point you in the correct direction development wise.
    Nicholas Stokes
    XPlatform Consulting
    email: [email protected]

  • IPhoto 9.5 using latitude and longitude

    I am extremely frustrated with iPhoto's location function. I'm trying to geotag photos using latitude and longitude. iPhoto insists on trying to convert lat/long to an address that is inaccurate. When I try to reposition the pin point in the map it flies all over the place faster than I can control. When I try to delete the location that iPhoto has added, it refuses. When I turned off Automatic place lookup, the program won't allow me to enter address information at all.
    (After trying to use iPhoto's location function, I can't help but wonder if anyone at Apple has actually tried using it.)
    Is there a secret to getting iPhoto to accept lat/long inputs unaltered? Or should I just use Graphic Converter to geotag photos (which has a beautiful function - center Google Earth on the precise location and Graphic Convert imports the exact lat/long)?

    using Lat/long is easy as described in this article - http://support.apple.com/kb/PH2381
    You also can use the paste location command if you have another photo in the place you want - copy that photo, select the remaining photos at tha location and paste location
    Graphic converter is an option
    HouDahGeo is another option that can safely deal directly with the iPhtoo library - http://houdah.com/houdahGeo/
    LN

  • IPhoto '09 - Adding your own latitude and longitude

    It appears that iPhoto 09 does not allow you to add your own Geo location (e.g.: latitude and longitude data). Is this correct?
    Are we limited to the list Apple provides?

    I downloaded a Exif viewer app to double check to, and it was there the 2nd time I exported and ticked locations, and text and keywords.
    I also just downloaded Picasa for MAC, and it doesnt support direct looking at Google Earth on the Mac yet, but the L/L is there in the pic data, but the keywords are not shown, in picasa
    So is this the only way to get it out then?
    can you make a new album with all your pics in, and then export all at once?
    Or can I take it that if I pick the picture direct from the iPhoto library in Finder and copy it , it will have the L/L and keyword data in?
    cheers

  • Predict Trip time duration from Pick up and Drop off Latitude and Longitude using Azure ML Studio

    I'm using Microsoft
    Azure Machine Learning Studio to create an experiment for predicting
    time duration of a trip by using
    a data set containing previous records of the trip time along with latitude and longitude of the pick up and drop off location.
    Can anyone help me out with whatregression model (or
    R-Script optional) should I use to train my model?

    Hi,
    Are you training with raw latitude/longitude? If so, you should try clustering the start/end points into groups. An easy way to do this is to take a decimal or two off the values. Otherwise, the algorithm is seeing
    many, many, unique pairs which may degrade the model performance.
    You will probably also want to use the
    Learning with Counts modules to summarize that lat/lon data because even with clustering, the features will still have high dimensionality. Here's some info on learning with counts:
    http://blogs.technet.com/b/machinelearning/archive/2015/02/17/big-learning-made-easy-with-counts.aspx
    Also, we did some experiments on similar data so if you want to read more about that see:
    http://blogs.technet.com/b/machinelearning/archive/2015/04/02/building-azure-ml-models-on-the-nyc-taxi-dataset.aspx
    Hope this helps!
    Margaret

  • I am trying to convert latitude and longitude into UTM coordinates.

    I am trying to convert latitude and longitude into UTM coordinates. can sombody please help

    Hi....I am 'anu' from india.
    I want to draw 3D plot of aircraft trajetory by using the latitude,longittude and altitude of aircraft is it possible with labview8.5. If you have any similar VI pls share. And is it possible to define a 3D object like aircraft, 2 axis moving objects?
    Thanks in Advance

  • Convert pixel point to Latitude and Longitude

    I am trying to create a custom map for iOS. For the time being I am using Openstreetmap images for the custom map app.
    Now what I want is to convert the pixel point to Latitude and Longitude value at a particular zoom level. I am finding out the tile(pixel point) in which I clicked. I need to find out the Lat and Long of that particular point. How this can be calculated? Is there any general formula to find the Lat & Long from pixel point.
    Thanks in advance

    Ask in the developer's forums.

  • Reading latitude and longitude from EXIF header

    I would like to know if it is possible to retrieve the latitude and longitude of an image from it's EXIF header using Java ME code. Nokia Location Tagger provides the capability to record this information, but I'm not sure how to get this information out. I've found libraries for doing this in Java SE (which depend on many standard edition specific classes), but nothing for Java ME.
    Edited by: Uberkiff on Mar 19, 2008 3:54 AM

    Yeah I downloaded the spec, all 154 pages worth. It's a rather daunting task, but one I'll probably have to do. I'll try and convert one of the existing standard edition ones to Java ME, but I'm not convinced it can be done, because most of the SE implementations, which are ridiculously long already, seem to use a lot of standard edition classes. Was just hoping somebody who knew more about jpg encoding, exif headers and such things could offer an opinion as to whether it can (reasonably) easily be done before I attempt it.

  • Converting latitude and longitude into UTM coordinates

    hi
    can anybody help me to convert latitude and longitude into UTM coordinates
    maybe someone have a program
    thanks

    do you searched the internet for that?
    My quick search return this link:
    http://www.uwgb.edu/dutchs/usefuldata/utmformulas.htm
    In this, you can find also a spreadsheet that may help more.
    See if it's good for you
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL

  • IPhoto latitude and longitude

    Has anyone had problems when entering latitude and longitude manually in iPhoto? I just put in the location of some pictures taken in the Alps and the little map in the bottom right corner put my lat/long somewhere over in the Loire valley, half the width of France away. On Google Maps in Safari my Lat/long identifies the correct location.
    As the iPhoto help pages say, you can drag the pointer to the correct location, but only in the tiny box, it does not work if you go to full screen. What a pain that was!

    using Lat/long is easy as described in this article - http://support.apple.com/kb/PH2381
    You also can use the paste location command if you have another photo in the place you want - copy that photo, select the remaining photos at tha location and paste location
    Graphic converter is an option
    HouDahGeo is another option that can safely deal directly with the iPhtoo library - http://houdah.com/houdahGeo/
    LN

Maybe you are looking for

  • Graphic card losing drivers?

    I finally got me a PCI-E card for my K8N-Neo3. I found a Gainward 6600 GT Golden sample at a reasonable price. I installed it and has run it for a week or so. Done some 3dmarks with good results and a big smile on my face.  Though lately I have run i

  • Error-No more storage space available for extending an internal table.

    Hi Experts,                 i am facing problem in a program . its showing runtime error. Short text     No more storage space available for extending an internal table. its showing error at    IF sy-subrc NE 0.         REFRESH p_wip_tab.       ELSE.

  • Windows 64-Bit Oracle DBCA creating new Instance ORA-27102: out of memory

    Wondering has anyone encountered this? We are running Oracle 10 R2 running on Windows Server 2003 ( This database is on a 64-bit Platform) Memory capacity is 16 GB on the server. We are using DBCA to streamline db creation of the new “EDR” DB instanc

  • Automatic Billing Doc

    Hi All , We have a business scenario where we have to trigger a billing doc when the sales order is created . We have thought of 2 ways .First is to create a Special function output type for a sales order which will in turn create a billing doc using

  • Setting Up Remote FTP Connection.

    Hi Everyone,  I've bee creating web pages for years and most of that time with the same hosting company.  Out of the blue I have lost the FTP setup info.  Any help greatly appreciated.  Thanks, Morgan