Convert multiline to simple line?

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
We are processing spatial data from another source to display in our GIS environment.
The data is a set of multilines. The gtype is 2006. A typical geometry looks like:
SDO_GTYPE     2006
SDO_SRID      31370
SDO_POINT.X   NULL     
SDO_POINT.Y   NULL
SDO_POINT.Z   NULL
SDO_ELEM_INFO (1,2,1, 7,2,1)
SDO_ORDINATES (105094.84, 195084.96,
               105094.54, 195080.22,
               105094.84, 195084.96,
               105094.84, 195084.96,
               105094.68, 195082.47 )Now, this is not an actual multiline... it's just encoded as a multiline, but if you look at the coordinates you'll see that the end point of the first line is the same as the beginning of the second line (105094.84, 195084.96).
A better way to encode this geometry would be:
SDO_GTYPE     2002 <---
SDO_SRID      31370
SDO_POINT.X   NULL     
SDO_POINT.Y   NULL
SDO_POINT.Z   NULL
SDO_ELEM_INFO (1,2,1)
SDO_ORDINATES (105094.84, 195084.96,
               105094.54, 195080.22,
               105094.84, 195084.96, <---
               105094.68, 195082.47 )Is there a standard function in Oracle that does this conversion for me? Or do I have to write my own :)
Thanks a lot!
Rob

