How to find nearest point on polyline

Hi,
I have to find the nearest point to my standing point on a polyline. I have Oracle Locator installed, but my data is not in a locator format. Is it possible to do this by using Locator's functionality by for example puting the polyline and standing point coordinate values into a spatial type variable and calling some locator functionality?
Or I have to coordinate data into a "spatial enabled" table, create spatial index etc and then call some Locator procedure.
Tamas

Luc,
Thanks for the reference.
When the data is converted, finding the nearest vertex in an sdo_geometry object could be done this way (of, of course, many):
select f.vertex_id,f.dist,f.min_dist,f.a_vertex
  from (select p.vertex_id,
               sdo_geom.sdo_distance(p.the_point,p.a_vertex,0.005) as dist,
               min(sdo_geom.sdo_distance(p.the_point,p.a_vertex,0.005)) over (order by sdo_geom.sdo_distance(p.the_point,p.a_vertex,0.005) asc) as min_dist,
               p.the_point,
               p.a_vertex
          from (select t.id as vertex_id,
                       mdsys.sdo_geometry(2001,NULL,mdsys.sdo_point_type(358615,5407047,null),null,null) as the_point,
                       mdsys.sdo_geometry(2001,NULL,mdsys.sdo_point_type(t.x,t.y,t.z),null,null) as a_vertex
                  from table(sdo_util.getVertices(
                            MDSYS.SDO_GEOMETRY(2002,null,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(362253.9,5409676.63,355608.12,5407615.16,358063.37,5407673.48,355276.53,5407361.08,360471.08,5408880.79,362483.4,5406024.69,362359.16,5408840.11,354570.21,5406219.18,360204.62,5405849.14,359214.51,5408283.5,358761.06,5406683.88,356739.05,5405590.46,358615.79,5407047.29,355978.02,5407326.33,356240.87,5409898.7,363159.35,5405510.46,358588.81,5406536.54,354822.42,5408643.75,357690.2,5408872.57,359839.29,5407253.86,355236.29,5409711.53,355342.54,5407448.87,360290.53,5405111.51,354677.02,5407916.83,361651.27,5409178.26,361730.18,5407553.5,357402.33,5409065.5,361546.51,5407278.41,361915.65,5408942.57,361974.74,5405464.91,357794.3,5406979.33,356106.58,5405481.32,357604.96,5407407.72,360718.31,5406765.8,359745.49,5406568.16,363005.29,5407557.46,355844.01,5407095.47,362749.66,5405041.82,359714.13,5408898.69,354509.69,5406113.6,360041.59,5406204.24,360380.17,5408751.21,356621.4,5409603.06,355156.27,5405401.98,354441.35,5409090.68,356376.45,5407472.81,363877.1,5405582.72,361883.83,5409696.17,356363.41,5406434.53,362078.96,5406617.37,362714.59,5409800.2,362703.49,5408513.33,358317.64,5408170.64,359294.27,5409197.53,360240.93,5406333.84))
                            )) t
                ) p
        ) f
  where f.dist = f.min_dist;Hope this helps.
Simon

