Find driving distance between two points without using API by use of Lat & Long?

Using Google geocode API : http://maps.googleapis.com/maps/api/geocode/xml?address=thane&sensor=true
We performed get distance between search criteria entered by user and all related clubs by lat & long  stored at db.
2. Two different points such as  
(origin: Lat1 & Long1) and (destination: Lat2 & Long2)
We tried for to get distance between these two points,
 (Lat2 & Long2) to (Lat1 & Long1)
But distance which we get by calculation is simple straight line distance 
Origin Destination
(Lat1 & Long1) (Lat2 & Long2)
3. This is not driving distance as google shows in exact Km
4. For that Google provide another API (distancematrix API)
http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Thane&sensor=true&destinations=khopat&mode=driving&language=en%20-%20EN
5. But there is limit for DistanceMatrix-Service without ClientID and client key
100 elements per query.
100 elements per 10 seconds.
2 500 elements per 24 hour period.
But as element request exceeds it shows : OVER_QUERY_LIMIT error  
6. In case of Client ID and Client key
In Distance Matrix 100 000 elements per 24 hour period,a maximum of 625 elements per query and a maximum of 1 000 elements per 10 seconds.
As per this one there is option to get purchase these API but basic question is remain same for us if we are requesting single origin and multiple destination then how element calculation done by google?
But in document google says :
Elements
The information about each origin-destination pairing is returned in an element entry. An element contains the following fields:
Status: See Status Codes for a list of possible status codes.
Duration: The duration of this route, expressed in seconds (the value field) and as text. The textual representation is localized according to
the query's language parameter.
Distance: The total distance of this route, expressed in meters (value) and as text. The textual value uses the unit system specified with the
unit parameter of the original request, or the origin's region.

Any information that you see in a google map webpage can be retrieved using the API.  The best way of finding the tags on the webpage is to manually perform the query using an IE webpage.   Then capture the source and save to a file so you
can use a text editor to look at results.  I often on a webpage use the menu : View -  Source and then copy the source to a text file.
jdweng

