Incorrect output by SDO_GEOM.SDO_DISTANCE

I am trying to calculate the difference of two points on earth, but is not giving me correct result
SELECT SDO_GEOM.SDO_DISTANCE(
SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(28.66667,77.43333,NULL),NULL,NULL),
SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(30.45,77.61667,NULL),NULL,NULL),
0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS
FROM DUALI tested it against http://www.movable-type.co.uk/scripts/latlong.html
Query is returning me 47.6389006
but the actual distance is: 199.1
Please help me out.

I also tested it by
sqrt(x * x + y * y) * 1.609344 // for KM
where x = 69.1 * (lat2 - lat1) and y = 53.0 * (lon2 - lon1)
There is still a lot of difference.
SQL> SQL> SQL> SELECT SDO_GEOM.SDO_DISTANCE(
SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(28.66667,77.43333,NULL),NULL,NULL),
SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(30.45,77.61667,NULL),NULL,NULL),
0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS
FROM DUAL  2    3    4    5  ;
DISTANCE_BETWEEN_POINTS
             47.6389006
SQL> SELECT
sqrt(69.1 * (30.45 - 28.66667) * 69.1 * (30.45 - 28.66667) + 53.0 * (77.61667 - 77.43333) * 53.0 * (77.61667 - 77.43333))  * 1.609344
FROM DUAL  2    3  ;
SQRT(69.1*(30.45-28.66667)*69.1*(30.45-28.66667)+53.0*(77.61667-77.43333)*53.0*(
                                                                      198.932013Please help....

Similar Messages

  • Error "Terminal type 202: Incorrect output destination/message type TERM"

    Hi:
        We actually are using SRM v. 5, and we detected an intermiteng error in SM21, it says
       <b>Terminal type 202: Incorrect output destination/message type TERM</b>
       It is generated at Client 000 and relates to program BBP_BGRD_APPROVAL. The actual output of the log is described:
                   <b>Terminal type 202: Incorrect output destination/message type TERM
                   No Active Link Found in the Link Table                           
                   > Conversation ID: 39968053                                      
                   > CPI-C function: ?                                              
                   No Active Link Found in the Link Table                           
                   > Conversation ID: 39968053                                      
                   > CPI-C function: CMRCV                                          
                   Delete session 001 after error 004            </b>
           What we are worried about, is that the final error, relates to a user session end =(.
           We were looking for some information on SAP Notes and forums, but we didn't find any useful info.
           Does any one know what is this error about? We will appreciate any comments.
                        Thanks in advance, Abrahamdelgdaov

    Hi,
    This kind of error message usually arises if a program wants to send
    data to the partner program which will be identified via the
    conversation ID, but this conversation ID is not in the list of
    active RFC links.
    This always happens when one of the two partner programs finishes the
    conversation and informs the remaining partner program.
    Also included in this information is that the gateway already deletes
    the communication entry in the communcication table and conveys the
    message to the partner program.
    This partner program in turn accepts the message but still wants to
    send a receipt or something else to the program that is already finished
    Another send after you've received the close of the connection is not
    allowed.
    Therefore the messages you are seeing in the syslog are definitely ha
    rmless because even if the send would go through, the receiver is not
    able to receive the message.
    Check if there are any other network related errors in the system.
    Regards,
    Marcelo

  • ISSUS IN MDSYS.SDO_GEOM.SDO_DISTANCE()

    Hi experts,
    SQL> SELECT * FROM LOC_ZIP;
    COMP ZIPCD
    LOC(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    c1 z1
    SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(100, 1, NULL), NULL, NULL)
    c1 z2
    SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(200, 2, NULL), NULL, NULL)
    SQL> SELECT * FROM SUPP_ZIP;
    COMP SUPPI
    LOC(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    c1 s1
    SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(5, 1, NULL), NULL, NULL)
    c1 s2
    SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(77, 7, NULL), NULL, NULL)
    SQL> SELECT MDSYS.SDO_GEOM.SDO_DISTANCE(L.LOC,S.LOC,NULL)
    FROM Loc_zip L,Supp_zip S
    WHERE L.compcd = S.compcd;
    SELECT MDSYS.SDO_GEOM.SDO_DISTANCE(L.LOC,S.LOC,NULL)
    ERROR at line 1:
    ORA-22060: argument [2] is an invalid or uninitialized number
    ORA-06512: at "MDSYS.SDO_3GL", line 817
    ORA-06512: at "MDSYS.SDO_GEOM", line 3224
    ORA-06512: at "MDSYS.SDO_GEOM", line 3238
    Many Thanks,
    Kalinga

    You might try specifying a positive tolerance value (as the third argument to SDO_GEOM.SDO_DISTANCE), as in something like:
    SELECT
        MDSYS.SDO_GEOM.SDO_DISTANCE(L.LOC, S.LOC, 0.5)
    FROM
        Loc_zip L,
        Supp_zip S
    WHERE
        L.compcd = S.compcd;Hope this helps.

  • SDO_GEOM.SDO_DISTANCE()

    my sdo_version is showing me the latest one
    hi guys is there anyissue for this sdo.geom package?? i need to use SDO_GEOM.SDO_DISTANCE() function alone..
    many thanks
    Kalinga

    my sdo_version is showing me the latest oneIs it easier say this than telling us the version?
    hi guys is there any issue for this sdo.geom package??No issue.
    i need to use SDO_GEOM.SDO_DISTANCE() function
    Not a problem here.

  • Haversine formula vs. MDSYS.SDO_GEOM.SDO_DISTANCE

    We need to calculate the distance between 2 lat/longs (from GPS unit).
    What is more accurate, the use of MDSYS.SDO_GEOM.SDO_DISTANCE or a hand coded Haversine Formula?
    Thanks,
    JB

    Well, easiest thing to do is to conduct a test.
    I looked at this website: http://www.movable-type.co.uk/scripts/latlong-vincenty.html
    The answer to the default functional demo is 969954.114 meters.
    Testing with SDO_DISTANCE we get (I converted the DMS values to DD):
    select sdo_geom.sdo_distance(
              sdo_geometry(2001,8307,sdo_point_type(-5.71475,      50.0663222222,null),null,null),
              sdo_geometry(2001,8307,sdo_point_type(-3.07009444444,58.6440222222,null),null,null),
              0.05) as dist
      from dual;
    -- Result
    969954.113110585Which is pretty similar!!
    So, don't bother coding your own Haversine (you would have to add extra parameters to pass in the ellisodal params for non-WGS84 SRIDs...), use what comes out of the box.
    Does that answer you question? If so, please award points.
    regards
    Simon

  • Smu 236 incorrect output

    Hi 
    I am using a Kiethly 236 SMU to measure IVs this normally works fine, but appears to have an intermittent fault.
    Sometimes when performing a series of measurements the first outputted current file is correct, however all subsequent files give the same dataset with a random offset. Restarting the pc seems to resolve the issue.
    I have recently discovered that a colleague has been altering the pc date and time settings, could this somehow account for the incorrect data?
    Any help or ideas would be gratefully received.
    Thanks

    What programming environment are you using?
    I don't beleive the time and date have soemthing to do with this but you mention a current file. Is that file still correct or is there no change when a new file should be selected.
    If you are programming in LabVIEW add the program so we can see what is going on.
    greetings from the Netherlands

  • Incorrect output scaling on Officejet 7612

    I bought this printer last weekend and it has installed fine.  I have updated the drivers and it will both print and scan.  But I have found that the print output is incorrectly scaled.  I have a PDF document that contains a 12" line that is printed only 11.6" long.  The problem is the same both horizontally and vertically.  I can fix the problem by setting the print scaling in the Adobe Reader to 103.9%.I had planned to use this printer for my landscape designs but without an accurate output, the printer won't be acceptable and will need to be returned.My plans are generated using Vectorworks and the same problem occurs there so I know this is not an Adobe problem.

    The paper type does not matter. The size of the paper does not matter. Choosing borderless or not does not matter. Ditto for margins. I tried it any number of ways and the scaling still came out wrong.
    I set up a layout with the certificate at a specific size and to print on letter sized paper. I saved the document as a PDF and printed out a sample of it where I work, in this case, on a Ricoh laser printer. It came off that printer scaled to the proper size with nothing cut off. Is there an understandable reason that it would not print out at that same correct size, on an 8.5 X 11 sheet at home on this color inkjet? I used both Acrobat Reader and Acrobat Pro, and it still was not correct. I actually had to "fudge" the percentage at the Acrobat Pro stage to even get a print I could use! Even it wasn't an accurate size.
    If there is a solution, I want to know. If this is an issue that hasn't been resolved, it urgently needs to be, for the sake if anyone who spends money on HP printers in the future, and expects to complete a project with accurate results, without hacking.  Hacking is not a solution, it is a disappointing workaround.
    If it's a driver issue, it should be fixed. If a bug that was not fixed, has it been fixed since? Do HP's new printers all do the same thing or are some printing properly to scale and others not ? Please inform me what HP's expectation is for this particular model. Finding that this machine cannot print properly is not acceptable and the product should either be fixed or discontinued.

  • MOD() function - incorrect output

    The following bit of SQL uses the mod() function to determine modulus 2 of two large numbers
    13:37:20 SQL>set echo on
    13:37:24 SQL>@mod_test
    13:37:25 SQL>
    13:37:25 SQL>
    13:37:25 SQL>
    13:37:25 SQL>select mod(power(2,127)-1,2) from dual
    13:37:25 2 /
    MOD(POWER(2,127)-1,2)
    1
    1 row selected.
    13:37:25 SQL>
    13:37:25 SQL>select mod(power(2,128)-1,2) from dual
    13:37:25 2 /
    MOD(POWER(2,128)-1,2)
    -1
    1 row selected.
    13:37:25 SQL>
    Notice that mod(power(2,128)-1,2) returns an incorrect answer, while the
    answer for mod(power(2,127)-1,2) is correct.
    Does someone here know why?
    Is it a limit?
    Or is it a bug?
    Please supply an explanation and/or URL for your answer. :)

    Must be due to the fact the scale for a NUMBER can range from -84 to 127, and Floating Point Number Limits are:
    Value                         Binary-Float          Binary-Double
    Maximum positive finite value 3.40282E+38F  1.79769313486231E+308
    Minimum positive finite value 1.17549E-38F  2.22507485850720E-308

  • How Is sdo_geom.sdo_distance calculated in geodetic space?

    Hi,
    I'm new to oracle spatial -- but very familiar spatial SQL in Manifold GIS. In that package, there are two distance functions, a "distance", which returns the distance in native coordinates, and a "distanceEarth", which is used to return true distance (in meters) rather than degrees when working in lat/lon. When I author a basic distance query in oracle which finds the distances between all the geometries in one table and all the geometries in another table, the sgo_geom.sdo_distance will return the result in meters even when I am working in lat/lon. So when does the oracle distance function convert between degrees and meters? Is it really returning the true distance? In this clear?
    thanks!

    In Oracle Spatial, we always return the true distance based on the coordinate system
    of the geometry.
    If the geometry has lat/long values for coordinates, and appropriate SRID is set,
    we compute the true earth distance.
    If there is no SRID set for the geometry, the distance returned will be computed
    as if the long/lat values are x,y values.
    siva

  • Incorrect output formatting when report send directly to printer

    Hi All,
    We have developed a report in report 6 and initially configured to send output to file and then open in notepad and then send this output to dot matrix printer. In this case the output prints correctly. Now we want to send this putput directly to laser printer but when we send this output to laser printer extara baln line are printing and due to this output is printing on two pages which we previously prinig on one page which is the requiremnt. Can anyone help me to identify what wrong is going?
    regards,
    Muhammad Asif

    Hi,
    there is a reports forum where this question is handled best. Though Forms is the initiator of Reports, it has nothing to do with the formatting.
    Frank

  • Incorrect output

    public class AraiseB {
         public static void main (String args[])
              int a = 3;
              int b = 2;
              int z;
                                               z = raise(a,b);
              System.out.println(a +" to the power of " + b + " is " + z);
         public static int raise(int a, int b)
              z = a ^ b;
              return z;
    }The correct output is 9, but when I run it, I get 1. Anyone know why?
    Thanks

    OOps, thanks.
    but where do i find documentation for the math library.
    I tried z=Math.pow(a,b);
    return z;
    and gave me an error.
    ^ is the 'exclusive or' operator.
    http://java.sun.com/docs/books/tutorial/java/nutsandbol
    s/bitwise.html
    Use Math.pow()

  • Incorrect output with SPELL_AMOUNT

    hi friends, i am using SPELL_AMOUNT in a smartform. but the output is not correct. if the value is like :
    1,4310,551.80
    in words : US dollar four milion three hundered ten thousand five hundered fifty one and eighty thousand cents only.

    part of my code is :
    clear : W_T685T.
    *data :l_effective like komv-kwert.
    clear : l_effective.
    loop at IT_T685T into W_T685T.
    l_effective = l_effective + W_T685T-kwert.
    endloop.
    data : amount type P DECIMALS 4.
    data  :var type P DECIMALS 2.
    amount = l_effective.
    if ZXEKKO-waers = 'INR'.
        CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
          EXPORTING
            AMT_IN_NUM         = amount
          IMPORTING
            AMT_IN_WORDS       = in_words-word
          EXCEPTIONS
            DATA_TYPE_MISMATCH = 1
            OTHERS             = 2.
    CALL FUNCTION 'ZMMF_HR_IN_CHG_INR_WRDS'
    EXPORTING
    AMT_IN_NUM         = amount
    IMPORTING
    AMT_IN_WORDS       = in_words-word
    EXCEPTIONS
    DATA_TYPE_MISMATCH = 1
    OTHERS             = 2.
    *end
    else.
    CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
    AMOUNT    = amount          "changed amount to var
    CURRENCY  = ZXEKKO-waers
    LANGUAGE  = SY-LANGU
    IMPORTING
    IN_WORDS  = in_words
    EXCEPTIONS
    NOT_FOUND = 1
    TOO_LARGE = 2
    OTHERS    = 3.
    endif.
    select single * from TCURT into wa_tcurt where spras = sy-langu and WAERS =
    ZXEKKO-waers.
    condense in_words-word.
    condense in_words-decword.
    if ZXEKKO-waers <> 'INR'.
    translate in_words-word to lower case.
    translate in_words-decword to lower case.
    translate in_words-word(1) to upper case.
    concatenate wa_tcurt-ktext in_words-word 'and' in_words-decword 'only'
    into in_words-word
    separated by space.
    find substring 'cents' in in_words-word.
    if sy-subrc = 0.
    replace substring 'cents' in in_words-word with space.
    endif.
    find substring 'only' in in_words-word.
    if sy-subrc = 0.
    replace substring 'only' in in_words-word with space.
    endif.
    concatenate in_words-word 'cents' 'only'
    into in_words-word
    separated by space.
    else.
    find substring 'Paise' in in_words-word.
    if sy-subrc = 0.
    replace substring 'Rupees' in in_words-word with 'and'.
    else.
    replace substring 'Rupees' in in_words-word with space.
    endif.
    translate in_words-word to lower case.
    translate in_words-word+0(1) to upper case.
    concatenate 'Rupees' in_words-word 'only' into in_words-word separated
    by space.
    *    translate in_words-word to lower case.
    *    translate in_words-word(1) to upper case.
    endif.

  • Incorrect outputs for grade program

    This is a secondary problem I am having to the first question I posted. The program runs but when I type in a letter grade this is my output regardless of the letter grade I put in:
    The score for the grade 'A' is 4.0
    Here is my code:
    #define_CRT_SECURE_NO_WARNINGS
    #include<stdio.h>
    #include<stdlib.h>
    voidmain()
    charGrade;
    printf("Enter a grade [A,B,C,D,F]");
    scanf("%c", &Grade);
    if(Grade ='A'||
    'a')
    printf(("The score for the grade 'A' is 4.0\n"));
    else
    if(Grade ='B'||
    'b')
    printf(("The score for the grade 'B' is 3.0\n"));
    else
    if(Grade ='C'||
    'c')
    printf(("The score for the grade 'C' is 2.0\n"));
    else
    if(Grade ='D'||
    'd')
    printf("The score for the grade 'D' is 1.0\n");
    else
    if(Grade ='F'||
    'f')
    printf(("The score for the grade 'F' is 0.0\n"));
    system("pause");

    On 3/20/2015 3:48 PM, leosucksatc wrote:
    if(Grade ='A'||'a')
    = is assignment. == is equality comparison. You had that right in your previous post.
    Also, the || operator doesn't work the way you think it does. Make it
    if (Grade == 'A' || Grade == 'a')
    Igor Tandetnik

  • Persistence - incorrect output.

    Hello
    I have three entity classes: Foo, Bar and Cow. The relations are:
    Foo---Bar---Cow
       1 1   1 1In the following code, I persist a Foo with a Bar with a Cow. Second, I remove the foo, so only Bar and Cow remain.
    import javax.persistence.EntityManager;
    import javax.persistence.Persistence;
    public class Main {
        private static EntityManager em;
        private static Foo foo;
        public static void main(String[] args) {
           em = Persistence.createEntityManagerFactory("TestPU").createEntityManager();
           createFoo();
           em.refresh(foo);
           Cow cow = foo.getBar().getCow();
           removeFoo();
           em.refresh(cow);
           System.out.println(cow.getBar().getFoo());
        private static void createFoo() {
           foo = new Foo();
           Bar bar = new Bar();
           Cow cow = new Cow();
           bar.setCow(cow);
           foo.setBar(bar);
           em.getTransaction().begin();
           em.persist(foo);
           em.getTransaction().commit();
        private static void removeFoo() {
           em.getTransaction().begin();
           em.remove(em.merge(foo));
           em.getTransaction().commit(); 
    }The output of this code is: +Foo[id=852]+ But Foo was already removed. Why is this? Looking in the database, I see that foo indeed is removed. But the cow object says otherwise.
    I use Toplink and MySQL. Additional code:
    //Imports
    @Entity
    public class Foo implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        @OneToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
        private Bar bar;
        //Getters, setters and toString
    //Imports
    @Entity
    public class Bar implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        @OneToOne(mappedBy="bar")
        private Foo foo;
        @OneToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
        private Cow cow;
       //Getters, setters and toString
    //Imports
    @Entity
    public class Cow implements Serializable {
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        @OneToOne(mappedBy="cow")
        private Bar bar;
        //Getters, setters and toString.
    }Thanks for the feedback.
    Vincent

    You may need to check the Job Services logs which will be named as "server_messages_JobService.log"
    Also you could check if it runs fine as a BQY in web client or HTML mode. If there are any error in connection or in the parameters then the Job can fail.
    The email cycle failure can also be a cause.

  • Linux net command showing incorrect output if executing from java.

    I am trying to execute a net rpc registry on red hat linux box from java using Runtime. I have stored the command in a String variable. When the execute the command from java it throws an error saying that "Invalid registry path" however the same command works fine when executed from linux command terminal.
    CODE
    import java.io.*;
    public class ChkBpower {
         public static void main(String[] args) {
         checkBpower(128);
         public static void checkBpower (int TTL){
              int ttl = TTL;
              System.out.println("Hello3");
              String ip = "20.198.36.28";
              String[] reg={"\\","HKLM","\\","SOFTWARE","\\","Marimba"};
              System.out.println(reg);
              String credentials ="bpwrlab/Administrator%Confmgmt1";//"asiapac/gjagdeosingh%M@nu2281";
              String chkBcmd = "net rpc registry enumerate '\\HKLM\\SOFTWARE\\Marimba' -I " + ip + " -U " + credentials ;
              String chkBstatus = "net rpc service status cscmarimba -I " + ip + " -U " + credentials + "| grep -b 'service' | awk '{print $4}'";
              String startBpower = "net rpc service start cscmarimba -I " + ip + " -U " + credentials;
              if (ttl>=100 && ttl<=128){
              System.out.println(ttl);     
              System.out.println(chkBcmd);
              try {
                   Runtime r = Runtime.getRuntime();
                   Process p = r.exec(chkBcmd);
                   InputStream stderr = p.getErrorStream();
         InputStreamReader isr = new InputStreamReader(stderr);
         BufferedReader br = new BufferedReader(isr);
         String line = null;
         System.out.println("<ERROR>");
         System.out.println(br.readLine());
         while ( (line = br.readLine()) != null)
         System.out.println(line);
              System.out.println("</ERROR>");
              int exitVal = p.waitFor();
              System.out.println("Process exitValue: " + exitVal);
              catch (Throwable t)
         t.printStackTrace();
    }

    Use exec(String[]), not exec(String), whenever you have argue,nets. Saves all that mucking around and second-guessing and escaping ...

Maybe you are looking for

  • HP DESKJET 3050A ALL-IN-ONE J611 series

    My friends. My problem is very simple. I have a printer "HP DESKJET 3050A ALL-IN-ONE J611 series" and she can not work properly on my laptop. I have windowns 8.1 as soy experienced all your drivers and the printer can not work well. Sometimes I can i

  • List of irrecoverable client errors

    Hey all, I'm looking for a list of errors that, when they occur, the client should disconnect and attempt to reconnect to the database. Or, errors that mean the client is disconnected. So far I have the following: ORA-00028: session killed ORA-00041:

  • My Photoshop Elements 7.0 Editor module

    Photoshop Elements Editor stopped working and reports a problem area as fiel Mscrv80.dll. Is my problem with Elements or with Windows Vista and what do I do?

  • Inner join 6 tables

    Hello All,              I have query optimization required to optimize query.The query consists of 6 tables inner join.Can anybody tell me which is best to optimize this query.

  • Loading Images from external website using Applet...

    Hello, I want to load an Image from an external website (image hosting site) but I seem to get an error using the following code: images.add(ImageIO.read(urlsToGet.pop()));The error is get is something with security... Is there any "safe" and usefull