Trendline between two points

hi
i have a code like this
trendline.jsp
<%@page import="ChartDirector.*" %>
<%
// The data for the line chart
double[] data = {50, 55, 47, 34, 42, 49, 63, 62, 73, 59, 56, 50, 64, 60, 67, 67, 58,
    59, 73, 77, 84, 82, 80, 91};
// The labels for the line chart
String[] labels = {"Jan 2000", "Feb 2000", "Mar 2000", "Apr 2000", "May 2000",
    "Jun 2000", "Jul 2000", "Aug 2000", "Sep 2000", "Oct 2000", "Nov 2000",
    "Dec 2000", "Jan 2001", "Feb 2001", "Mar 2001", "Apr 2001", "May 2001",
    "Jun 2001", "Jul 2001", "Aug 2001", "Sep 2001", "Oct 2001", "Nov 2001",
    "Dec 2001"};
// Create a XYChart object of size 500 x 320 pixels, with a pale purpule (0xffccff)
// background, a black border, and 1 pixel 3D border effect.
XYChart c = new XYChart(500, 320, 0xffccff, 0x000000, 1);
// Set the plotarea at (55, 45) and of size 420 x 210 pixels, with white background.
// Turn on both horizontal and vertical grid lines with light grey color (0xc0c0c0)
c.setPlotArea(55, 45, 420, 210, 0xffffff, -1, -1, 0xc0c0c0, -1);
// Add a legend box at (55, 25) (top of the chart) with horizontal layout. Use 8 pts
// Arial font. Set the background and border color to Transparent.
c.addLegend(55, 22, false, "", 8).setBackground(Chart.Transparent);
// Add a title box to the chart using 13 pts Times Bold Italic font. The text is
// white (0xffffff) on a purple (0x800080) background, with a 1 pixel 3D border.
c.addTitle("Long Term Server Load", "Times New Roman Bold Italic", 13, 0xffffff
    ).setBackground(0x800080, -1, 1);
// Add a title to the y axis
c.yAxis().setTitle("MBytes");
// Set the labels on the x axis. Rotate the font by 90 degrees.
c.xAxis().setLabels(labels).setFontAngle(90);
// Add a line layer to the chart
LineLayer lineLayer = c.addLineLayer();
// Add the data to the line layer using light brown color (0xcc9966) with a 7 pixel
// square symbol
lineLayer.addDataSet(data, 0xcc9966, "Server Utilization").setDataSymbol(
    Chart.SquareSymbol, 7);
// Set the line width to 2 pixels
lineLayer.setLineWidth(2);
// tool tip for the line layer
lineLayer.setHTMLImageMap("", "", "title='{xLabel}: {value} MBytes'");
// Add a trend line layer using the same data with a dark green (0x008000) color. Set
// the line width to 2 pixels
TrendLayer trendLayer = c.addTrendLayer(data, 0x008000, "Trend Line");
trendLayer.setLineWidth(2);
// tool tip for the trend layer
trendLayer.setHTMLImageMap("", "", "title='Change rate: {slope|2} MBytes/per month'");
// output the chart
String chart1URL = c.makeSession(request, "chart1");
// include tool tip for the chart
String imageMap1 = c.getHTMLImageMap("");
%>
<html>
<body topmargin="5" leftmargin="5" rightmargin="0">
<div style="font-size:18pt; font-family:verdana; font-weight:bold">
    Trend Line Chart
</div>
<img src='<%=response.encodeURL("getchart.jsp?"+chart1URL)%>'
    usemap="#map1" border="0">
<map name="map1"><%=imageMap1%></map>
</body>
</html>getchart.jsp
<%@page import="ChartDirector.*" %><%
try
     out.clear();
     GetSessionImage.getImage(request, response);
     if (Math.max(1, 2) == 2) return;
catch (IllegalStateException e)
     response.sendRedirect(response.encodeRedirectURL(
          "getchart.chart?" + request.getQueryString()));
     return;
%>i have to draw a trendline chart...
i searched for examples...
i come across this. above example..
actually my querry is i ve to draw the trendline between two points.
in between "data" ( 63 to 70) only...
is there any way to do this
please help me
thank you in advance.

hi
i tried this..
<%@page import="ChartDirector.*" %>
<%
// The data for the line chart
double[] dataX0 = {6};
double[] dataY0 = {63};
String[] labels2 = {"Jul 2000", "Aug 2000", "Sep 2000", "Oct 2000", "Nov 2000",
    "Dec 2000"};
