Extracting ordinates

Can anyone tell me if it is possible to extract the X + Y values from an SDO_GEOMETRY in a form that allows one record per pair of ordinates?
I have two queries that I would like to combine in order to return the following example record set...
ID X Y
a 1 1
a 2 1
a 2 2
a 1 2
This query lets me extract the object id a...
select A.ID
from MPCOAST A
where sdo_relate(A.SHAPE,
mdsys.sdo_geometry(2003, null, null,
mdsys.sdo_elem_info_array(1, 1003, 3),
mdsys.sdo_ordinate_array(0, 0, 5, 5)),
'mask=anyinteract querytype=window') = 'TRUE';
And this one gets me all ordinates for object a...
select c.id, a.column_value ord
from mpcoast c, TABLE(c.shape.SDO_ORDINATES) a
where c.id = 'a';
My problem is that the second query returns one record per ordinate not pair of.
I would like each record to contain both X and Y ordinates for each point in each object.
Any help would be helpful.
BTW: Why os the spatial documentation so difficult to comprehend? Thank goodness for this forum!

This works with my data. It is three-dimensional. So you will have to adjust for two-dimensionsal.
set serveroutput on
SET serveroutput on SIZE 1000000
set concat on
DEFINE layername = 'CO19_LRS';
DEFINE geomcolname = 'GEOM';
DECLARE
id varchar2(10);
longitude number;
latitude number;
logmile number;
i number;
theLayer varchar2(32);
theGeomCol varchar2(32);
BEGIN
FOR rec IN (SELECT ROWID, id, &geomcolname FROM &layername ) LOOP
id := rec.id;
i := 1;
while i < rec.geom.sdo_ordinates.count loop
longitude:=rec.geom.sdo_ordinates(i);
latitude:=rec.geom.sdo_ordinates(i+1);
logmile:=rec.geom.sdo_ordinates(i+2);
dbms_output.put_line(id &#0124; &#0124; ',' &#0124; &#0124; longitude &#0124; &#0124; ',' &#0124; &#0124; latitude &#0124; &#0124; ',' &#0124; &#0124; logmile);
i := i + 3;
end loop;
END LOOP;
commit;
END;
Dave

Similar Messages

  • Extracting x,y co-ordinates of SDO_GEOMETRY into two variables say x1, ya

    Hi All,
    I am able to store the output SDO_GEOMETRY into a variable but i am facing difficulties in extracting ordinates in sdo_geometry to two independent variables say xa, ya. Kindly suggest some solution.
    The procedure is as follows:
    CREATE OR REPLACE PROCEDURE fnd_2nd_Point
    (Input_Fiber_Id IN NUMBER,
    xa IN FLOAT,
    ya IN FLOAT,
    Length_Fiber IN FLOAT,
    Result OUT VARCHAR,
    xCordInAte OUT FLOAT,
    yCordInAte OUT FLOAT)
    IS
    ProjPoint_a mdsys.sDo_Geometry := NULL;
    v_Point_xa FLOAT := NULL;
    v_Point_ya FLOAT := NULL;
    BEGIN
    SELECT sDo_lrs.Project_pt(a.Shape,m.DimInfo,mdsys.Sdo_geometry(2001,8307,NULL,mdsys.Sdo_elem_info_array(1,1,1),
    mdsys.Sdo_ordinate_array(xa,ya,Length_Fiber)))
    INTO {color:#0000ff}ProjPoint_a
    {color}FROM lrs_Access_Fiber a,
    User_sDo_geom_MetAdAta m
    WHERE m.Table_Name = 'LRS_ACCESS_FIBER'
    AND m.Column_Name = 'SHAPE'
    AND a.Unique_Id = Input_Fiber_Id;
    {color:#0000ff}-- SELECT t.x, t.y INTO v_Point_xa, v_Point_ya FROM TABLE(sDo_util.Getvertices(ProjPoint_a)) t;
    {color}
    {color:#0000ff}-- dbms_Output.Put_Line('Point Xa is ' ||v_Point_xa||' and point Ya is '||v_Point_ya);
    {color}
    {color:#0000ff}-- xCordInAte := v_Point_xa;
    {color}
    {color:#0000ff}-- yCordInAte := v_Point_ya;
    {color}
    -- Result := 'success';
    END;
    Kindly advice on the options available to extract the ordinates of sdo_geometry into 2 independent variables.
    Regards,
    Venkat

    Please find the output as below for the following inputs: INPUT_FIBER_ID :=2005; XA := 78.424; YA := 17.643; LENGTH_FIBER :=500;
    Point Xa is 78.48686988 and point Ya is 17.61674904
    RESULT = success
    XCORDINATE = 78.48686988
    YCORDINATE = 17.61674904
    Is this output correct? Actually, I have to integrate this with UMN MapServer. Kindly advice
    Regards
    Venkat

  • Having trouble with extracting Spatial ordinates

    Hi all,
    I have read the prior thread on extracting ordinates out of an array and have tested all of the responses made
    The following SQL is an adaptation of one of the responses
    =====
    select a.shipment_from.sdo_ordinates
    from t4_shipments_points a
    where a.shipment_isn = 2;
    =====
    But this is the output response I am getting
    ORA-00932: Inconsistent Datatypes
    Any help appreciated on what I am doing wrong or what needs doing.
    TIA
    Brent Glover

    Hi Brent,
    Usually when I see this error it means I am using svrmgrl instead of sqlplus.
    Could this be your problem also?
    Hope this helps and regards,
    Dan

  • Find X,Y coordinates

    I am looking to find the centroid and display the x,y coordinates of all the polygons in my parcel file. Can someone help me on what this query will look like 8.1.7.
    Matt

    Hello Matt,
    That question has been asked previously. Have a look at Andy Dix "Extracting ordinates" posted April 23, 2001
    Extracting ordinates
    where the reply by Indrek Toom might be what you want in 8.1.7.
    Also keep an eye on Peter Hubers "Access to items of an SDO_ORDINATE_ARRAY" posted March 11, 2003 here:
    Access to items of an SDO_ORDINATE_ARRAY
    giving a 9.2 solution
    - hope this helps,
    Jens Ole Jensen
    Kort & MatrikelStyrelsen (WWW: http://www.kms.dk)
    Danmark

  • How to extract every component in an array?

    Hello everyone!
    Do you know how to extract every component from an array field?
    For example:
    The following is the defination of a table:
    CREATE TABLE test (
    id NUMBER PRIMARY KEY,
    name VARCHAR2(32),
    shape MDSYS.SDO_GEOMETRY
    And then I insert a new record:
    INSERT INTO test VALUES(
    1,'first',
    MDSYS.SDO_GEOMETRY(
    2003,
    NULL,
    NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
    MDSYS.SDO_ORDINATE_ARRAY(1,1, 5,7)
    The Question is I want to read the every component (for example 1,1,5,7) in the sdo_ordinate_array one by one. Who knows how to write the SQL?
    I have tried "select a.shape.sdo_ordinates(1) from test a". But it can't work.
    Thank you very much!

    One solution is to read each ordinate from a cursor ina SQL block. Here is an example:
    set serveroutput on
    SET serveroutput on SIZE 1000000
    set concat on
    DEFINE layername = 'LAYER';
    DEFINE geomcolname = 'GEOM';
    DECLARE
    id varchar2(10);
    longitude number;
    latitude number;
    logmile number;
    i number;
    theLayer varchar2(32);
    theGeomCol varchar2(32);
    BEGIN
    FOR rec IN (SELECT ROWID, id, &geomcolname FROM &layername ) LOOP
    id := rec.id;
    i := 1;
    while i < rec.geom.sdo_ordinates.count loop
    longitude:=rec.geom.sdo_ordinates(i);
    latitude:=rec.geom.sdo_ordinates(i+1);
    logmile:=rec.geom.sdo_ordinates(i+2);
    dbms_output.put_line(id || ',' || longitude || ',' || latitude || ',' || logmile);
    i := i + 3;
    end loop;
    END LOOP;
    commit;
    END;
    Maybe that will help.
    Dave
    David R. Miller
    Michael Baker Jr., Inc.
    3601 Eisenhower Avenue
    Alexandria, VA 22314
    [email protected]
    www.mbakercorp.com

  • How to create Purchase Order using  sub-ordinate Purchase order number?

    Hi,
    I m in ETL product have to extract SAP datas into Access.
    I noticed that in the Demo DataBase of OEC Computers,the Purchase Order is created with sub-ordinate purchase order number.But i am trying to create the same in SAP B1 manually,but i can't create child Purchase Order .
    <b>How to create child Purchase Order?</b>
    Please help me to create the same
    regards
    Sooriyakala.P

    Hi,
    I m in ETL product have to extract SAP datas into Access.
    I noticed that in the Demo DataBase of OEC Computers,the Purchase Order is created with sub-ordinate purchase order number.But i am trying to create the same in SAP B1 manually,but i can't create child Purchase Order .
    <b>How to create child Purchase Order?</b>
    Please help me to create the same
    regards
    Sooriyakala.P

  • How to Extract Paragraph from Pdf using Adobe Pdf Library in C# or Java

    By Using This library I extracted Content of Pdf File.
    I got Content Line by Line(by using Last wordOnline )
    <Line> Content </Line>
    But I want to Extract Content Paragraph by Paragraph Like
    <Paragrph> Content </paragraph>

    Thanks for reply.
    Here I have used "Y" co -ordinate of line to find paragraph.But I can not get expected Output.
    Can you please explain me the logic of Find paragraph usnig Co-ordinates.?
    Here I am pasting my Code.
                    double PreY2=0;
                    double   Result2=0;
                    foreach (DataRow oRow in dtLineMaster.Rows)
                              double Result1 = Math.Round(PreY2 - Convert.ToDouble(oRow["Y2"].ToString()));
                         if (Result1 > Result2)
                            MessageBox.Show("" + oRow["LineText"].ToString());
                            Result2 = Result1;
                    PreY2 = Convert.ToDouble(oRow["Y2"].ToString());
    I have already extracted Pdf file in databse with lineId and X and Y co-ordinates.On this I am  implementing above code.

  • How to extract the number from image using java

    Hello every one
    i want to develope a project which can extract the number from image
    that i can use as inter or String or char.
    Is there any API in java which provide this type of facility.
    right now i m using java 5
    thanks in Advance
    Jignesh

    In my project i have a image in that i have a
    co-ordinate (x,y) I am still puzzled as to what you seek. It sounds to me like you have a point (x, y) represented by p. in java it's just p.getX() p.getY()
    i want to convert that cordinate to numeric form,
    i mena i want to use that cordinate in somewhere else
    in project.point.getX() point.getY()
    So need to convert it into numeric form u can called
    it OCR also.OCR is optical character recognition. If I want out and took a picture of the US Declaration of Independence and then wanted the words on the parchement in the picture in text form, then I would run the picture through a software program and it would try to optically recognise what lettering and number were present in the picture. In the end, I would have a text of what is written on the US Declaration of Independence.
    Is that what you want?

  • Extract first coordinate

    I have a table with polygon geometries in. I want to extract the first coordinate of all the geometries. I can get them all using GETVERTICES but I only want the first one.
    Any help gratefully received.
    Ivan

    Hi Ivan,
    I use following function:
    FUNCTION FNC_GET_POINT_2D (
         P_GEOM MDSYS.SDO_GEOMETRY
              ,P_POINT_NR PLS_INTEGER DEFAULT 1 -- which point?
              ) RETURN MDSYS.SDO_GEOMETRY
         IS
         lg_geom MDSYS.SDO_GEOMETRY; -- geometry
         ln_dim PLS_INTEGER; -- dimensions
         ln_p PLS_INTEGER; -- index (for array)
         px NUMBER;
         py NUMBER;     
         BEGIN
         -- Number of dimensions
         ln_dim := SUBSTR(P_GEOM.SDO_GTYPE,1,1);
    -- exists the point?
         IF P_POINT_NR < 1 OR P_POINT_NR > P_GEOM.SDO_ORDINATES.COUNT()/ln_dim THEN
         RETURN NULL;
         END IF;
         -- index in the ordinate array
         ln_p := (P_POINT_NR-1)*ln_dim+1;
         -- extract the x and y values
         px := P_GEOM.SDO_ORDINATES(ln_p);
         py := P_GEOM.SDO_ORDINATES(ln_p+1);     
         --return the point...
         RETURN MDSYS.SDO_GEOMETRY(
         2001,
              P_GEOM.SDO_SRID,
              MDSYS.SDO_POINT_TYPE(px,py,NULL),
              NULL,NULL);
         END FNC_GET_POINT_2D
    then:
    SELECT
    FNC_GET_POINT_2D(A.GEOMETRY,1).SDO_POINT.X,
    FNC_GET_POINT_2D(A.GEOMETRY,1).SDO_POINT.Y,
    FNC_GET_POINT_2D(A.GEOMETRY,1).SDO_POINT.Z
    FROM
    <TABLE> A
    returns x,y,z... (first point)
    Hope that helps...

  • Convert an autocad file to co-ordinates

    Hi,
    How to convert an autocad dwg or dxf file to txt file containing co-ordinates, using labview.
    Regards,
    Giridhar Rajan
    Automation Engineer, Design
    Cruiser Controls
    Mumbai, India

    Hello,
    I think you have a couple options – neither of which is
    likely to be easy.  One option is to find
    some other program which does that for you (you mention needing to use LabVIEW,
    but you might be able to call a third party program to do it for you).  Another option is to see if autocad has an
    automation server and make calls to autocad to extract each object’s coordinates
    and write those to file (you’ll have to check up on the documentation of
    autocad about this).  The other option is
    to convert the files to some sort of image file using non-NI software (such as
    autocad or a conversion program) and use the image VIs
    to discover where various objects are and convert those.  This will likely not be easy either though….  I think your best bet is going to be finding
    some way to make calls to autocad to get the coordinates of all the objects in
    the file using ActiveX (if it is capable of that).
    Sorry I don’t have more info for you – best of luck though!
    Travis M
    LabVIEW R&D
    National Instruments

  • Getting individual co-ordinates

    I have a polyline object stored as a geometry in each row of a table. I want to create a table of all the nodes of all the polylines within this table. Currently I fetch each record, check the number of nodes in the object and then extract each node and add one record at a time in the co-ordinates table.
    Is there any way of doing this in a single query? The number of co-ordinates for individual polylines is not fixed.
    Any thoughts?
    TIA

    Thanks people, I have solved my problem myself, this is what I did.
    REATE TYPE SP_NODE_TYPE AS OBJECT
    (id NUMBER,
    x NUMBER,
    y NUMBER);
    CREATE TYPE SP_NODE_SET_TYPE as TABLE OF SP_NODE_TYPE;
    CREATE OR REPLACE Function GetCoordinates(polyline IN MDSYS.SDO_GEOMETRY) RETURN SP_NODE_SET_TYPE
    PIPELINED
    AS
    ordCount NUMBER;
    ordNumber NUMBER;
    BEGIN
    ordCount := nvl(polyline.sdo_ordinates.COUNT,0);
    if (ordCount > 4) then
    ordNumber := 2;
    for idx in 3..(ordCount - 2) loop
    if ((idx Mod 2) = 1) then
    PIPE ROW (SP_NODE_TYPE(ordNumber, polyline.sdo_ordinates(idx), polyline.sdo_ordinates(idx + 1)));
    ordNumber := ordNumber + 1;
    end if;
    end loop;
    end if;
    RETURN;
    END;
    don't bother about the logic, in my case, I only wanted the intermediate points not the start and end point.
    After this a query like :
    SELECT mylines.id, myvertices.X, myvertices.Y, myvertices.id
    FROM mylines,
    TABLE(getcoordinates(e.geoloc)) myvertices ORDER BY e.id, myvertices.id;
    does the trick for me!!
    'PIPE' and 'PIPELINE' is something new which I learned from this experience.
    --A Happy Plumber.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Extracting Coordinates for Line String Element

    Hello
    How do I extract Line String coordinates? I am using Oracle 9i version having locator features and using JAVA Program. Could you please help me to get the co-ordinates by using query.
    Thanks in Advance
    Senthil

    e.carano wrote:
    I'm a beginner in using LabVIEW with datafile.
    If you want code, you need to tell us your LabVIEW version.
    If you have a recent version, you can use a conditional tunnel to simplify the code even more. (see attached 2014 version).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FilterColumns.png ‏19 KB
    FilterColumns.vi ‏10 KB

  • How to extract Cleared and Open Items from SAP R/3?

    Hi experts,
    I have a requirement from user to extract cleared and open invoice items from SAP R/3.
    Can someone tell me how to do that?
    Thanks!

    Hi,
    Use the Data source 0FI_AR_4 to Know the status (0FI_DOCSTAT) of payment to be done by customer.
    OR
    Enhance the 2LIS_13_VDITM with VBUP fields which will give the status of Billing.
    With rgds,
    Anil Kumar Sharma .P

  • Extraction and loading of Training and Event Management data (0HR_PE_1)

    hello,
    I've got the following doubt:
    before BI 7.0 release, extractor 0HR_PE_1 extracts event data (eventid, attendee id, calday,...) but if you load straight to cube 0PE_C01, as Calendar year/month needs a reference date (for example, event start date), you'll get total duration of event in hours or days refered to event star date.
    So in a query filtered by month, you get total duration of an event that starts in the filtered month but it couldn`t end until few months later o year later, so you don´t get appropiate information.
    Example:
    Event          calday        Hours
    10004377  20081120   500        but from event_attr event end date is 20090410.
    In a query filtered by 200811 you get total duration time (500 hours when in 200811 event hours have been 20) or if you filter by any month of 2009 you don´t get information of duration of that event.
    I had to create a copy of standar cube (without calday, only Calendar year/month, Calendar year in time dimension) and disaggrate data creating as many entries for an event as months lasts and adjust calculation of ratios duration of event (duration of event in each month/ total duration of event).
    The question is: Is there any improvement or change on business content in BI 7.0 to treat Training and Event Management data? Has anybody had to deal with that?
    Thank you very much.
    IRB

    Hi,
    TEM data is stored in HRP tables.
    You can load the catalog by creating LSMWs for objects Business event group (L), Business event types (D), Locations (F), Organizers (U) as per requirement.
    LSMW for tcode PP01 can be used to create these objects.
    To create Business Events (E) you can create LSMW for PV10/PV11.
    To book attendee create LSMW for tcode PV08 as here you can specify the actual business event ID which reduces ambiguity.
    tcode PV12 to firmly book events
    tcode PV15 to follow up
    Hope this helps.
    Regards,
    Shreyasi.

  • How to Extract Data for a Maintenance View, Structure and Cluster Table

    I want to develop  3 Reports
    1) in First Report
    it consists only two Fields.
    Table name : V_001_B
    Field Name1: BUKRS
    Table name : V_001_B     
    Field Name2: BUTXT
    V_001_B is a Maintenance View
    For this one I don't Find any Datasource
    For this Maintenance View, How to Extract the Data.
    2)
    For the 2nd Report also it consists Two Fields
    Table name : CSKSZ
    Field Name1: KOSTL (cost center)
    Table name : CSKSZ
    Field Name2: KLTXT (Description)
    CSKSZ is a Structure
    For this one I don't Find any Datasource
    For this Structure How to Extract the Data
    3)
    For the 3rd Report
    in this Report all Fields are belonging to a Table BSEG
    BSEG  is a Cluster Table
    For this one also I can't Find any Datasource,
    I find very Few Objects in the Datasource.
    For this One, How to Extract the Data.
    Please provide me step by step procedure.
    Thanks
    Priya

    Hi sachin,
    I don't get your point can you Explain me Briefly.
    I have two Fields for the 1st Report
    BUKRS
    BUTXT
    In the 2nd Report
    KOSTL
    KLTXT
    If I use  0COSTCENTER_TEXT   Data Source
    I will get KOSTL Field only
    what about KLTXT
    Thanks
    Priya

Maybe you are looking for

  • Single Blue Vertical Line

    Hi, My 92 day old iMac has just developed a thin (1 pixel wide I think) blue line about 3" from the left of the display. It comes and goes and crosses all windows. Has anyone else had a problem like this or have any ideas what's causing it? Cheers Al

  • Problem about OUTPUT

    Hi all, There is a way to call smartform from VF03 with output types. Who can describe me the details about this way? Is there any step by step to realize it? I found there is a output configuration in NACE. Who can give me a overview of it and some

  • Link between MIC and classification system

    Hi All, Any body please suggest the table where is the link between MIC and class characteristic. Regards, Rogério Reis

  • ArrayCollection could not be found.

    hi i have import framework.swc, and mx.swc files in flash but still ArrayCollection class is not found VerifyError: Error #1014: Class mx.collections::ArrayCollection could not be found.

  • Controlling the sequence of Actions in PA 40?

    dear experts, can we control the sequence of actions executed thro PA 40? for example , we have the following sequence actions in a client scenario 1. Hiring ( prioritised as 1) 2.probation( prioritised as 2) 3.confirmation( prioritised as 3) 4.chang