Similar Messages

  • How to find a point lies inside circle

    Hi,
    How do I find a point (x,y) is lies inside a circle? I trying to do a small shooting game.
    If the user clicks inside the circle they get a point. I am using the Pythagoras theorem to achieve this. But I can't.
    Please advice me.
    Here is my code
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Shoot extends JFrame implements MouseListener, MouseMotionListener
        private int winWidth = 300;
        private int winHeight = 300;
        private MyCanvas canvas = null;
        private int ballX = 50;
        private int ballY = 50;
        private int ballW = 50;
        private int ballH = 50;
        private int ballR = ballW / 2;
        private int curX = 0;
        private int curY = 0;
        private int left = 0;
        private int top = 0;
        public Shoot()
            Cursor c = new Cursor(Cursor.CROSSHAIR_CURSOR);
            this.setCursor(c);
            canvas = new MyCanvas();
            packIt();
            left = getInsets().left;
            top = getInsets().top;
        private void packIt()
            setTitle("My first game!");
            setPreferredSize(new Dimension(winWidth, winHeight));
            setSize(new Dimension(winWidth, winHeight));
            setContentPane(canvas);
            addMouseListener(this);
            addMouseMotionListener(this);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //setUndecorated(true);
            setLocation(300, 0);
            setVisible(true);
        public void mouseClicked(MouseEvent e)
            int x = e.getX() - left - ballX;
            int y = e.getY() - top - ballY;
            int r = ballR;
            System.out.println("x :" + x + "\ty :" + y);
            //Trying to implememt Pythagoras theorem. But I am missing something.
            System.out.println(((x * x) + (y * y)) + "\t=\t" + (r * r));
            System.out.println();
        public void mousePressed(MouseEvent e)
        public void mouseReleased(MouseEvent e)
        public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
        public void mouseDragged(MouseEvent e)
        public void mouseMoved(MouseEvent e)
            curX = e.getX() - left;
            curY = e.getY() - top;
            canvas.repaint();
        private class MyCanvas extends JPanel
            public MyCanvas()
                setBackground(Color.BLACK);
                setBorder(BorderFactory.createLineBorder(Color.yellow));
            public void paintComponent(Graphics g)
                super.paintComponent(g);
                g.setColor(Color.WHITE);
                g.drawString("x :" + curX, 10, 20);
                g.drawString("y :" + curY, 10, 30);
                g.setColor(Color.RED);
                g.fillOval(ballX, ballY, ballW, ballH);
        public static void main(String[] asd)
            new Shoot();
    }

    public boolean isPointInCircle(){
        double x= circle.getWidth/2.0+circle.getX();
        double y= circle.getHeight/2.0+circle.getY();
        double distance=getDistance(x,y,pointX,PointY);
        return (distance<= circle.getWidth/2.0); //if the distance from the point to the center of the circle is less than the radius of the circle return true
    double getDistance(double x1, double y1, double x2, double y2){
        return math.sqrt((x1-x2)(x1-x2) + (y1-y2)(y1-y2));
    }Edited by: ghostbust555 on Jan 23, 2011 3:20 PM

  • How to find intersection point between a lineseries and a vertical line.

    I have a lineseries chart (refer the screenshot). As I move the spend slider shown in the attachment, a vertical line is drawn in the chart. (I did this using the cartesian canvas as annotation element - using canvas.moveTo(), canvas.lineTo() functions)
    I want to find out the intersection point(y value) where the vertical line meets the lineseries. Can someone help me on this. It will be really helpful.
    Thanks,
    Jayakrishnan

    Here are a few functions I wrote years ago for common chart transformations... the function you're going to focus on for your solution is chartToScreen...
    *  Converts the screen position to chart value position
    *  @param thePos - Number - The position you want to convert
    *  @private
            private function getChartCoordinates(thePos:Point):Object
                   var tmpArray:Array = dataTransform.invertTransform(thePos.x, thePos.y);
                   return {x:tmpArray[0], y:tmpArray[1]};
    *  Takes a non-numeric chart value and returns a proper numeric value
    *  @param inValue - String - The display name of the instance showing on the axis (eg. if we're showing months, it might be 'Sep - 06'
    *  @param theAxis - IAxis - The axis on which we're looking
              public function getNumericChartValue(inValue:String, theAxis:IAxis):Object
                   var axisCache:Array = new Array({inValue: inValue})                 
                   if(!(theAxis is LinearAxis))
                        theAxis.mapCache(axisCache, "inValue", "outValue", true);
                        return {numericValue: axisCache[0].outValue}
                   else
                        return {numericValue: Number(inValue)};
    *  Converts the chart values into screen coordinate values
    *  @param chartX - Number - The display name of the instance showing on the axis (eg. if we're showing months, it might be 'Sep - 06'
    *  @param chartY - Number - The axis on which we're looking
              public function chartToScreen(chartX:Number, chartY:Number, theSeries:Series):Point
                   var tmpCache:Array = new Array({chartX:chartX, chartY:chartY});
                   if(theSeries)
                        theSeries.dataTransform.transformCache(tmpCache, "chartX", "screenX", "chartY", "screenY");
                   else
                        dataTransform.transformCache(tmpCache, "chartX", "screenX", "chartY", "screenY");
                   return new Point(Math.round(tmpCache[0].screenX), Math.round(tmpCache[0].screenY));
    *  takes a point in mouse position, and runs it through converting to chart coordinates, converts chart coordinate to numeric value if needed
    *  and then back into mouse position to get the nearest axis snap point
    *  @param thePoint - Point - The position we're converting
    *  @private
              private function getSnapPosition(thePoint:Point):Point
                   var chartPoint:Object = getChartCoordinates(new Point(thePoint.x, thePoint.y));
                   //if either of the axis chart results is not in numeric format, we get the numeric equivalent of it
                   var chartX:* = chartPoint.x;
                   var chartY:* = chartPoint.y;
                   chartX = getNumericChartValue(chartPoint.x, CartesianChart(this.chart).horizontalAxis).numericValue;
                   chartY = getNumericChartValue(chartPoint.y, CartesianChart(this.chart).verticalAxis).numericValue;
                   return chartToScreen(chartX, chartY, null);

  • How to find inflection point in graph when dx is very small

    Hello,
    I'm trying to sort through position data from a feedback pot to calculate linearity of movement as part of a testing procedure. An image of the data is attached. I want to delete all data in the 'flat' part, in order to do a linear fit and R^2 of the sloped line.
    This is made trickier by the fact that the number of samples, the start and end points, and slope of the line can all vary considerably. Therefore I need some way to find the 'knee' in the graph and remove all subsequent samples from the data. 
    The most obvious method I tried was to use a derivative to find the inflection point, but since I have so many data points, the dx is very small
    (~0.05) when using the built-in labview derivatives. This means that I can't distinguish the inflection point from any other change in the values due to noise or change in velocity. I made my own derivative function, which was a newton quotient that looked at (xi+N)-(xi-N) instead of (xi+1) - (xi-1), but this still did not give good results. My next idea is to just look at the difference of every N points, and arbitrarily decide a threshold to indicate when it has levelled off. Any other ideas would be really helpful though.
    Thanks,
    -SK-
    Attachments:
    position.PNG ‏17 KB

    Lets see if I can answer without having to write a book.
    Fisrt I'd run the data through a zero-phase shift low pass filter. Then look at the 2nd derivative to find the knee. Using a zero-pahse shift fileter I was able to detect when a value was jumping up when it started to jump rather than after. THis thread may be interesting.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to find the points that define an edge?

    I'm looking at a very large geometry that's generating an error from VALIDATE_GEOMETRY_WITH_CONTEXT:
    ORA-13349: polygon boundary crosses itself 13349 [Element <5>] [Ring <1>][Edge <7566>][Edge <7591>]
    How can I find the X & Y coordinates of those two edges?
    It's a two-dimensional polygon, with thirty two inner rings, and extracting ring 5 doesn't show any obvious errors: It doesn't have seven thousand edges to it either though - is that supposed to be the edge number counting from the start of the outer ring, or just the start of that element?
    Cheers
    Simon Anderson
    Scisys

    Hi,
    What I'm looking for is a way to report the error back to the end-user. The information is there in the form of:
    [Element <5>] [Ring <1>][Edge <7566>][Edge <7591>]
    But the exact position of the error is often hard to find in a CAD system.
    I want to return edge 7566 and edge 7591 as geometry objects.
    So the question is:
    Given a geometry object and a list of element,ring,edge elements. How to create geometry objects for these edges?
    Rene

  • How to find enhancement point or enhancement section

    Hi,
                        If anybody is trying to make changes to the approved sale order it shows a message
                        "SALE ORDER APPROVED BY xx CHANGES NOT POSSIBLE".
                        i want to know where excatly the enhacement code is written.
    Thanks & Regards,
    vijay karri.
    Edited by: vijaykarri on Jul 8, 2010 11:39 AM

    Hi ,
    Please find in the Source code using Search Option with the Message String  Or Using the Message No and Whereused List .
    Regards,
    Kishore.S

  • How to find out the calling point of a Badi

    Hi Experts,
    Say one Badi is getting called in a particular screen of a transaction.
    Can anyone please guide me how to find out the calling point for that Badi.
    I checked for transaction CC31 screen 2000, method IF_EX_ECM_EXIT~OMR_CHECK_01
    is getting called.
    But I could not find the calling point.
    Please help.
    Thanks,
    Sonali.

    Go in to the perticular method, and click on where used list.That may help.
    Or get into the method in debugging, and press F7. That will take you to the calling point.

  • HT1199 My iTunes music list all have the exclamation point.  I do not know how to find the files to restore the music.  Any advice?

    All the songs in my iTunes have the exclamation point.  I do not know how to find location of the music...any suggestions?

    Ok, your music could be in one of a coupel formats, MP3 or, more likely, Apples AAC format, which has a m4a prefix.  Open Finder.  Hold Command and press F, this will open a search window in the top of Finder.  Type mp3 here, let it search.  If it finds your music files, double tap on one and "open Enclosing Folder"  That should show you where they are at.  If nothing is found, try searching m4a instead.  One of the two should show you where your music is.

  • How to find that 2 references are pointing to same obejct??

    how to find that 2 references are pointing to same obejct??
    i feel that hashCode and equals will not work as far as i understood from javadoc

    I wnat to know above because i want to check if ps in
    this loop is same object or on each iteration new
    object is created
    for (int i = 0; i < 10 ;i ++)
    PreparedStatement ps = con.prepareStatement(sql);
    ps.setInt(1,i);
    ps.executeUpdate();}
    Here's a better question. Why in the world did you put that statement in the loop in the first place, unless the variable 'sql' is modified within?

  • How to find geometry that have intersection with polyline?

    Hello,
    How to find geometry that have intersiction with polyline?
    I hava a lot of polygon, i want to find wich of polygon have intersection with polyline.
    What shall i do to find out this?
    Regatd,
    Thank's

    is that correct when i use such query?
    SELECT
    FROM aaa c
    WHERE SDO_RELATE(c.geometry,
    SDO_GEOMETRY(2002, 1, NULL,
    SDO_ELEM_INFO_ARRAY(1,2,1),
    SDO_ORDINATE_ARRAY(0,0,12,12,25,25)),
    'mask=anyinteract') = 'TRUE'
    Thanks

  • How to find the nearlest value in 1-D array ?

    Hi.. everybody..
    I need to seperate the raw data(1-D) into 2 group of array by the center value and then make the average value in each array. But I also still have the problem about if the center value is not the same of some value in the 1-D array. I cannot use the split function.
    "How to find the nearlest value to the center point that I calculated, in the 1-D array ?"
    Thanks a lot for anybody help

    In a general sense, since I'm not sure what your data values are or how far away your calculated center is from the true value, I would do it one of two ways:
    1) Use a threshold value and scan the array until the threshold is reached (assumes constantly increasing values in the array).
    2) Use either a) round to nearest integer b) round to + Infinity (round up) or c) round to - infinity (round down). If you don't have decimal values, you'll have to devide the values by a power of 10.
    2006 Ultimate LabVIEW G-eek.

  • Nearest Point of Interest

    My Oracle Version: 8.1.6
    OS: Sun Solaris
    In spatial examples (http://otn.oracle.com/sample_code/products/spatial/sample_code_index.htm), we are dealing with only porsche dealer's spatial data and the query bellow will give us two lucky porsche dealers.
    select a.id, b.geo_address.firmname, b.geo_address.addrline, b.geo_address.lastline, a.phone, a.fax,
    b.location.sdo_point.x, b.location.sdo_point.y from
    porsche_dealer a, porsche_spatial b where
    a.id=b.id and
    mdsys.locator_within_distance(b.location, mdsys.sdo_geometry(2001, NULL,
    mdsys.sdo_point_type(x,y,NULL), NULL,
    NULL), 'sdo_num_res=2 LAYER_GTYPE=POINT') = 'TRUE';
    Unfortunately, I have Dealer Spatial information in a single table where all the dealers are differentiated by a column say dealer_make and it contains values like 'HONDA' , 'PORSCHE' etc.
    Now my question is how do I find nearest Honda dealer or nearest PORSCHE Dealer?
    Above query will not work if I am near the porsche dealership and ask for a nearest Honda dealership.
    Is there any other way to find a certain number of nearest Honda dealers? I can not use SDO_WITHIN_DISTANCE query because I have no idea where the dealership is so that I can give distance?
    Any Ideas
    I really appreciate your help!
    Arun.
    null

    Hi Arun,
    You have a caught on to a significant gotcha in 8.1.6 regarding nearest neighbor - enough people have had the same issue that in 9i you'll be able to do the query simply and elegantly. In 8.1.6 it is a little less elegant.
    Basically what you need to do is kick the sdo_num_res value up, and add a predicate as something like "where dealer_make='PORSCHE'" to the query.
    Also, why have a separate address table? You should have all of the data in the same table to get the maximum benefit from Oracle and Oracle spatial.
    select id, geo_address.firmname,
    geo_address.addrline, geo_address.lastline,
    phone, fax, a.location.sdo_point.x,
    a.location.sdo_point.y
    from all_dealers a
    where mdsys.locator_within_distance (a.location, mdsys.sdo_geometry(2001, NULL,
    mdsys.sdo_point_type(x,y,NULL),NULL,NULL),
    'sdo_num_res=X LAYER_GTYPE=POINT') =
    'TRUE'
    and dealer_make = 'PORSCHE';
    Note that I put sdo_num_res=X - the X is dependent on what you think the percentage of dealers is that deals in PORSCHE automobiles - if 2 % of dealers are PORSCHE dealers and you want to see 2 in the final answer, then sdo_num_res should probably be something over 100. Note this won't guarantee you will always see two porsche dealres, but it does make it likely.
    As I said earlier, in 9i this gets easier (and faster).
    hope this helps,
    dan

  • How to find out FICO user exits that are used by User

    How to find out the FICO user exits that are used by user.

    Go to tcode CMOD. In the project field drop down your list there. Put a Z* there and run the list. These should be all the exits that are activated. Search for the ones that pertain to FI. You can also search by development class. You need a little ABAP knowledge to search easily. You get this by going to the tcode then to status then to the program then to the attributes. There you find the development class. Ie FBAS.
    pls assign points if helpful as a way to say thanks.

  • How to find port number of message server

    Hi All,
       Is anyone there who could tell me how to find out port number of message server (Message Port)?  I am defining new system in my SLD so I need port number of message server of the system that I am connecting to. Thanks in advance.
       Best regards

    Hi,
    Go to the index page of the url,
    type http://hostname:http port in Internet browser.
    for ex : if installation is done on system with IP 172.16.28.90
    and your http port is 50000(depends on Central instance number,JCxx)
    then type http://172.16.28.90:50000.
    1.then go to system information tab in index page.
    for the credentials asked,type,
    user:administrator
    password:master password given during installation.
    then system information page opens,in the left corner top,you can find message server port.
    reward points if helpful.........

  • How to find PO number from ORDRSP Idoc.

    Hi,
    Can  anybody let me know how to find the PO number from the Idoc ORDRSP.
    Scenario is as below:
    SAP system1 will send PO to SAP system2.(Idoc type ORDRS05).
    When SO is created in SAP system2, it will send a confirmatory Idoc of message type ORDRSP.
    From this I have to find  the PO number as I can find only VBLNR.
    Points assured for workful solutions.
    -B S B

    Hi BSB,
    CHECK THIS CODE
    DATA : BEGIN OF itab_status OCCURS 0,
              idoc           LIKE edids-docnum,
              date_stauus    LIKE edids-logdat,
              status_counter LIKE edids-countr,
              status         LIKE edids-status,
              descrp(70),
              ponumber       LIKE ekpo-ebeln,
              mess           LIKE edidc-mestyp,
    END OF itab_status.
    DATA: text111        LIKE e1mbxyi.
    DATA: text11         LIKE e1edp02.
    IF itab_status-MESS = 'WMMBXY'.
       select single * from edid4  INTO ITAB where segnam = 'E1MBXYI' AND
                     HLEVEL = '02' AND DOCNUM = itab_status-idoc.
    MOVE  : ITAB-SDATA  TO TEXT111 ,
    text111-EBELN TO itab_status-ponumber.
    ELSE.
    YOUR CASE FALLS IN THIS CATEGORY****
    select single * from edid4  INTO ITAB where segnam = 'E1EDP02' AND
                     HLEVEL = '03' AND DOCNUM = itab_status-idoc.
    MOVE  : ITAB-SDATA  TO TEXT11 ,
    text11-BELNR TO itab_status-ponumber.
    ENDIF.
    endif.
    LET ME KNOW IF YOU NEED ANYTHING ELSE.
    THANKS
    VENKI

Maybe you are looking for

  • Commision agent processing

    Hi, Commiison agent processing how to include in sales processing, like due to commision agent we will get orders, in sales order we need to maintain his details, later do the payment to him as commision.

  • From Transaction FB60 values are not transferred to RFC

    Hi, We are working for integration of R/3 and 3rd Party Tax package. We are trying to pass the values from Trans FB60 & FB70 to the user exit EXIT_SAPLFYTX_USER_001. But it is not capturing after applying the OSS note 575644. Your help is appreciated

  • User Defined Exceptions in Web Service

    I am trying to create complex user defined exceptions in Web services I am creating. Is there a way in JDeveloper to assist in modifying the WSDL to include all required parameters for fault handling that I can use to do this? Or do I have to write t

  • Starting the iplanet web server 6.0

    I have downloaded the iWS6.0 I also installed it on Windows 2000 professional. I have also installed the J2sdk1.4.0_01, Jsdk2.1 on my pc. I have set the environment variables like: path = C:\j2sdk1.4.0_01\jre\bin\server\jvm.dll;c:\j2sdk1.4.0_01\bin;c

  • Issue related to the VF44

    Hi, I am not able to get the document in VF44 for doing the Revenue Recognition. Scenario is that,We have billing plan of 60 L in our contract and we have already done RR for 40L.Now we want to do RR for another 10L.For that I have completed the all