// The lengths (radii) and directions (angles) of the vectors
double[] dataR = {3};
double[] dataA = {60};
// The labels for the line chart
String[] labels = {"Jan 2000", "Feb 2000", "Mar 2000", "Apr 2000", "May 2000",
    "Jun 2000", "Jul 2000", "Aug 2000", "Sep 2000", "Oct 2000", "Nov 2000",
    "Dec 2000", "Jan 2001", "Feb 2001", "Mar 2001", "Apr 2001", "May 2001",
    "Jun 2001", "Jul 2001", "Aug 2001", "Sep 2001", "Oct 2001", "Nov 2001",
    "Dec 2001"};
// Create a XYChart object of size 500 x 320 pixels, with a pale purpule (0xffccff)
// background, a black border, and 1 pixel 3D border effect.
XYChart c = new XYChart(500, 320, 0xffccff, 0x000000, 1);
// Set the plotarea at (55, 45) and of size 420 x 210 pixels, with white background.
// Turn on both horizontal and vertical grid lines with light grey color (0xc0c0c0)
c.setPlotArea(55, 45, 420, 210, 0xffffff, -1, -1, 0xc0c0c0, -1);
// Add a legend box at (55, 25) (top of the chart) with horizontal layout. Use 8 pts
// Arial font. Set the background and border color to Transparent.
c.addLegend(55, 22, false, "", 8).setBackground(Chart.Transparent);
// Add a title box to the chart using 13 pts Times Bold Italic font. The text is
// white (0xffffff) on a purple (0x800080) background, with a 1 pixel 3D border.
c.addTitle("Long Term Server Load", "Times New Roman Bold Italic", 13, 0xffffff
    ).setBackground(0x800080, -1, 1);
// Add a title to the y axis
c.yAxis().setTitle("MBytes");
// Set the labels on the x axis. Rotate the font by 90 degrees.
c.xAxis().setLabels(labels).setFontAngle(90);
c.addVectorLayer(dataX0, dataY0, dataR, dataA,1, 0x0000cc
    ).setArrowHead(11);
/*LineLayer layer1 = c.addLineLayer();
//LineLayer layer1 = c.addLineLayer(dataY0, 0xff3333, "Compound AAA");
layer1.addDataSet(dataY0, 0xff3333, "Close Loop Line").setDataSymbol( Chart.LeftTriangleSymbol, 10);
layer1.setXData(dataX0);
layer1.setLineWidth(2);*/
// Add a line layer to the chart
LineLayer lineLayer = c.addLineLayer2();
// Add the data to the line layer using light brown color (0xcc9966) with a 7 pixel
// square symbol
lineLayer.addDataSet(data, 0xcc9966, "Server Utilization").setDataSymbol(
    Chart.SquareSymbol, 7);
lineLayer.setLineWidth(2);
// output the chart
String chart1URL = c.makeSession(request, "chart1");
// include tool tip for the chart
//String imageMap1 = c.getHTMLImageMap("");
%>
<html>
<body topmargin="5" leftmargin="5" rightmargin="0">
<div style="font-size:18pt; font-family:verdana; font-weight:bold">
    Trend Line Chart
</div>
<img src='<%=response.encodeURL("getchart.jsp?"+chart1URL)%>'
    usemap="#map1" border="0">
</body>
</html>how can i set the angle of direction for the arrow..
suppose
i wanna draw an arrow b/w these points
y=50 to y=37
how can give the length and direction here
c.addVectorLayer(dataX0, dataY0, dataR, dataA,1, 0x0000cc
    ).setArrowHead(11);i mean in daraR and dataA...
please help me
thank you in advance