Rob,
Plenty of ways to skin this cat with the standard tools.
with mLine as (
select SDO_GEOMETRY(2006,31370,NULL,
SDO_ELEM_INFO_Array (1,2,1, 7,2,1),
SDO_ORDINATE_ARRAY (105094.84, 195084.96,
               105094.54, 195080.22,
               105094.84, 195084.96,
               105094.84, 195084.96,
               105094.68, 195082.47 )) as geom
from dual
select sdo_util.concat_lines(l1.geom,l2.geom) as line
  from (select sdo_util.extract(geom,1) as geom from mline) l1,
       (select sdo_util.extract(geom,2) as geom from mline) l2
union all
select sdo_geom.sdo_union(geom,geom,0.005) as line
  from mline l
union all
select sdo_util.remove_duplicate_vertices(sdo_geometry(2002,l.geom.sdo_srid,l.geom.sdo_point,SDO_ELEM_INFO_ARRAY(1,2,1),l.geom.sdo_ordinates),0.005) as line
  from mline l;
-- Results
LINE
SDO_GEOMETRY(2002,31370,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(105094.84,195084.96, 105094.54,195080.22, 105094.84,195084.96, 105094.68,195082.47))
SDO_GEOMETRY(2002,31370,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(105094.54,195080.22, 105094.68,195082.47, 105094.84,195084.96))
SDO_GEOMETRY(2002,31370,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(105094.84,195084.96, 105094.54,195080.22, 105094.84,195084.96, 105094.68,195082.47))Note how SDO_UNION reorganizes and cleans up the linestring which you may not want.
regards
Simon

Similar Messages

  • Simple Line Chart - Values over time

    A simple line chart displaying a set of values over time would seem to be a very easy report to design. I'll be darned if I can see how to design it. Can anyone shed some light?
    I have provided links to a report and a spreadsheet which is the report datasource. My actual report will use SQL Server as its datasource. I am providing ths excel based example for the sake of protability.You will need to set the datasource location after saving the files to your hard drive.
    I can get the lines to draw properly, what I cannot figure out is how to specify the datetime values for the x axis. The column I would like to use on the x-axis is called DerivedLoggingTime.
    I'd also like to get control of the logarithmic algorithm used to formulate the y-axis values. I am not always happy with the values that the log algorithm comes up with.
    Any help is greatly appreciated.
    [Link to report|http://www.usol.com/~joe/linechart.rpt]
    [Link to spreadsheet|http://www.usol.com/~joe/AnalysisResults.xls]
    Another discovery while working on this report - our database will be SQL 2008 and  we are making use of the datetime2 datatype. CR appears to be treating this datatype as text. So when working with the SQL based datasource, I had to cast datetime2 columns as datetime in order for CR to see the columns as datetime instead of text. This is fine in this instance because the granularity of the datetime values for this particular report does not require datetime2, but that will not always be the case. CR will need to recognize the new datatype.
    Edited by: Joe Sytniak on Jul 17, 2008 5:37 PM

    Hi Joe,
    The Date Axis Line Chart of the Numeric Axis Type Chart, can be used to display data on a regular interval of days, Months and Years. The information displayed can unfortunately not be more granular that days.
    This type of chart is generally used when the data is recorded on irregular intervals in the database, and to make sense of the information stored it needs to be displayed at regular intervals.
    Since the data stored in your data source seems to be stored every 4 minutes, it will not be necessary to use this type of chart. I will suggest to use the regular line chart instead.
    To create a line chart using your date time field and value:
    1. Select "Chart" under the menu "Insert"
    2. Insert the chart on your report in the desired section.
        ( Group Header # 3 in your case. )
    3. In the "Chart Expert" window, under the tab "Type",
        change the chart type to a line chart by selecting "Line" in
        the "Chart Type" list.
    4. Under the tab "Data", add the database field that contains the Date Time information under the "On change of" list.
    (In your case, add the "DerivedLoggingTime" database field)
    5. To display the data for each minute, select the database fields you just added under the "On Change of" list, and
    click on the button "Order". In the "Chart Sort Order" window,
    select "For each minutes" in the "Section will be printed" drop down list, then click "OK"
    6. Add the field you want to display the value in the "Show Value List", then click "OK"
    Now it will display a line chart as desired, but since there is a lots of data point on your chart, the x axis date time labels will overlap each other. To avoid  this situation, I will suggest to skip labels.
    To format a chart to skip labels:
    1. In the "Preview" tab of the report, select one of the x axis label, and right click on it. In the contextual menu, select "Group (X) Axis Options..."
    2. In the "Group (X) Axis Settings" window, under the tab "Layout", check the option "Skip Group Labels" and set the value to 15 for example.
    Now, it will display the date time label at every 15 data point.
    As for your question on how get control of the logarithmic algorithm used to formulate the y-axis values, we unfortunately do not have much control over it other than:
    - Entering static values, or
    - Checking or Unchecking the option "Use Logarithmic scales"
    The above options are available on the y axis. To change those options:
    1. In the "Preview" tab of the report, select one of the y axis label, and right click on it. In the contextual menu, select "Group (Y) Axis Options..."
    2. In the "Group (Y) Axis Settings" window, under the tab "Scales", you will see the following options:
    - Minimum Values
    - Maximum Values
    - Use Logarithmic scales
    I will suggest to check the option "Use Logarithmic scales"
    Finally, as for the issue you discovered where SQL Server 2008 data type DateTime2 is converted to a string in Crystal Reports 2008, it is important to note that SQL Server 2008 hasn't been released yet, therefore it has not been tested in Crystal Reports 2008. Once SQL Server 2008 is released, I will suggest to test it again using the ODBC driver provided with this new version. 
    At this point I am assuming that this is happening because it is a new data type and an unknown data type get converted to string.

  • How to output sample and convert clocks to PFI lines of E-Series DAQ (DAQPad-60​15)

    Hi,
    Can someone tell me how to output sample and convert clocks to PFI lines of E-Series DAQ (DAQPad-6015)?
    Thank you very much.
    Jack

    John --
    Windows is not an option for me. I like your idea of using a counter output -- it may be helpful as I am getting ramped up, but my application will eventually require both timer outputs.
    I have a legacy C application written for Macintosh, and I am in the process of moving it onto OS X. So my options are to use DAQmx Base, or write an in-kernel driver. I actually have already done the latter for 6024/6025 E-series boards (for another company); for this client I was hoping to use the DAQmx Base to allow an easy transition to M-series boards, without the cost of writing and supporting a low-level driver.
    The specific task I am doing is relatively straightforward. I record 2 channels of AI for a short period (usually about 250 ms.) and during this time I drive 2 external digital signals. Right now, I use the 2 timer outputs, which allows precise synchronization with the output and AI sampling.
    I appreciate your comments, and thanks in advance for any additional suggestions you can lob my way.
    --spg
    Scott Gillespie
    Applied Brain, Inc.
    scott gillespie
    applied brain, inc.

  • Simple line graph problem

    Hi there,
    I want to create a very simple line graph, containing 1 line. Therefore i create a Graph.LINE_VERT_ABS type Graph and add the data using myGraph.setLocalRelationalData(al ArrayList). This arraylist contains values in the form of
    setname jan 12.2
    setname feb 14.5
    setname march 8.1
    etc
    When i do this, I get the errormessage: "The data has an insufficient number of columns. This graph type requires at least 2 columns of data. The data provided has one column.".
    When i add another dummy value to the arraylist:
    dummy dummya 1
    dummy dummyb 2
    the graph displays correctly, but only with a additional line for the dummy values, also in the Legend.
    What am i doing wrong. Surely it is possible to display just one line in the Graph??
    Any help is appreciated.
    Linda

    In the arraylist, setname identifies a column. By default, columns are plotted as groups, or different points along the horizontal axis. In order to have a line or area graph, you need two groups. The data that you are passing has 1 group and 3 series. You should pass it as follows:
    jan setname 12.2
    feb setname 14.5
    march setname 8.1
    etc.
    Passing data like this will give you three groups (jan, feb, march) and one series (setname).
    By the way, what version of BI Beans are you using and how did find out about setLocalRelationalData? That API was never publicly released. It was replaced by setTabularData (same method renamed) and exposed in 9.0.3.
    BI Beans Product Management

  • HOW TO display a simple line of text if the user isn't logged in and not display it if they are?!?!?

    there must be a way to display a simple line of text (or a link) if the user isn't logged in (as wholesale customer), and not display it if they are?!?!?
    it's a basic kind of <php echo> var type of function.... there must be an equivalent in this BC system..... anyone?!?!?     PLEASE!
    thank you
    Chris.

    ok, after chattting with LIVE SUPPORT i've discovered {module_isloggedin}
    now i just need to integrate it into my Online Store modules!

  • In Preview, the simple line annotation seems to have been removed. When I select the tool, there is an arrow annotation instead of the simple line earlier.

    The simple line annotation in the Preview Application seems to have been replaced rather oddly by an arrow. I wish to use the simple line in a PDF document without an arrow at the end. Its a very important annotation that I use very frequently.

    Choose line width at the top of this pull-down in the Annotate tools. Choose simple lines, right, left or two-way arrows at the bottom of the pull-down...

  • Simple lines now not compiling

    I added the Netbeans profiler to my app this morning. I don't know if that has anything to do with my problem specifically, but for some reason, simple lines that I add in are acting very weird now. For instance, the below line asks for another " )". Without this line, the program compiles fine so I know it's not the result of another () not being closed. Both variables are strings. What am I not seeing?
    System.out.println("Path of " + userURL "is " + pathURL);

    yeah, I can go to every closing bracket in Netbeans and it will highlight the opening one. They are all there. I'll post the if block that I'm referring to to see if someone sees something that I don't:
                                if(tempURL.trim().startsWith(baseURL.toString()) && !tempURL.trim().toLowerCase().endsWith("js") && !tempURL.trim().startsWith("#"))
                                    try
                                        HttpURLConnection con = (HttpURLConnection) pageLinks.getRequest().getURL().openConnection();
    int respcode=con.getResponseCode();
    con.disconnect();
    if (respcode != 200 || respcode != 202)
    FileWriter writer = new FileWriter("Not_Found.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    else
    WebLinkQueue.add(pageLinks[i].getRequest().getURL());
    try
    FileWriter writer = new FileWriter("Processed.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    catch(IOException e)
    logger.debug("Could not write " + userURL + " to not processed file");
    catch(java.net.MalformedURLException me)
    logger.debug("pageLinks HTTPCon block: " + me.getMessage());
    catch(java.io.IOException ie)
    logger.debug("pageLinks HTTPCon block: " + ie.getMessage());
    else if(!tempURL.trim().startsWith("#") && tempURL.trim().startsWith(baseURL.toString()));
    notProcessed.add(pageLinks[i].getRequest().getURL().toString());
    try
    FileWriter writer = new FileWriter("Not_Processed.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    catch(IOException e)
    logger.debug("Could not write " + userURL + " to not processed file");
    else if(!tempURL.trim().startsWith("#")) //error here
    try
    FileWriter writer = new FileWriter("External.txt", true);
    writer.write(System.getProperty("line.separator") + pageLinks[i].getRequest().getURL());
    writer.close();
    catch(IOException e)
    logger.debug("Could not write " + userURL + " to not processed file");

  • Convert scanned signature into line drawing

    I have a need to convert scanned signatures into line-drawings. I could buy MIcrosoft Illustrator (or something) to do it, but I was wondering if anyone knew of a free-ware Java tool that could do this.
    It would work somehting like the following:
    1. Sign your name on a white piece of paper.
    2. Scan the image and store it as an jpeg file.
    3. A program (hopefully free in Java) would read in the image and output one of the following:
    a) output to another jpeg file where the signature had been converted to line-drawings (so the lines are thiner and more crisp than the scanned image)
    b) output the vector coordinates that could be read into another custom program that could dynamically create the jpeg (I know how to write this jpeg-creatio program from coordinates...).
    thanks,
    Jeff

    For starters, using JPEGs in this situation is a poor choice because it is a lossy format.
    Second, it seems like what you're after is something like OCR. I think I asked a question once about OCR for java... I think I remember someone telling me that it's out there. But anyway search the web for that.
    Even if all you're interested in is code that will smartly 'correct' an image I don't think that there is freely available code (might not be any Java code at all) to do this.

  • I want to make a simple line chart

    i want to make a simple line chart using the data in two nonadjacent columns.
    it seems that the easiest way to do this is to export the sheet to google docs and use THEIR charting, which is a two-click deal.
    is there an easy way to do this in numbers?
    my impression:
    numbers:
    very fancy, super pretty, easy to modify APPEARANCE, difficult to use actual charts. custom paint job on a junker
    googledocs:
    available everywhere, basic, more difficult with actual data flexibility, but you can use what you've got.
    the whole emphasis on numbers seems to be how pretty i can make displays, but not a lot of emphasis on making it easy to make things work.
    can anyone shed some light on how to make this simple instead of pretty?

    You can definitely use the technique I mentioned to order the columns to make it easy to chart:
    Here I created a table (the top one) to hold the original data and make a second table (the lower one) to pull data into two adjacent columns:
    The bottom table, as I said pulls data from the top data table:
    Then highlight the data in the table to chart, and selec the chart type from the menu (I suggest the bar chart which is the first item in the chart tool menu):
    I made up this data and mean it to be no reflection on your running ability 

  • Converting multiple points to line

    Hi All
    I have table consist of point data.. how to convert multiple points to line data.. if anyknows pls tell me ..
    Thak you

    user13340372,
    . . . .Are you trying to draw a line between 2 points or draw a line connecting N points?
    How to Create a Line From 2 Points_
    . . . .You could use the SDO_Geometry constructor. For example, if you have a table POINTS defined as (ID NUMBER, FromPt SDO_GEOMETRY, ToPt SDO_GEOMETRY), then you could:
    SELECT 
        SDO_GEOMETRY(
        'LINESTRING ('||
        -- concatenate coordinates from FromPt
        REPLACE(REPLACE(p.FromPt.Get_WKT(), 'POINT (', NULL), ')', NULL)||','||
        -- concatenate coordinates from ToPt
        REPLACE(REPLACE(p.ToPt.Get_WKT(), 'POINT (', NULL), ')', NULL)||')'
        ---  SRID
        , 4326)
    FROM
        POINTS p;              
    How to Create a Line From N Points_
    . . . .In a "connect-the-dots" puzzle, you draw lines from one numbered point to the next numbered point. There, the numbers define how points are related. If you dont have that information, then you need to decide how you want your points connected. Here are a few options - your requirements should indicate which (if any) is suitable:
    . . . .(a) Draw Arbitrary Linestring Through Points: user10278189 already posted that PL/SQL solution (above).
    . . . .(b) Connect Nearest Neigbors: set CURRENT_POINT to a point (e.g., bottom-left). Then identify its nearest-neighbor (hereinafter, "NextPoint") using SDO_NN. Flag NextPoint as "visited" and set CURRENT_POINT to NextPoint. Repeat until all points in the point-set are flagged as "visited." The result ( which depends on the starting point ) is a linestring connecting all points (a "line" is only between 2 points; a linestring is between 2 or more points). This requires PL/SQL.
    . . . .(c) Draw Along Shortest Distances: Create a table containing: FromPt_ID, toPt_ID and distances between each pair of points. (If you do this via a cross product, remove rows where FromPt_ID = ToPt_ID.) Begin connecting the points with the minimum distance from the last "visited" point (as before, flag the points that have been used as "visited"). The result of this operation is the shortest linestring connecting your point-set. This requires PL/SQL.
    . . . .(d) Outline Set of Points: You could also use the SDO_GEOM.Sdo_ConvexHull function to create polygon that encloses your point set, and then use SDO_UTIL.PolygonToLine to turn that area-geometry into a line-geometry. This can probably be done in a single statement.
    . . . .(e) Others (TSP, spanning tree, etc).
    Regards,
    Noel

  • Simple line drawing project in swing

    hi folks,
    i want to write a simple line drawing project. it has a JPanel, a JFrame and JButton.
    JPanel and JButton are on JFrame. When Button is clicked,
    a line will be added to JPanel but previous lines which have been added are not removed on JPanel.
    Could you please help me?

    i wrote below codes but it adds first line but when click button �n order to add line, it is not adding line. Please help and thanxs...
    import java.awt.BasicStroke;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.geom.Line2D;
    import java.util.Enumeration;
    import java.util.Vector;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.WindowConstants;
    import javax.swing.SwingUtilities;
    public class NewJFrame extends javax.swing.JFrame implements ActionListener {
         private JButton addButton;
         MainPanel mainPane ;
         public Vector lines ;
         * Auto-generated main method to display this JFrame
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        NewJFrame inst = new NewJFrame();
                        inst.getContentPane().add(new MainPanel(inst.lines));
                        inst.setLocationRelativeTo(null);
                        inst.setVisible(true);
         public NewJFrame() {
              super();
              initGUI();
              lines = new Vector();
              lines.add(0, 30);
              addButton.addActionListener(this);
         private void initGUI() {
              try {
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                        addButton = new JButton();
                        getContentPane().add(addButton, BorderLayout.SOUTH);
                        addButton.setText("ADD");
                        addButton.setPreferredSize(new java.awt.Dimension(71, 21));
                   pack();
                   setSize(400, 300);
              } catch (Exception e) {
                   e.printStackTrace();
         @Override
         public void actionPerformed(ActionEvent e) {
              if(e.getSource() == addButton){
                   lines.addElement(Integer.parseInt(lines.get(0).toString())+30);
                   mainPane.repaint();
    class MainPanel extends JComponent {
         Vector tempLines ;
         MainPanel(Vector lines){
              tempLines = lines;
              setBackground(Color.white);
         public void paintComponent(Graphics g) {
              Enumeration enumeration = tempLines.elements();
              while(enumeration.hasMoreElements()) {
                   Integer point = Integer.parseInt(enumeration.nextElement().toString());
                   Line2D line = new Line2D.Double(30, point, 200, point);
         Graphics2D g2d = (Graphics2D)g;
         g2d.setStroke(new BasicStroke(5));
         g2d.draw(line);
    }

  • Help me with a simple line-graph, plzzzzzzzz.

    hi!
    can anyone give me the basic java code to create a simple line graph for my java program output.
    thanks a lot in advance.
    cheers!

    Have a look at the Graphics.drawPolyline() method.
    kind regards,
    Jos

  • DNG converter 4.5, command line broken

    Hi,
    The command line feature of the DNG converter appears to be broken on the latest version (4.5).
    Version 4.4.1 still functions OK...
    Anyone got a clue?
    Greetings,
    Auke

    Yes there is a problem with 4.5, I is using it togheter with Downloader Pro and have recieved this from the developer:
    It appears to be a bug in Adobe's DNG Converter: the -o command line option appears to be broken. This document lists the command line options: http://www.adobe.com/products/dng/pd...ommandline.pdf
    If you type in the same command line options as DLPro's plug-in is using in a "Command Prompt" window Adobe's DNG Converter fails to create the DNG file using the pathname specified using the -o option. As far as I can see -o works if the output filename is specified but fails if a full pathname including the directory is used.
    Unfortunately there isn't much I can do about this as the problem is caused by a bug in Adobe's software.
    See the full forum messages on:
    http://www.breezesys.com/forum/showthread.php?t=2874
    br,
    Bo

  • Looking for simple line drawing program [Solved]

    I am looking for a simple line drawing program with the following features :
    command-driven ( line, circle, ellips and such commands)
    used commands need to be exportable or copyable
    2D
    a canvas with arbitrary size
    libreoffice Draw, Koffice Karbon and xfig are not suitable for this.
    I have some experience with Autocad, but no access to that anymore.
    Any suggestions ?
    Last edited by Lone_Wolf (2011-04-03 13:34:57)

    keenerd wrote:For really simple stuff (and extremely keyboard driven!) I'll make an SVG by hand.  Any xml aware text editor works great.  The spec is pretty simple.  Use an image viewer that will automatically redraw when the SVG is updated.
    +1 http://www.w3schools.com/svg/tryit.asp? … 1&type=svg
    I think TeX can draw alright.
    A bunch of links - never tried them, don't know if they even work:
    http://www.ribbonsoft.com/qcad.html
    http://www.linuxcad.com/
    http://ipe7.sourceforge.net/
    Last edited by karol (2011-04-03 01:12:44)

  • How do you down load to your computer files converted to pdf on line?

    How do you down load files to your computer that have been converted to pdf on line with Adobe?

    Moved to Adobe CreatePDF

Maybe you are looking for

  • Sim card not supported after updating software on iphone

    so i was downloading the new software and it appeared to be working and it all of a sudden said "the sim card inserted in this iphone does not appear to be supported" ..it has the same telus sim card in it that it did before which is the one that cam

  • Officejet Pro 8600 Plus wont print from Mac 10.5.8

    Hello, I just purchased the Officejet Pro 8600 Plus and I'm running it wired through my router.  I'm able to print with my PC, my IPad and my phone but I cant print with my mac running OS 10.5.8.  When I try to print it puts the document in the print

  • I want Verizon Fios!

    First off, my apologies if a message like this has already been posted here, but I really want Fios!  I need the super fast internet connection and my DSL just doesn't cut it with the amount of photos I need to upload.  This quote prompted me to post

  • How to Correct Cancel Invoice

    Hi Experts, The Users did some cancellation Invoices but they changed the date to 15.10.2010 instead of the original 18.10.2010 of the original Invoice. Now, the Cancel Invoice is not being posted to Accounting because the system displays an error "C

  • NiScope_InitiateAcquisition error for a second 5132 USB scope

    I have 2 NI5132 USB digitizers.  Either one alone works fine.  But if I plug both into the USB bus, then the last one connected produces the error message "Error BFFA666A   NI Platform Services: No transfer is in progress because the transfer was abo