Similar Messages

  • How to measure distance between two points uisng uiaccelerometer

    Hello all,
    I am trying to measure distance between two points.So for that i am used uiaccelerometer but its give only rotation changes. I am moving my whole device from one point to another point so for that all x,y & z changes remain same. So how can get the device movement for that?
    Thank you..

    UIAccelerometer does not give rotation changes, it senses acceleration in each of the 3 axis in g-force units. Moving in a plane from one point to another and stopping will result in a net g-force in that axis of zero. To get distance one has to measure the initial acceleration and then the time before a deceleration is detected. It gets really complicated in real life since the start and stop are not instantaneous.

  • Distance between two points with degrees and minutes

    I would like to store several points in the database given degrees and minutes as position. In this example I have point 1 that is E 150, 0/S 30, 0 and points 2 that is E 150, 0/S 30.1. For example if I enter 2 km as distance from position of point 1 I would like the search to return all points witin 2 km.(should return points 2 that is very near)
    If I run the query
    SELECT c.name
    FROM cola_markets_cs c
    WHERE
    SDO_WITHIN_DISTANCE(c.shape,
    SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(150.0, 30.1, NULL), NULL, NULL),
    'distance=10000 unit=KM')
    = 'TRUE';
    I get result both position 1 and 2, but if I decrease to distance=1000 no rows is returned.
    Can you see what I am doing wrong here?
    Can I also combine SDO_WITHIN_DISTANCE with SDO_NN_DISTANCE so I can ask for all points 10 km in distance from the reference point and I can also see the actual distance for each point?
    Thank you
    I have tested with the following code. Do I save the position wrong..?
    CREATE TABLE cola_markets_cs (
    mkt_id NUMBER PRIMARY KEY,
    name VARCHAR2(32),
    shape MDSYS.SDO_GEOMETRY);
    INSERT INTO cola_markets_cs VALUES (
    1,
    'Point 1',
    MDSYS.SDO_GEOMETRY(
    2001,
    8307,
    MDSYS.SDO_POINT_TYPE(150.0, 30.0, NULL),
    NULL,
    NULL
    INSERT INTO cola_markets_cs VALUES (
    2,
    'Point 2',
    MDSYS.SDO_GEOMETRY(
    2001,
    8307,
    MDSYS.SDO_POINT_TYPE(150.0, 30.1, NULL),
    NULL,
    NULL
    -- UPDATE METADATA VIEW --
    -- Update the USER_SDO_GEOM_METADATA view. This is required
    -- before the Spatial index can be created. Do this only once for each
    -- layer (i.e., table-column combination; here: cola_markets_cs and shape).
    INSERT INTO USER_SDO_GEOM_METADATA
    VALUES (
    'cola_markets_cs',
    'shape',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('Longitude', -180, 180, 10), -- 10 meters tolerance
    MDSYS.SDO_DIM_ELEMENT('Latitude', -90, 90, 10) -- 10 meters tolerance
    8307 -- SRID for 'Longitude / Latitude (WGS 84)' coordinate system
    -- CREATE THE SPATIAL INDEX --
    -- Must be R-tree; quadtree not supported for geodetic data.
    CREATE INDEX cola_spatial_idx_cs
    ON cola_markets_cs(shape)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    --This search only return if distance is 10 000 km...
    SELECT c.name
    FROM cola_markets_cs c
    WHERE
    SDO_WITHIN_DISTANCE(c.shape,
    SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(150.0, 30.1, NULL), NULL, NULL),
    'distance=10000 unit=KM')
    = 'TRUE';
    --According to this search the distance to point 1 is 3331198,72256398,
    --this  should be zero..
    SELECT
    c.mkt_id, c.name, SDO_NN_DISTANCE(1) dist
    FROM cola_markets_cs c
    WHERE SDO_NN(c.shape,
    sdo_geometry(2001, 8307,sdo_point_type(150.0, 30.1, NULL), NULL, NULL),
    'sdo_num_res=2', 1) = 'TRUE' ORDER BY dist

    Hi,
    What version of Oracle are you using? I got this using your example:
    SELECT
    c.mkt_id, c.name, SDO_NN_DISTANCE(1) dist
    FROM cola_markets_cs c
    WHERE SDO_NN(c.shape,
    sdo_geometry(2001, 8307,sdo_point_type(150.0, 30.1, NULL), NULL, NULL), 'sdo_num_res=2', 1) = 'TRUE'
    ORDER BY dist ;
    MKT_ID NAME DIST
    2 Point 2 0
    1 Point 1 11085.3285
    This is 10.1.0.4
    Also:
    Can I also combine SDO_WITHIN_DISTANCE with SDO_NN_DISTANCE so I can ask for all points 10 km in distance from the reference point and I can also see the actual distance for each point?
    No, but you can add a distance calculation:
    SELECT
    c.mkt_id, c.name, SDO_GEOM.SDO_DISTANCE(c.shape,sdo_geometry(2001, 8307,sdo_point_type(150.0, 30.1, NULL), NULL, NULL),1) dist
    FROM cola_markets_cs c
    WHERE SDO_WITHIN_DISTANCE(c.shape,
    sdo_geometry(2001, 8307,sdo_point_type(150.0, 30.1, NULL), NULL, NULL), 'distance=10 unit=km') = 'TRUE'
    ORDER BY dist ;

  • Getting the length between two points

    Hi All,
    I am trying to get the distance between two points and came across the SDO_LENGTH function in the manual - however there is no example on how to use it.
    I was expecting the following statement to return me the value 9 but instead I am getting errors along the lines of SDO_GEOM.SDO_LENGTH must be declared etc.
    =============================================
    SDO_GEOM.SD0_LENGTH(
    MDSYS.SDO_GEOMETRY(2
    ,NULL
    ,NULL
    ,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
    ,MDSYS.SDO_ORDINATE_ARRAY(1,1,10,10))
    ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.0001)
    ,MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.0001))
    ============================================
    what am I missing
    any help appreciated
    Brent Glover

    I think I have found my answer
    ============================================
    DECLARE
    v_length NUMBER;
    BEGIN
    v_length := SDO_GEOM.SDO_LENGTH(
    MDSYS.SDO_GEOMETRY(2
    ,NULL
    ,NULL
    ,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
    ,MDSYS.SDO_ORDINATE_ARRAY(1,1,10,10))
    ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.0001)
    ,MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.0001))
    DBMS_OUTPUT.put_line(v_length);
    END;
    =============================================

  • Distance between all points

    Hi all, I am trying to find the distance between all points in an array. I was able to get the all possible combinations but i am not getting the expected ouput.
    For eg, if i have four points, total number combinations are going to be 6 and i want to find distance in all six combinations.
    Please help me where i did mistake. Please find the attached vi.
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13
    Solved!
    Go to Solution.
    Attachments:
    Find distance between all points.vi ‏17 KB

    Try something like this.
    Since I don't have the IMAQ function, I am using complex data for each point, but it would be trivial to adapt it to your data structures instead.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Find distance between all points.png ‏33 KB
    Find distance between all pointsMODCA.vi ‏10 KB
    Find distance between all pointsFP.png ‏21 KB

  • Finding Distance between two zipcodes with longtitude and latitude

    Want to find distance between two zipcodes that have their latitude and longitude stored in a table.
    The table is as follows
    CREATE TABLE distance (zipcode VARCHAR2, LNG NUMBER, LAT NUMBER)
    I couldn't come up with a calculation or understand the mathematical calculation on line.. Can you help me with some stored procedure that will do..?
    Thanks

    There is no logical complexity in your query besides knowing the basics of
    http://en.wikipedia.org/wiki/Spherical_coordinates
    Also, the table name "Distance" cannot be more confusing; what you have is essentially "PointsOnSphere".
    select R*sqrt(
    (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))* (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))
    +
    (sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))*
    (sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))
    +
    (cos(pi-p1.lng)-cos(pi-p2.lng))*(cos(pi-p1.lng)-cos(pi-p2.lng))
    from distance p1, distance p2
    where R is the radius of Earth, and pi=3. Don't forget to convert angular degrees into radiants before you plug in them into the query above
    Correction: This was euclidean distance sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2) between the points (x1,y1,z1) and (x2,y2,z2). Spherical distance is
    sqrt(
    (R*(colatitude1-colatitude2))^2+
    (R*sin(colatitude1-colatitude2)*(longtitude1-longtitude2))^2
    Message was edited by:
    Vadim Tropashko

  • How to draw a line(shortest distance)  between two ellipse using SWING

    how to draw a line(should be shortest distance) between two ellipse using SWING
    any help will be appreciated
    regards

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class ELine extends JPanel {
        Ellipse2D.Double red = new Ellipse2D.Double(150,110,75,165);
        Ellipse2D.Double blue = new Ellipse2D.Double(150,50,100,50);
        Line2D.Double line = new Line2D.Double();
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setPaint(Color.green.darker());
            g2.draw(line);
            g2.setPaint(Color.blue);
            g2.draw(blue);
            g2.setPaint(Color.red);
            g2.draw(red);
        private void connect() {
            double flatness = 0.01;
            PathIterator pit = blue.getPathIterator(null, flatness);
            double[] coords = new double[2];
            double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
            double min = Double.MAX_VALUE;
            while(!pit.isDone()) {
                int type = pit.currentSegment(coords);
                switch(type) {
                    case PathIterator.SEG_MOVETO:
                    case PathIterator.SEG_LINETO:
                        Point2D.Double p = getClosestPoint(coords[0], coords[1]);
                        double dist = p.distance(coords[0], coords[1]);
                        if(dist < min) {
                            min = dist;
                            x1 = coords[0];
                            y1 = coords[1];
                            x2 = p.x;
                            y2 = p.y;
                        break;
                    case PathIterator.SEG_CLOSE:
                        break;
                    default:
                        System.out.println("blue type: " + type);
                pit.next();
            line.setLine(x1, y1, x2, y2);
        private Point2D.Double getClosestPoint(double x, double y) {
            double flatness = 0.01;
            PathIterator pit = red.getPathIterator(null, flatness);
            double[] coords = new double[2];
            Point2D.Double p = new Point2D.Double();
            double min = Double.MAX_VALUE;
            while(!pit.isDone()) {
                int type = pit.currentSegment(coords);
                switch(type) {
                    case PathIterator.SEG_MOVETO:
                    case PathIterator.SEG_LINETO:
                        double dist = Point2D.distance(x, y, coords[0], coords[1]);
                        if(dist < min) {
                            min = dist;
                            p.setLocation(coords[0], coords[1]);
                        break;
                    case PathIterator.SEG_CLOSE:
                        break;
                    default:
                        System.out.println("red type: " + type);
                pit.next();
            return p;
        public static void main(String[] args) {
            final ELine test = new ELine();
            test.addMouseListener(test.mia);
            test.addMouseMotionListener(test.mia);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(test);
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    Graphics g = test.getGraphics();
                    g.drawString("drag me", 175, 80);
                    g.dispose();
        private MouseInputAdapter mia = new MouseInputAdapter() {
            Point2D.Double offset = new Point2D.Double();
            boolean dragging = false;
            public void mousePressed(MouseEvent e) {
                Point p = e.getPoint();
                if(blue.contains(p)) {
                    offset.x = p.x - blue.x;
                    offset.y = p.y - blue.y;
                    dragging = true;
            public void mouseReleased(MouseEvent e) {
                dragging = false;
            public void mouseDragged(MouseEvent e) {
                if(dragging) {
                    double x = e.getX() - offset.x;
                    double y = e.getY() - offset.y;
                    blue.setFrame(x, y, blue.width, blue.height);
                    connect();
                    repaint();
    }

  • Distance between two GPS points

    Is there an inbuilt function in PL/SQL for calulating the distance between two GPS (lat/long) points?
    I'm using Oracle 9i. There's a thing called SDO_GEOM available, but I'm not sure if this is what its used for or if it's the best option.

    If the earth is a complete globe and its circumference is 40000km,
    I make the function as follows.
    create ore replace
    function distance
    (a_lat number,a_lon number,b_lat number, b_lon number)
    return number is
    circum number := 40000; -- kilometers
    pai number := acos(-1);
    a_nx number;
    a_ny number;
    a_nz number;
    b_nx number;
    b_ny number;
    b_nz number;
    inner_product number;
    begin
    if (a_lat=b_lat) and (a_lon=b_lon) then
    return 0;
    else
    a_nx := cos(a_lat*pai/180) * cos(a_lon*pai/180);
    a_ny := cos(a_lat*pai/180) * sin(a_lon*pai/180);
    a_nz := sin(a_lat*pai/180);
    b_nx := cos(b_lat*pai/180) * co s(b_lon*pai/180);
    b_ny := cos(b_lat*pai/180) * sin(b_lon*pai/180);
    b_nz := sin(b_lat*pai/180);
    inner_product := a_nx*b_nx + a_ny*b_ny + a_nz*b_nz;
    if inner_product > 1 then
    return 0;
    else
    return (circum*acos(inner_product))/(2*pai);
    end if;
    end if;
    end;
    I rewrite it by using the factorization and the triangle function's sum and difference formulas:
    cos(x-y) = cos(x)cos(y)+sin(x)sin(y)
    As result, this function is same to the 1st method of Billy Verreynne.
    create or replace
    function distance
    (a_lat number,a_lon number,b_lat number, b_lon number)
    return number is
    circum number := 40000; -- kilometers
    pai number := acos(-1);
    dz number;
    dx2y2 number;
    inner_product number;
    begin
    if (a_lat=b_lat) and (a_lon=b_lon) then
    return 0;
    else
    dz := sin(a_lat*pai/180)*sin(b_lat*pai/180);
    dx2y2 := cos(a_lat*pai/180)*cos(b_lat*pai/180)*cos((a_lon-b_lon)*pai/180);
    inner_product := dz*dz + dx2y2;
    if inner_product > 1 then
    return 0;
    else
    return (circum*acos(inner_product))/(2*pai);
    end if;
    end if;
    end;
    Message was edited by:
    ushitaki

  • How do you find the average value of all the data between two points on a single channel

    I am tring to calculate the average value of all the data points on a single plot between two seperate points
    I have attahced an illustration.
    Tim
    Solved!
    Go to Solution.
    Attachments:
    plot.jpg ‏173 KB

    Hey smoothdurban,
    I've seen Brad's code, and trust me, it's worth the effort to let him help you get it up and running - it's definitely the most ideal way to solve this problem.  However, as Brad said, there are multiple ways to tackle this - both interactive and programmatic - so in the meantime, I'll take a second to detail one of the interactive and sure-fire ways to find the average of data between two points on a single channel.
    We'll use"Flags."  Set up your VIEW graph exactly as you did on your original screenshot, using Band Cursors to approximate the beginning and ending X-values representing the range you want to examine.  Next:
    1. Click the "Set Flags" button () that is a part of your 2D Axis System.  Note that you can hold down the Shift button if you ever decide you want to do this on more than a single curve at one time.
    2. Select the "Flags: Copy Data Points" button that enables after Flags are set.
    3. This creates new channel(s) in the default (bold) group in the Data Portal that contains only the Flagged data.
    4. Select DIAdem ANALYSIS.
    5. Select Statistics » Descriptive Statistics.
    6. In the Channels input, select the newly created channel containing your Flagged Y-Data.
    7. Ensure that the Arithmetic Mean parameter is set.  You can preview the data and the result in the dialog before pressing OK to execute the calculation. 
    You may have noticed that in the Descriptive Statistics calculation, one of the parameters that you can set is the range of channel rows to operate on - so, if you know the row numbers of your beginning and ending X-values, you could just simply run the Descriptive Statistics calculation and use this parameter to operate on a row subset of your original channel instead of the entire channel.
    Derrick S.
    Product Manager
    NI DIAdem
    National Instruments

  • Excel formula to calculate the distance between multiple points using lat/lon coordinates

    I'm currently drawing up a mock database schema with two tables: Booking and Waypoint.
    Booking stores the taxi booking information.
    Waypoint stores the pickup and drop off points during the journey, along with the lat lon position. Each sequence is a stop in the journey.
    How would I calculate the distance between the different stops in each journey (using the lat/lon data) in Excel?
    Is there a way to programmatically define this in Excel, i.e. so that a formula can be placed into the mileagecolumn
    (Booking table),
    lookup the matching sequence (via bookingId)
    for that journey in the Waypointtable
    and return a result?
    Example 1:
    A journey with 2 stops:
    1 1 1 MK4 4FL, 2, Levens Hall Drive, Westcroft, Milton Keynes 52.002529 -0.797623
    2 1 2 MK2 2RD, 55, Westfield Road, Bletchley, Milton Keynes 51.992571 -0.72753
    4.1 miles according to Google, entry made in mileage column
    in Booking table
    where id
    = 1
    Example 2:
    A journey with 3 stops:
    6 3 1 MK7 7DT, 2, Spearmint Close, Walnut Tree, Milton Keynes 52.017486 -0.690113
    7 3 2 MK18 1JL, H S B C, Market Hill, Buckingham 52.000674 -0.987062
    8 3 1 MK17 0FE, 1, Maids Close, Mursley, Milton Keynes 52.040622 -0.759417
    27.7 miles according to Google, entry made in mileage column
    in Booking table
    where id
    = 3
    I understand that 100% accuracy is not possible, so it will not be an issue.

    http://www.cpearson.com/excel/LatLong.aspx
    and
    http://www.contextures.com/excellatitudelongitude.html

  • Google maps "get directions" between two points stopped working in firefox

    When using google maps to find directions between two points "Get Directions" it will just sit there loading... never finishing and showing the routes between the locations.
    This used to work fine about a month ago. I have not done anything, expect update Firefox.

    I can still get the basic directions to work in Google Maps, but recently the 3D driving directions has stopped working, and I'm pretty sure it stopped just about one Firefox update back. I realize this function is gravy to many people - a toy - but for someone who uses visual cues it has been extremely useful for imprinting the information in my mind, familiarizing myself with the route ahead of the drive. When I am traveling without a 'navigator' - a passenger who can read the directions as I drive - this is a huge help. Today I got a message about updating the GoogleEarth plugin, which I did - twice! Still no 3d directions, though suddenly the GG 3d driving simulator works. This has to be a FF problem :-(

  • Distance between two objects

    Hi folks,
    Who knows how I can discover the distance between two selected objects without using neither guides nor grids?
    Thanks.

    How do imagine this would working without using guides or grids? The way I normally do it is:
    1. Drag out a guide to point A
    2. Drag out a guide to point B
    3. Hold shift and put the mouse cursoe between the two -- it shows you the distance
    You could also use the measuring tool (click and hold the rectangle tool in the tool pallette.)
    Or even just draw a rectangle and look at the width in the property panel. That's a fast and easy method I use sometimes.
    Aaron Beall
    http://fireworks.abeall.com

  • Extract Time from date and Time and Need XLMOD Funtion to find the Difference between Two Time.

    X6 = "1/5/15 5:16 AM" & NOW ....................difference by Only Time
    not date
    X6 date and Time will be changing, Its not Constant
                Dim myDateTime As DateTime = X6
                Dim myDate As String = myDateTime.ToString("dd/MM/yy")
                Dim myTime As String = myDateTime.ToString("hh:mm tt")
                Dim myDateTime1 As DateTime = Now
                Dim myDate1 As String = myDateTime1.ToString("dd/MM/yy")
                Dim myTime1 As String = myDateTime1.ToString("hh:mm tt")
    Need to use this function to find the Difference between Two Time. due to 12:00 AM isuue
    Function XLMod(a, b)
        ' This replicates the Excel MOD function
        XLMod = a - b * Int(a / b)
    End Function
    Output Required
     dim dd  = XLMod(myTime - myTime1)
    Problem is myTime & myTime1 is String Need to convert them into Time, Later use XLMOD Funtion.

    Induhar,
    As an addendum to this, I thought I'd add this in also: If you have two valid DateTime objects you might consider using a class which I put together a few years ago
    shown on a page of my website here.
    To use it, just instantiate with two DateTime objects (order doesn't matter, it'll figure it out) and you'll then have access to the public properties. For this example, I'm just showing the .ToString method:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim date1 As DateTime = Now
    Dim date2 As DateTime = #1/1/1970 2:35:00 PM#
    Dim howOld As New Age(date1, date2)
    MessageBox.Show(howOld.ToString, "Age")
    Stop
    End Sub
    End Class
    I hope that helps, if not now then maybe at some point in the future. :)
    Still lost in code, just at a little higher level.
      Thanx frank, can use this in Future....

  • Bearing between two points

    This may be an obvious question to more experienced users, but I can't seem to find anything on it in the documentation.
    Is there any way to find the bearing of a line segment, that is, the angle between due north and the line between two points? It seems so simple, and Spatial provides a function to find a point at a specified distance and heading from another, so it seems like existing functionality.
    Thanks in advance - J

    Upgrading to 11g is one option.
    The other option is to write this function in PL/SQL yourself if you don't need a very accurate solution.
    This web page here gives a simple algorithm to find the bearing for two points.
    http://www.movable-type.co.uk/scripts/latlong.html

  • Unable to find line break between two lines in attachment file.

    Dear all I will be very great full if someone help me out,
    I am trying to send mail through SMTP server with an attachment of oracle report, but I am unable to find line break between two lines, when I down load the attachment from mail and open attach.txt file by double click on it. Next line starts right after previous line ends, it should starts with new line.
    In order to send an attachment file, I am reading source file line by line and put MIME protocol’s attachment instance, contain of source file is being properly written into target file if I open that attachment on cmd prompt.
    Following code may help you to understand the case.
    Thanks in advance.
    My code is as follows:-
    create or replace procedure bec_file_test
    v_subject varchar2, -- Subject of the email
    v_body varchar2, -- Body of the email
    v_from VARCHAR2 default 'XYZ.com', -- sender mail id
    v_to varchar2 default 'XYZ.com', -- Field To of the email
    v_cc varchar2 default 'XYZ.com' -- cc address
    ) is
    -- variable to hold the smtp server connection
    v_smtp_connection utl_smtp.connection;
    -- variable to hold the smtp host name
    v_smtp_host varchar2(100) default 'mail.bec-group.com';
    -- variable to hold the smtp port
    v_smtp_port number default 25;
    -- composite of {CR}{LF} caridge return and line feed.
    CRLF varchar2(2):=CHR(13)||CHR(10);
    cursor pr_rec is
    select requisition_no,line_no,release_no,a.contract,
    a.project_id,substr(a.activity_seq,1,11)ACT_SEQ,
    substr(a.part_no,1,12)PART_NO,
    substr(a.description,1,32)DESCRIPTION,
    substr(a.Bal_qty,1,8) BAL_QTY,
    substr(a.unit_meas,1,5)UOM,
    a.wanted_receipt_date WAN_REC_DT,
    a.latest_order_date LAT_ORD_DT
    from bec_pr_line_rep a
    where a.Bal_qty>0 and a.header_state not in 'Closed'
    and upper(a.state1) like 'RELEASED' and a.contract not in ('U1ENG','ULENG','U1FND','U2FND')
    and a.buyer_code='70306'
    order by a.part_no;
    begin
    declare
    fHandle UTL_FILE.FILE_TYPE;
    v_msg_line varchar2(2000);
    -- v_buffer varchar2(20000);
    --ALTER SYSTEM SET utl_file_dir = 'D:\Database\temp'
    --COMMENT='Temporary change on Dec 14'
    --SCOPE=SPFILE;
    SELECT name, value
    FROM gv$parameter
    WHERE name = 'utl_file_dir';
    --drop directory my_directory
    --CREATE or replace DIRECTORY my_directory AS 'D:\database\temp';
    --GRANT read,write ON DIRECTORY my_directory TO PUBLIC;
    begin ---writing data into a file.
    fHandle := UTL_FILE.FOPEN('MY_DIRECTORY', 'pending_pr_summry.txt', 'w');
    UTL_FILE.put_line(fHandle, ' Pending PR to process (detail report)');
    UTL_FILE.put_line(fHandle,TO_CHAR(SYSDATE,'MM-DD-YY HH:MI:SS AM'));
    UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
    UTL_FILE.put_line(fHandle, 'Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt' );
    UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
    for pr_temp in pr_rec loop
    begin
    v_msg_line:=to_char(rpad(pr_temp.requisition_no,12,' ')||'|'||
    lpad(pr_temp.line_no,3,' ')||'|'||
    lpad(pr_temp.release_no,3,' ')||'|'||
    rpad(pr_temp.contract,7,' ')||'|'||
    lpad(nvl(pr_temp.project_id,' '),7,' ')||'|'||
    lpad(nvl(pr_temp.act_seq,' '),12,' ')||'|'||
    lpad(pr_temp.part_no,12,' ')||'|'||
    rpad(pr_temp.description,35,' ')||'|'||
    lpad(pr_temp.bal_qty,10,' ')||'|'||
    rpad(pr_temp.uom,6,' ')||'|'||
    lpad(pr_temp.wan_rec_dt,14,' ')||'|'||
    lpad(pr_temp.lat_ord_dt,14,' '));
    UTL_FILE.put_line(fHandle,v_msg_line);
    end;
    end loop;
    UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
    UTL_FILE.put_line(fHandle, ' Regards : IFSAPP ( Application owner ) ');
    UTL_FILE.FCLOSE(fHandle); ------------writing into file is successfuly done here!
    --Reading of file starts here containt will be added in attchment file
    fHandle :=UTL_FILE.FOPEN('MY_DIRECTORY','pending_pr_summry.txt','R' );
    -- establish the connection to the smtp server
    v_smtp_connection := utl_smtp.open_connection(v_smtp_host, v_smtp_port); /** OPEN CONNECTION ON THE SERVER **/
    -- perform a handshake with the smtp server
    utl_smtp.helo(v_smtp_connection, v_smtp_host); /** DO THE INITIAL HAND SHAKE **/
    -- set the 'from' address of the message
    utl_smtp.mail(v_smtp_connection, v_from);
    -- add the recipient to the message
    utl_smtp.rcpt(v_smtp_connection, v_to);
    -- send the email
    utl_smtp.open_data(v_smtp_connection);
    v_msg_line:='Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || CRLF ||
    'From: ' || v_from || CRLF ||
    'Subject: ' || v_subject || CRLF ||
    'To: ' || v_to || CRLF ||
    'Cc: ' || v_cc || CRLF ||
    'MIME-Version: 1.0'|| CRLF || -- Use MIME mail standard
    'Content-Type: multipart/mixed;'||CRLF ||
    ' boundary="-----SECBOUND"'||CRLF||
    CRLF ||'-------SECBOUND'|| CRLF ||
    'Content-Type: text/plain;'|| CRLF ||
    'Content-Transfer_Encoding: 7bit'|| CRLF ||
    CRLF ||v_body|| CRLF;     -- Message body
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    v_msg_line:='-------SECBOUND'|| CRLF ||
    'Content-Type: application/octet-stream;'|| CRLF ||
    'Content-Type: text/plain;'|| CRLF ||
    'name="pending_pr_summry.txt"'|| CRLF ||
    'Content-Transfer_Encoding: 8bit'|| CRLF ||
    'Content-Disposition: attachment;'|| CRLF ||
    ' filename="pending_pr_summry.txt"'|| CRLF || CRLF;     -- Content of attachment
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    -- check file is opened
    IF utl_file.is_open(fHandle) THEN
    -- loop lines in the file
    LOOP
    BEGIN -- Content of attachment
    utl_file.get_line(fHandle,v_msg_line);
    v_msg_line:=concat(v_msg_line,CRLF);
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    --end of attachment containt     
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    UTL_FILE.FCLOSE(fHandle);
    utl_smtp.close_data(v_smtp_connection);
    utl_smtp.quit(v_smtp_connection);
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line(' Invalid Operation in Mail attempt using UTL_SMTP.');
    when utl_smtp.transient_error then
    dbms_output.put_line(' Temporary e-mail issue - try again');
    when utl_smtp.permanent_error then
    dbms_output.put_line(' Permanent Error Encountered.');
    when others then
    dbms_output.put_line('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
    RAISE;
    end;
    end bec_file_test;

    Pending PR to process (detail report)01-17-13 12:43:19 PM--------------------------------------------------------------------------------------------------------------------------------------------------Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt--------------------------------------------------------------------------------------------------------------------------------------------------MAT/250370 | 2| 1|ISCSP | 4977| 100004207| 0104000016|Angle 50 X 50 X 6 IS:2062 Grade |500|kg |30-NOV-2012| 20-nov-2012MAT/250370 | 3| 1|ISCSP | 4977| 100004207| 0105000002|Channel 100 X 50 IS:2062 Grade A | 1000|kg | 30-NOV-2012| 20-nov-2012MAT/250579 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 2991|kg | 13-DEC-2012| 03-dec-2012MAT/250606 | 2| |NMDCJ | 6002| 100005860| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | |1|NMDCJ|6001|100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 1500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 3| 1|NMDCJ | 6002| 100005818| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 3939|kg | 29-DEC-2012| 19-dec-2012MAT/250606 | 4| 1|NMDCJ | 6002| 100005860| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 39000|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 4| 1|NMDCJ | 6001| 100005580| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 2| 1|NMDCJ | 6002| 100005818| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 12183|kg | 29-DEC-2012| 19-dec-2012MAT/250606 | 6| 1|NMDCJ | 6002| 100005860| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 9500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 6| 1|NMDCJ | 6001| 100005580| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 6| 1|NMDCJ | 6002| 100005818| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 7| 1|NMDCJ | 6001| 100005580| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 22000|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 7| 1|NMDCJ | 6002| 100005818| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 27060|kg | 29-DEC-2012| 19-dec-2012MAT/251138 | 1| 1|NMDCJ | 6002| 100005825| 3501000001|Cement 50 kg | 1|pkt | 25-DEC-2013| 14-dec-2013--------------------------------------------------------------------------------------------------------------------------------------------------
    where as source file is like that:-
    Pending PR to process (detail report)
    01-17-13 12:43:19 PM
    Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt
    MAT/250370 | 2| 1|ISCSP | 4977| 100004207| 0104000016|Angle 50 X 50 X 6 IS:2062 Grade | 5500|kg | 30-NOV-2012| 20-nov-2012
    MAT/250370 | 3| 1|ISCSP | 4977| 100004207| 0105000002|Channel 100 X 50 IS:2062 Grade A | 1000|kg | 30-NOV-2012| 20-nov-2012
    MAT/250579 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 2991|kg | 13-DEC-2012| 03-dec-2012
    MAT/250606 | 2| 1|NMDCJ | 6002| 100005860| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 1500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 3| 1|NMDCJ | 6002| 100005818| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 3939|kg | 29-DEC-2012| 19-dec-2012
    MAT/250606 | 4| 1|NMDCJ | 6002| 100005860| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 39000|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 4| 1|NMDCJ | 6001| 100005580| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 2| 1|NMDCJ | 6002| 100005818| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 12183|kg | 29-DEC-2012| 19-dec-2012
    MAT/250606 | 6| 1|NMDCJ | 6002| 100005860| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 9500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 6| 1|NMDCJ | 6001| 100005580| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 6| 1|NMDCJ | 6002| 100005818| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 7| 1|NMDCJ | 6001| 100005580| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 22000|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 7| 1|NMDCJ | 6002| 100005818| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 27060|kg | 29-DEC-2012| 19-dec-2012
    MAT/251138 | 1| 1|NMDCJ | 6002| 100005825| 3501000001|Cement 50 kg | 1 |pkt | 25-DEC-2013| 14-dec-2013
    Ignore alignment. It is well formatted in source file.

Maybe you are looking for

  • Reporting Services Point, remote SQL issue

    I'm trying to install Reporting Services Point on a remote SQL 2008 R2 SP2 server. I select the SQL server under Servers and Site System Roles and it lists the site database server name, database name (should this name be the same as the DB found in

  • Can 2nd generation Apple TV play 1080p?

    I cannot find a 1080p option in the menu. Does it only support 720p?

  • Icon on JDialog

    Hi , Can anyone let me know how to set the icon in the caption bar for JDialog. I am passing the Frame in the constructor but he is not showing the icon of the Frame. Dialog is set as Modal. Constructor is like this: public MyDialog(Frame frame,Strin

  • Use RS_TABLE_LIST_CREATE

    Hi abbapers, I want to use the FM RS_TABLE_LIST_CREATE: CALL FUNCTION 'RS_TABLE_LIST_CREATE'          EXPORTING               table_name         = 'BKPF'     *         ACTION             = 'ANZE'     *         WITHOUT_SUBMIT     = ' '     *         G

  • BLOB fields again...

    Hello, I'm developing an application which has a database table with blob fields. I've had many problems recently with this type of field, the most undesired being that LOV fields doesn't work in pages with BLOB fields. As a workaround, I've done a s