Similar Messages

  • 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 :-(

  • 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;
    =============================================

  • 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

  • Arc between two points

    Hey Everybody!!
    I want to draw an arc between two points.. i can't seem to be able to figure the math but i'm sure this is fairly simple and somebody has done this before...
    Thanks in advance.

    that's correct...you need three points to define an arc..
    the reason i said two points is that i'm doing a diagram editor and i have to let the user connect pairs of objects using arrow, arcs, lines etc...
    any help is greatly appreciated...

  • 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

  • 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.

  • Polar equation of a line between two points

    I am trying to make a method to output the points (in polar coordinates (r, theta)) along a line between two given polar coordinates.
    This will mimick the path of an object traveling across a radar screen.
    Is this possible?

    Java does not plot in polar coordiantes, you'll have to convert to rectangular to get a plot. If you're just doing a sweep on a screen, then it's fairly simple to do:
    r is the radius of your screen,
    (0,0) is your Origin translated as (Xmax/2, Ymax/2)
    when you draw the line you just start at your Origin and get your end values as
    X1=X0+r*cos(Theta) and
    Y1=Y0+r*sin(Theta),
    I've not seen, nor do I think there is any other support to do what you want--you have to convert to (x,y) coordinate system.
    This will leave a ragged edge so make a border around your screen.
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import java.awt.Point;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    public class JRadar{
      public JRadar(){
        JPanel p = new MyJPanel();
        JFrame f = new JFrame("ForumJunk: JRadar");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.add(p);
        f.pack();
        f.setVisible(true);
      public static void main(String[] args){
        new JRadar();
      class MyJPanel extends JPanel implements ActionListener{
        Timer t = new Timer(10, this);
        Dimension d = new Dimension(512, 512);
        BufferedImage bi = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = bi.createGraphics();
        double theta = 0;
        int r = d.width/2 - 16;
        Point origin = new Point(d.width/2, d.height/2);
        public MyJPanel(){
          g.setColor(Color.RED);
          this.setPreferredSize(d);
          t.start();
        public void actionPerformed(ActionEvent e){
          g.clearRect(0, 0, d.width, d.height);
          g.drawOval(16, 16, 480, 480);
          g.drawLine(origin.x, origin.y, (int)(origin.x+r*Math.cos(theta)), (int)(origin.y+r*Math.sin(theta)));
          theta += 0.01;
          if(theta>=Math.PI*2) theta = 0.0;
          repaint();
        public void paintComponent(Graphics g){
          super.paintComponent(g);
          g.drawImage(bi, 0, 0, this);
    }Edited by: morgalr on Mar 3, 2010 4:59 PM: code example added

  • 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

  • Generating intermediate points between two points

    hi,
    i want to generate the intermediate points between two specified points,is there any functionality in java that generates the intermediate points similiar to the LINEDDA in VC++/SDK.or else please to suggest a better idea of how to get this done..
    thanx

    I'm not aware of any Java method. Here's an algorithm that I think will work for you:
    Point start = new Point(...);
    Point end = new Point(...);
    int xDelta = (int)(start.getX() - end.getX());
    int yDelta = (int)(start.getY() - end.getY());
    int delta = Math.max(Math.abs(xDelta), Math.abs(yDelta));
    double xIncrement = xDelta / delta;
    double yIncrement = yDelta / delta;
    double x = start.getX();
    double y = start.getY();
    for (int i = 0; i < delta; i++)
         drawImage( x, y, ....);
         x += xIncrement;
         y += yIncrement;
    }

  • Angle between two points

    hi,
    if I have two points
    Point2D.Double p;
    Point2D.Double q;
    how do you find the angle between them (measured from a vertical bar)?
    thanks,
    asjf

    Point2D.Double  p = new Point2D.Double(4.0,3.0),
                 q=new Point2D.Double(-3.0,4.0);
    double angle = Math.atan(p.y,p.x)-Math.atan(q.y,q.x);
    System.out.println("angle(radians)="+angle+", (degrees)="+ angle/Math.PI*180);Defend the hionour of atan2? Gaaah! you are making two[d] calls to a math library! My code only needs to make one, to acos().
    Firstly, of course, in the atan method the order of the operands is significant. In the dot product method, they are not. One gives "the angular distance from p to q", wheras the other gives "the angle between p and q".
    Secondly, atan2 behaves ... oddly sometimes, I can never get straight whether the results are 0 to PI, or -PI/2 to PI/2. So if the angle is 60 degrees, you might get 60, -60, 120, -120, 300, -300 etc depending subtly on what the two points p and q contain, and all in floating point. You get the situation where the result flicks between two wildly different values when you move one of the points by a pixel, and the nature of the flick can change depending on which quarant the points are in. Been there, done that. The dot product method, by contrast, goes smoothly from 0 to PI.
    Someone pass me a saucer of milk.

  • Shooting mouse cursor beyond intended straight line between two points.

    I copied this forum question from Lightroom, and I hope this is ok because I did not know how to express the problem I am experiencing:
    "The photoshop brush tool interprets shift-click as a brush stroke that connects the previous brush mouse-up position with the current mouse-down (the shift-click) as a straight line stroke.
    [My experience is that every so often, maybe every three or four "shift-clicks" to get my mouse to create a straight line to my next placed mouse position, the Mouse goes Wild, and shoots way beyond my intended next position, and depending on how zoomed in on the image i am, I frequently loose my place where I had been working.  It becomes quite frustrating as this is a very frequent occurrence.  I have heard others with this version CS3 as well as CS2 having the same "shooting Cursor" which is accompanied by some cursing of my own.  As said below, Time savings is the reason for this technique.  If this problem has been dealt with already, I am sorry to have clogged up the forum, but please re-direct me with the key words to find that thread.  How do I cause this shooting cursor to stay within my mouse placement?]
    I find this a HUGE time-saver in creating masks as it doesn't require that I have a steady hand. I'm frustrated that LR does not offer the same capability. This feature would complement the auto-mask feature (kinda works). I could create a mask in a fraction of the time if LR included this feature.
    Another irritation of occurrence is when setting lines from the rulers, the image will suddenly zoom in by a small amount.  In other words, there are several areas where the software seems to have a mind of it's own, and behaves in an erratic fashion not at all related to the intended action and result.
    I am operating a Mac 10.5.7
    Model Identifier: MacPro3,1
      Processor Name: Quad-Core Intel Xeon
      Processor Speed: 2.8 GHz
      Number Of Processors: 2
      Total Number Of Cores: 8
      L2 Cache (per processor): 12 MB
      Memory: 2 GB
      Bus Speed: 1.6 GHz
    ATI Radeon HD 2600 XT:
    2x2.8 GHZ Quad-Core Intel Xeon
    2 GB 800 MHz DDR2 FB-DIMM

    Thanks for your quick reply.  I am attaching screen shots of my 
    current mouse setting, and a graphic of how the behavior is 
    demonstrated.  The image is one in which quick mask is being used to 
    create a selection, and I am using the paint brush and find it easier 
    to use the brush with the technique of clicking the brush at one point 
    then holding the shift key while I click the brush at the desired next 
    point which should allow the brush to paint a straight line between 
    the two points.  The technique works for 3 or 4 clicks, when at the 
    next click, it is as if it was just shot clean out of the realm of the 
    desired area.  It is almost funny, except that this is a technique I 
    find most useful and frequently helpful, and is not confined to the 
    paint brush, but the eraser as well.  This does occur also with my 
    computer at work, a pc, and a Microsoft mouse.  I have been using 
    Photoshop for 12 years, and this problem did not start until I started 
    using CS3 extended.  We have upgraded two HP pcs at work to CS4 
    extended, and each uses a different mouse, and both exhibit the same 
    behavior as experienced by other persons working at those stations, 
    and while using Photoshop.
    I do hope you could look into this a bit further, Mark, as my 
    explanation of the problem may not be clearly presented for you to 
    fully understand just what I am experiencing.
    Thank you for your help.
    Fred

  • Suggestion to draw a line between two points...

    I have the XYZ position of 2 points, I would like to draw a line between those points. I have tried with a cylinder and it did not work as I expect...I guess a better method exist in Java3D... Do you have any suggestions??
    thanks
    Pete

    try the LineArray class.

  • 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 ;

  • How can I work out the Total Uptime between two points?

    I need to find the TOTAL uptime between a certain date and now (need to separate for an electricity bill). Can someone help me with a script or something?
    Thanks

    I'm confused as to what you are looking for if uptime is not it. 
    I need to find out how long it has been powered on from the 6th August 2014 to now. Any ideas?
    If the system has been rebooted in that time then you might be able to go back into the log files and as Mark Jalbert wrote look for the times the system was shutdown and then booted and get a rough figure that way. But of course this requires that the log files since August are still available.
    Of course what the system was booted there is no guarantee all external peripherals were also on and when the system was shutdown there is no guarantee that all the peripherals were turned off so at best you are getting a rough estimate.

Maybe you are looking for

  • How do you use a custom login application?

    I have setup a custom Login Application as instructed from the admin guide, but cannot find any instructions on how you then go about using it. Some other posts on here mention customising/linking a page to it based on the user Login.jsp, but they ar

  • My problem is with the the strategies used by Verizon sales representatives in the stores. I believe they are the new "used car" salesmen for the 21st century.

    I am willing to accept my part in being misled by these people on two separate occasions. The first time was when we purchased two smartphones and had another phone on our bill. During the process I asked repeatedly what the monthly bill would be for

  • Enterprise manager in rel (10.1.0.2.0)

    hi I have error in Enterprise manager console. MY database is up and working. when i start (emctl start dbconsole) EM. It's successfully started. But as i open http://localhost:5501/em IT is working but database is not open here! I tried to make it u

  • Database to XI to CRM scenario

    Hi Experts Plz help me out in this scenario....................... Sender side     -> XI    -> CRM database         1) In database if i have updated any of the one available record then how the XI will come to know that i have updated which record. w

  • RMAN Datafile updates

    Hi, on the target database side i added one tablespace and one user is assigned to that tablespace and he created some objects and inserted some data. now, i already taken the backup of the database except this tablespace. so now i want to take this