Convert from ordinary geometry to LRS geometry

Hi
I have converted line geometry to LRS geometry by using the block as given below. I also created metadata for X,Y,M before converting to LRS.
BEGIN
IF (SDO_LRS.CONVERT_TO_LRS_LAYER('centerline', 'GEOMETRY') = 'TRUE')
THEN
DBMS_OUTPUT.PUT_LINE('Conversion from STD_LAYER to LRS_LAYER succeeded.');
ELSE
DBMS_OUTPUT.PUT_LINE('Conversion from STD_LAYER to LRS_LAYER failed.');
END IF;
END;
The conversion is succesful but there are two problems after conversiion:
(1) SDO_GTYPE, it is 4402 instead of 3302
(2) The measures are zero
SQL> select a.geometry.sdo_gtype from centerline a;
GEOMETRY.SDO_GTYPE
4002
4002
4002
4002
SQL> select a.geometry.sdo_ordinates from centerline a;
GEOMETRY.SDO_ORDINATES
SDO_ORDINATE_ARRAY(-118.43115, 33.949104, 0, 0)
SDO_ORDINATE_ARRAY(-118.41902, 33.93364, 0, 0)
SDO_ORDINATE_ARRAY(-118.41934, 33.935822, 0, 0)
SDO_ORDINATE_ARRAY(-118.43423, 33.946848, 0, 0)
Can you help me to convert sdo_gtype to 3302 and how to update measures based on geometry length ??
Thanks
Syed Masood

Hi Syed
You have not given all details to completely check what you have done or how your source data looks like.
This feedback is based on the elements you have given.
The resulting LRS has gtype 4402, this means your input geometry had gtype 3002.
At the same time, as your resulting LRS geom has only 4 ordinates, means that your input geometry had only 3 ordinates.
This means that your input geometry was a 3D point.
The result is an LRS point, with a measure 0 at the start point (itself).
For 3D geometries there are LRS_3D functions dealing with 3D, however they do not cope with geodetic (latlon) type of geometries, I believe.
http://docs.oracle.com/cd/B28359_01/appdev.111/b28400/sdo_lrs_concepts.htm#i890852
What you can do is turn your 3D input geometries into 2D before converting them to LRS geometries, as this seems what your after (with the question to have gtypes 3302), obvisouly you will loose your z info.
select SDO_LRS.CONVERT_TO_LRS_GEOM(sdo_cs.make_2d(SDO_GEOMETRY(3002, 4326, NULL,
SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(-118.43115, 33.949104, 0)))) from dual;
But you will have to check the input as being line strings first.
Please check this first, if you need more help, post one of your input geometries to start with.
I hope this helps. (should you feel the same, please mark the post as helpful or as correct answer)
Luc

Similar Messages

  • How to bridge (fill) gaps when converting a 2006 geometry  into a 2002 geometry

    Is it at all possible to bridge (fill) gaps when converting a 2006 geometry into a single 2002 geometry. I have a solution for the conversion from 2006 to 2002 provided by BHall but upon further investigation investigation of my dataset some of the multi line polygons have gaps which I need to fill and I am not sure how to go about this.
    Here is a simple example of what I am trying to achieve
    Before
    SELECT (sdo_geometry(2006, 81989, NULL,
                    mdsys.sdo_elem_info_array(1,2,1,5,2,1,9,2,1,13,2,1),
                    mdsys.sdo_ordinate_array(16,0.999,16.998,-0.001,17.253,-0.001,18.003,0.999,18.003,0.999,19.001,0.999,19.001,0.999,19.999,-0.001)))
      FROM dual
    After
    SELECT (sdo_geometry(2006, 81989,NULL,
                   mdsys.sdo_elem_info_array(1,2,1),
                   mdsys.sdo_ordinate_array(16,0.999,17.253,-0.001,18.003,0.999,19.001,0.999,19.999,-0.001))) FROM dual    
    Thanks in advance

    Okay Roché,
    You might need to break this problem down into smaller parts for the forum.  All your examples show the gap being replaced by a single vertice - e.g. you want to "snap" the gap together.  I'd suggest this is just complicating your question.  Once the gap is filled (with a line) then you can run SDO_UTIL.REMOVE_DUPLICATE_VERTICES afterwards to remove the new line if its below your tolerance.  I think that Bryan's code wrapped in remove duplicate vertices will solve your second scenario.  But overall I think it would be helpful to focus just on the filling and leave the snapping for a follow-up question.
    So back to scenario #1, below is some code I wrote a while back that might do what you want or at least get you started.     Note that the input must be a multistring and the multistring cannot be "spaghetti".  In other words each line in the multistring must be disjoint or at most touch other lines only at endpoints. The goal is to sift through the lines and create a single linestring using the smallest gaps.  It's not subtle and will indeed produce bad geometries if the inputs are setup in an impossible manner.  There are also some rare geodetic bugs with SDO_GEOM.RELATE that crop up.  So you'll note I test both distance and relate in some places.  That's intentional though kind of dumb.
    Hopefully this helps.  If you improve the code please shoot a copy back to me.
    Cheers,
    Paul   
    CREATE OR REPLACE PACKAGE dz_gap_fill
    AUTHID CURRENT_USER
    AS
       FUNCTION linear_gap_filler(
           p_input            IN  MDSYS.SDO_GEOMETRY
          ,p_tolerance        IN  NUMBER DEFAULT 0.05
       ) RETURN MDSYS.SDO_GEOMETRY;
    END dz_gap_fill;
    CREATE OR REPLACE PACKAGE BODY dz_gap_fill
    AS
       FUNCTION fast_point(
           p_x             IN  NUMBER
          ,p_y             IN  NUMBER
          ,p_z             IN  NUMBER DEFAULT NULL
          ,p_m             IN  NUMBER DEFAULT NULL
          ,p_srid          IN  NUMBER DEFAULT 8265
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_x IS NULL
          OR p_y IS NULL
          THEN
             RAISE_APPLICATION_ERROR(-20001,'x and y cannot be NULL');
          END IF;
          -- Step 20
          -- Do the simplest solution first
          IF  p_z IS NULL
          AND p_m IS NULL
          THEN
             RETURN SDO_GEOMETRY(
                 2001
                ,p_srid
                ,SDO_POINT_TYPE(
                     p_x
                    ,p_y
                    ,NULL
                ,NULL
                ,NULL
          END IF;
          -- Step 30
          -- Do the other wilder choices
          IF p_z IS NULL
          AND p_m IS NOT NULL
          THEN
             RETURN SDO_GEOMETRY(
                 3301
                ,p_srid
                ,SDO_POINT_TYPE(
                     p_x
                    ,p_y
                    ,p_m
                ,NULL
                ,NULL
          ELSIF p_z IS NOT NULL
          AND   p_m IS NULL
          THEN
             RETURN SDO_GEOMETRY(
                 3001
                ,p_srid
                ,SDO_POINT_TYPE(
                     p_x
                    ,p_y
                    ,p_z
                ,NULL
                ,NULL
          ELSIF p_z IS NOT NULL
          AND   p_m IS NOT NULL
          THEN
             RETURN SDO_GEOMETRY(
                 4401
                ,p_srid
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,1,1)
                ,SDO_ORDINATE_ARRAY(p_x,p_y,p_z,p_m)
          ELSE
             RAISE_APPLICATION_ERROR(-20001,'ERR!');
          END IF;
       END fast_point;
       FUNCTION get_start_point(
          p_input        IN  MDSYS.SDO_GEOMETRY
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          int_dims PLS_INTEGER;
          int_gtyp PLS_INTEGER;
          int_lrs  PLS_INTEGER;
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_input IS NULL
          THEN
             RETURN NULL;
          END IF;
          -- Step 20
          -- Gather information about the geometry
          int_dims := p_input.get_dims();
          int_gtyp := p_input.get_gtype();
          int_lrs  := p_input.get_lrs_dim();
          -- Step 30
          -- Handle point and multipoint inputs
          IF int_gtyp = 1
          THEN
             RETURN p_input;
          ELSIF int_gtyp = 5
          THEN
             RETURN SDO_UTIL.EXTRACT(p_input,1);
          END IF;
          -- Step 40
          -- Return results
          IF int_dims = 2
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,NULL
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,NULL
                ,p_input.SDO_ORDINATES(3)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 0
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,p_input.SDO_ORDINATES(3)
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs IN (4,0)
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,p_input.SDO_ORDINATES(3)
                ,p_input.SDO_ORDINATES(4)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,p_input.SDO_ORDINATES(4)
                ,p_input.SDO_ORDINATES(3)
                ,p_input.SDO_SRID
          ELSE
             RAISE_APPLICATION_ERROR(-20001,'ERR!');
          END IF;
       END get_start_point;
       FUNCTION get_end_point(
          p_input        IN  MDSYS.SDO_GEOMETRY
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          int_dims PLS_INTEGER;
          int_gtyp PLS_INTEGER;
          int_lrs  PLS_INTEGER;
          int_len  PLS_INTEGER;
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_input IS NULL
          THEN
             RETURN NULL;
          END IF;
          -- Step 20
          -- Gather information about the geometry
          int_dims := p_input.get_dims();
          int_gtyp := p_input.get_gtype();
          int_lrs  := p_input.get_lrs_dim();
          int_len  := p_input.SDO_ORDINATES.COUNT();
          -- Step 30
          -- Handle point and multipoint inputs
          IF int_gtyp = 1
          THEN
             RETURN p_input;
          ELSIF int_gtyp = 5
          THEN
             RETURN SDO_UTIL.EXTRACT(
                 p_input
                ,SDO_UTIL.GETNUMELEM(p_input)
          END IF;
          -- Step 40
          -- Return results
          IF int_dims = 2
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_ORDINATES(int_len)
                ,NULL
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,NULL
                ,p_input.SDO_ORDINATES(int_len)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 0
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_ORDINATES(int_len)
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs IN (4,0)
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 3)
                ,p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_ORDINATES(int_len)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 3)
                ,p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_SRID
          ELSE
             RAISE_APPLICATION_ERROR(-20001,'ERR!');
          END IF;
       END get_end_point;
       FUNCTION is_spaghetti(
           p_input             IN  MDSYS.SDO_GEOMETRY
          ,p_tolerance         IN  NUMBER DEFAULT 0.05
       ) RETURN VARCHAR2
       AS
          num_tolerance    NUMBER := p_tolerance;
          ary_strings      MDSYS.SDO_GEOMETRY_ARRAY := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_starts       MDSYS.SDO_GEOMETRY_ARRAY := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_ends         MDSYS.SDO_GEOMETRY_ARRAY := MDSYS.SDO_GEOMETRY_ARRAY();
          int_count        PLS_INTEGER;
          ary_start_count  MDSYS.SDO_NUMBER_ARRAY := MDSYS.SDO_NUMBER_ARRAY();
          ary_end_count    MDSYS.SDO_NUMBER_ARRAY := MDSYS.SDO_NUMBER_ARRAY();
          ary_inside_count MDSYS.SDO_NUMBER_ARRAY := MDSYS.SDO_NUMBER_ARRAY();
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_input IS NULL
          THEN
             RETURN NULL;
          ELSIF p_input.get_gtype = 2
          THEN
             RETURN 'FALSE';
          ELSIF p_input.get_gtype <> 6
          THEN
             RAISE_APPLICATION_ERROR(-20001,'input gtype must be 2 or 6');
          END IF;
          IF num_tolerance IS NULL
          THEN
             num_tolerance := 0.05;
          END IF;
          -- Step 20
          -- Break multistring into single linestrings with nodes
          int_count := SDO_UTIL.GETNUMELEM(p_input);
          ary_strings.EXTEND(int_count);
          ary_starts.EXTEND(int_count);
          ary_ends.EXTEND(int_count);
          ary_start_count.EXTEND(int_count);
          ary_end_count.EXTEND(int_count);
          ary_inside_count.EXTEND(int_count);
          FOR i IN 1 .. int_count
          LOOP
             ary_strings(i) := SDO_UTIL.EXTRACT(p_input,i);
             ary_starts(i)  := get_start_point(ary_strings(i));
             ary_ends(i)    := get_end_point(ary_strings(i));
          END LOOP;
          -- Step 30
          -- Loop through and count the nodes connections
          FOR i IN 1 .. int_count
          LOOP
             ary_start_count(i)  := 0;
             ary_end_count(i)    := 0;
             ary_inside_count(i) := 0;
             FOR j IN 1 .. int_count
             LOOP
                IF i != j
                THEN
                   IF SDO_GEOM.RELATE(
                      ary_starts(i),
                      'DETERMINE',
                      ary_strings(j),
                      num_tolerance
                   ) IN ('TOUCH','CONTAINS','COVERS','ON')
                   THEN
                      ary_start_count(i) := ary_start_count(i) + 1;
                   ELSIF SDO_GEOM.RELATE(
                      ary_ends(i),
                      'DETERMINE',
                      ary_strings(j),
                      num_tolerance
                   ) IN ('TOUCH','CONTAINS','COVERS','ON')
                   THEN
                      ary_end_count(i) := ary_end_count(i) + 1;
                   ELSIF SDO_GEOM.RELATE(
                      ary_strings(i),
                      'DETERMINE',
                      ary_strings(j),
                      num_tolerance
                   ) IN ('TOUCH','CONTAINS','COVERS','OVERLAPBYINTERSECT')
                   THEN
                      ary_inside_count(i) := ary_inside_count(i) + 1;
                   END IF;
                END IF;
             END LOOP;
             IF ary_start_count(i) > 1
             OR ary_end_count(i) > 1
             OR ary_inside_count(i) > 0
             THEN
                RETURN 'TRUE';
             END IF;
          END LOOP;
          RETURN 'FALSE';
       END is_spaghetti;
       FUNCTION points2segment(
           p_point_one              IN  MDSYS.SDO_POINT_TYPE
          ,p_point_two              IN  MDSYS.SDO_POINT_TYPE
          ,p_srid                   IN  NUMBER
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
       BEGIN
          IF ( p_point_one.Z IS NULL AND p_point_two.Z IS NOT NULL )
          OR ( p_point_one.Z IS NOT NULL AND p_point_two.Z IS NULL )
          THEN
             RAISE_APPLICATION_ERROR(
                -20001,
                'both points must have the same number of dimensions, point_one Z is ' ||
                NVL(TO_CHAR(p_point_one.Z),'') ||
                ' and point_two Z is ' ||
                NVL(TO_CHAR(p_point_two.Z),'')
          END IF;
          IF p_point_one.Z IS NULL
          THEN
             RETURN SDO_GEOMETRY(
                 2002
                ,p_srid
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,2,1)
                ,SDO_ORDINATE_ARRAY(p_point_one.X,p_point_one.Y,p_point_two.X,p_point_two.Y)
          ELSE
             RETURN SDO_GEOMETRY(
                 3002
                ,p_srid
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,2,1)
                ,SDO_ORDINATE_ARRAY(p_point_one.X,p_point_one.Y,p_point_one.Z,p_point_two.X,p_point_two.Y,p_point_two.Z)
          END IF;
       END points2segment;
       FUNCTION points2segment(
           p_point_one              IN  MDSYS.SDO_GEOMETRY
          ,p_point_two              IN  MDSYS.SDO_GEOMETRY
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          int_gtype1 PLS_INTEGER;
          int_dims1  PLS_INTEGER;
          int_gtype2 PLS_INTEGER;
          int_dims2  PLS_INTEGER;
          point_one  MDSYS.SDO_POINT_TYPE;
          point_two  MDSYS.SDO_POINT_TYPE;
       BEGIN
          int_gtype1 := p_point_one.get_gtype();
          int_dims1  := p_point_one.get_dims();
          int_gtype2 := p_point_two.get_gtype();
          int_dims2  := p_point_two.get_dims();
          IF  int_gtype1 = 1
          AND int_gtype2 = 1
          AND int_dims1  = int_dims2
          AND p_point_one.SDO_SRID = p_point_two.SDO_SRID
          THEN
             NULL;  -- Good
          ELSE
             RAISE_APPLICATION_ERROR(
                 -20001
                ,'both point objects must be points and have the same number of dimensions and SRIDs'
          END IF;
          IF int_dims1 = 4
          THEN
             RETURN SDO_GEOMETRY(
                 4402
                ,p_point_one.SDO_SRID
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,2,1)
                ,SDO_ORDINATE_ARRAY(
                     p_point_one.SDO_ORDINATES(1)
                    ,p_point_one.SDO_ORDINATES(2)
                    ,p_point_one.SDO_ORDINATES(3)
                    ,p_point_one.SDO_ORDINATES(4)
                    ,p_point_two.SDO_ORDINATES(1)
                    ,p_point_two.SDO_ORDINATES(2)
                    ,p_point_two.SDO_ORDINATES(3)
                    ,p_point_two.SDO_ORDINATES(4)
          ELSE
             -- Use the sdo_point_type method for the rest
             IF p_point_one.SDO_POINT IS NOT NULL
             THEN
                point_one := p_point_one.SDO_POINT;
             ELSE
                IF int_dims1 = 3
                THEN
                   point_one := SDO_POINT_TYPE(
                       p_point_one.SDO_ORDINATES(1)
                      ,p_point_one.SDO_ORDINATES(2)
                      ,p_point_one.SDO_ORDINATES(3)
                ELSE
                   point_one := SDO_POINT_TYPE(
                       p_point_one.SDO_ORDINATES(1)
                      ,p_point_one.SDO_ORDINATES(2)
                      ,NULL
                END IF;
             END IF;
             IF p_point_two.SDO_POINT IS NOT NULL
             THEN
                point_two := p_point_two.SDO_POINT;
             ELSE
                IF int_dims1 = 3
                THEN
                   point_two := SDO_POINT_TYPE(
                        p_point_two.SDO_ORDINATES(1)
                       ,p_point_two.SDO_ORDINATES(2)
                       ,p_point_two.SDO_ORDINATES(3)
                ELSE
                   point_two := SDO_POINT_TYPE(
                       p_point_two.SDO_ORDINATES(1)
                      ,p_point_two.SDO_ORDINATES(2)
                      ,NULL
                END IF;
             END IF;
             RETURN points2segment(
                 p_point_one   => point_one
                ,p_point_two   => point_two
                ,p_srid        => p_point_one.SDO_SRID
          END IF;
       END points2segment;
       FUNCTION linear_gap_filler(
           p_input            IN  MDSYS.SDO_GEOMETRY
          ,p_tolerance        IN  NUMBER DEFAULT 0.05
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          sdo_input     MDSYS.SDO_GEOMETRY := p_input;
          num_tolerance NUMBER;
          int_counter   PLS_INTEGER;
          ary_edges     MDSYS.SDO_GEOMETRY_ARRAY;
          ary_starts    MDSYS.SDO_GEOMETRY_ARRAY;
          ary_ends      MDSYS.SDO_GEOMETRY_ARRAY;
          ary_nearest   MDSYS.SDO_NUMBER_ARRAY;
          ary_distance  MDSYS.SDO_NUMBER_ARRAY;
          num_temp      NUMBER;
          num_nearest   NUMBER;
          int_winner    PLS_INTEGER;
          int_winner2   PLS_INTEGER;
          sdo_point1    MDSYS.SDO_GEOMETRY;
          sdo_point2    MDSYS.SDO_GEOMETRY;
          boo_done      BOOLEAN;
          num_one       NUMBER;
          num_two       NUMBER;
          int_looper    PLS_INTEGER := 1;
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF num_tolerance IS NULL
          THEN
             num_tolerance := 0.05;
          END IF;
          IF sdo_input IS NULL
          OR sdo_input.get_gtype() <> 6
          THEN
             RETURN sdo_input;
          END IF;
          IF is_spaghetti(sdo_input,p_tolerance) = 'TRUE'
          THEN
             RETURN sdo_input;
          END IF;
          <>      ary_edges     := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_starts    := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_ends      := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_nearest   := MDSYS.SDO_NUMBER_ARRAY();
          ary_distance  := MDSYS.SDO_NUMBER_ARRAY();
          -- Step 20
          -- Break multistring into edges and start and end nodes
          int_counter := SDO_UTIL.GETNUMELEM(sdo_input);     
          ary_edges.EXTEND(int_counter);
          ary_starts.EXTEND(int_counter);
          ary_ends.EXTEND(int_counter);
          FOR i IN 1 .. int_counter
          LOOP 
             ary_edges(i)  := SDO_UTIL.EXTRACT(sdo_input,i);
             ary_starts(i) := get_start_point(ary_edges(i));
             ary_ends(i)   := get_end_point(ary_edges(i));
          END LOOP;
          -- Step 30
          -- Determine the closest endpoints
          ary_nearest.EXTEND(int_counter);
          ary_distance.EXTEND(int_counter);
          FOR i IN 1 .. int_counter
          LOOP
             num_nearest := NULL;
             int_winner := NULL;
             FOR j IN 1 .. int_counter
             LOOP
                IF j != i
                THEN
                   num_temp := SDO_GEOM.SDO_DISTANCE(
                       ary_edges(i)
                      ,ary_edges(j)
                      ,num_tolerance
                   IF num_nearest IS NULL
                   OR num_temp < num_nearest
                   THEN
                      num_nearest := num_temp;
                      int_winner := j;
                   END IF;
                END IF;
             END LOOP;
             ary_nearest(i) := int_winner;
             ary_distance(i) := num_nearest;
          END LOOP;
          -- Step 40
          -- Find the smallest gap
          int_winner := NULL;
          num_nearest := NULL;
          FOR i IN 1 .. int_counter
          LOOP
             IF num_nearest IS NULL
             OR ary_distance(i) < num_nearest
             THEN
                 int_winner := i;
                 num_nearest := ary_distance(i);
                 int_winner2 := ary_nearest(i);
             END IF;
          END LOOP;
          -- Step 50
          -- Determine the endpoints to connect
          num_one := SDO_GEOM.SDO_DISTANCE(
             get_start_point(ary_edges(int_winner)),
             ary_edges(int_winner2),
             num_tolerance
          num_two := SDO_GEOM.SDO_DISTANCE(
             get_end_point(ary_edges(int_winner)),
             ary_edges(int_winner2),
             num_tolerance
          IF ( num_one = 0 AND SDO_GEOM.RELATE(
             get_start_point(ary_edges(int_winner)),
             'ANYINTERACT',
             ary_edges(int_winner2),
             num_tolerance
          ) = 'TRUE' )
          OR ( num_two = 0 AND SDO_GEOM.RELATE(
             get_end_point(ary_edges(int_winner)),
             'ANYINTERACT',
             ary_edges(int_winner2),
             num_tolerance
          ) = 'TRUE' )
          THEN
             sdo_point1 := NULL;
          ELSIF num_one < num_two
          THEN
             sdo_point1 := get_start_point(ary_edges(int_winner));
          ELSE
             sdo_point1 := get_end_point(ary_edges(int_winner));
          END IF;
          num_one := SDO_GEOM.SDO_DISTANCE(
             get_start_point(ary_edges(int_winner2)),
             ary_edges(int_winner),
             num_tolerance
          num_two := SDO_GEOM.SDO_DISTANCE(
             get_end_point(ary_edges(int_winner2)),
             ary_edges(int_winner),
             num_tolerance
          IF ( num_one = 0 AND SDO_GEOM.RELATE(
             get_start_point(ary_edges(int_winner2)),
             'ANYINTERACT',
             ary_edges(int_winner),
             num_tolerance
          ) = 'TRUE' )
          OR ( num_two = 0 AND SDO_GEOM.RELATE(
             get_end_point(ary_edges(int_winner2)),
             'ANYINTERACT',
             ary_edges(int_winner),
             num_tolerance
          ) = 'TRUE' )
          THEN
             sdo_point2 := NULL;
          ELSIF num_one < num_two
          THEN
             sdo_point2 := get_start_point(ary_edges(int_winner2));
          ELSE
             sdo_point2 := get_end_point(ary_edges(int_winner2));
          END IF;
          -- Step 50
          -- Smash together
          IF sdo_point1 IS NULL
          OR sdo_point2 IS NULL
          THEN
             sdo_input := SDO_UTIL.CONCAT_LINES(
                ary_edges(int_winner),
                ary_edges(int_winner2)
          ELSE
             sdo_input := SDO_UTIL.CONCAT_LINES(
                SDO_UTIL.CONCAT_LINES(
                   ary_edges(int_winner),
                   points2segment(sdo_point1,sdo_point2)
                ary_edges(int_winner2)
          END IF;
          boo_done := TRUE;
          FOR i IN 1 .. int_counter
          LOOP
             IF i NOT IN (int_winner,int_winner2)
             THEN
                sdo_input := SDO_UTIL.APPEND(sdo_input,ary_edges(i));
                boo_done := FALSE;
             END IF;
          END LOOP;
          -- Step 60
          -- Check if valid if returning
          IF sdo_input.get_gtype() = 2
          OR boo_done = TRUE
          THEN
             RETURN sdo_input;
          END IF;
          int_looper := int_looper + 1;
          GOTO TOP_OF_IT;
       END linear_gap_filler;
    END dz_gap_fill;

  • Get all vertices from a geometry of multiple polygons

    I tried to use sdo_util.GetVertices to retrieve all the vertices from a geometry column. Some of the geometries of gType 2007 that contains more than one element. The getVertices function seems to give back the vertices of the first element only. How can I get all the vertices then?
    Edited by: 937152 on May 29, 2012 11:56 AM

    Why do you have all the NULLs in your sdo_elem_info_array and sdo_ordinate_array? This is very very wrong - see http://docs.oracle.com/cd/E11882_01/server.112/e17766/e12700.htm#sthref3897
    Despite that I am able to get all the "vertices" back from your sample geometry - note that I changed your SELECT statement a little.
    jot_test@JOHNOT> create table assessment_parcel_merged (
      2  id number,
      3  geometry sdo_geometry);
    Table created.
    jot_test@JOHNOT>
    jot_test@JOHNOT> insert into assessment_parcel_merged
      2  (id, geometry)
      3  values
      4  (506833,
      5  mdsys.sdo_geometry(2007,82232,null,
      6  mdsys.sdo_elem_info_array(1,1003,1,13,1003,1,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null),
      7  mdsys.sdo_ordinate_array(632941.3695,5536245.0144,632939.95209944,5536241.97593627,633251.020958124,5536096.38289373,633369.443364573,5536040.95632826,633371.0274,5536043.9168,632941.3695,5536245.0144,631892.0616,5536736.1337,631892.8842984,5536702.62493823,632873.47478553,5536243.66593412,632884.740084103,5536267.81696815,632886.1576,5536270.8559,631892.0616,5536736.1337,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null)));
    1 row created.
    jot_test@JOHNOT>
    jot_test@JOHNOT> select sdo_geom.validate_geometry_with_context(geometry, 0.0005) as geom_validate
      2  from assessment_parcel_merged;
    GEOM_VALIDATE
    13033
    1 row selected.
    jot_test@JOHNOT>
    jot_test@JOHNOT> set null null
    jot_test@JOHNOT> select o.x, o.y
      2  from assessment_parcel_merged a, table(sdo_util.getvertices(a.geometry)) o
      3  where a.id = 506833;
             X          Y
    632941.37 5536245.01
    632939.952 5536241.98
    633251.021 5536096.38
    633369.443 5536040.96
    633371.027 5536043.92
    632941.37 5536245.01
    631892.062 5536736.13
    631892.884 5536702.62
    632873.475 5536243.67
    632884.74 5536267.82
    632886.158 5536270.86
    631892.062 5536736.13
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    50 rows selected.John

  • Retreving X, Y, Z from the Geometry column in oracle 10g

    Dear all ,
    I am stick since 2 days at the same point, I am using 10g, PHP my problem now is how to fecth the X, Y , z coordinates from the geometry column to view it on my web page, i don't understand the (SDO_ORDINATES), what is its type & how i can deal with it. my simple code is:
    $conn=oci_connect('User','pass','//localhost/x')
    $sqlCol="SELECT c.GEOMETRY.SDO_ORDINATES from SSS c WHERE c.CODE = '80A' ";
    $resultCol=oci_parse($conn,$sqlCol);
    $excuteResCol=oci_execute($resultCol);
    $resultRecordsCol=oci_fetch_array($resultCol);
    I got an error on the last line as (ORA-00932: inconsistent datatypes: expected CHAR got ARRAY )
    i don't know how to deal with this resultset.
    If anyone could help please replay.
    Thanks for your help

    Hello, I have the same problem,
    I use php for read data from oracle table,
    all works right but when I must read geometry data like
    (type MDSYS.SDO_GEOMETRY)
    I can't display it on web page.
    esemple of spatial query that I use:
    select INTERSECTIONGEOMETRY0
    from tabella_a
    where
    ID = 970;
    If I use sql plus I have this result
    SDO_GEOMETRY(3001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 0, 6000, 4, 1, 1), SDO_ORDINATE_ARRAY(1, -0, -
    0, 580094, 4998494, -1))
    I use PHP Version 4.4.0
    modules load are:
    extension=php_sdo.dll
    extension=php_oci8.dll
    But I don't know which other module I need and also which php function to use for read array of array. at the moment I use @OCIFetchInto.
    Someone can help me?
    My English is very bad
    Thanks for all!
    Angelo

  • Contouring from point geometry

    Hi all,
    Is any spatial utility or methods are available for creating contour or isopleths on Oracle spatial? I want to create contour from point geometry show it on map (using mapviewer) similar to this site.
    http://www.bom.gov.au/cgi-bin/silo/rain_maps.cgi?map=contours&variable=totals&area=aus&period=week&region=aus&time=latest
    The data required for creation of contour is stored in separate table.
    I found some java applet samples are found in this site.
    http://cimss.ssec.wisc.edu/wxwise/contour/
    But I couldn’t found any algorithm or source code to do this. Pleas share me any idea/information related to this.
    Thanks,
    Sujnan
    Message was edited by:
    sujnan

    You could use the Surfer or ArcGIS API to create a contour map on the fly given whatever dynamic parameters you have. One challenge with the Surfer API is that the inputs and outputs need to be files named with a filename (as far as I know). That's not convenient in this context. I have not looked in detail at the ArcGIS API to see if it also has this limitation.
    You could also prerender all the maps required by the UI. That will give you the best performance. Creating maps can be very slow.

  • Convert the geometric segments to LRS

    I tried to run SDO_LRS.CONVERT_TO_LRS_LAYER to convert to LRS. Everything ran fine but nothing happened in the database. When I loog at the USER_SDO_GEOM_METADATA, I couldn't find any measure values at all. Below is what I ran
    SQL> BEGIN
    2 IF (SDO_LRS.CONVERT_TO_LRS_LAYER('PIP_CENTERLINE_SOB_STG', 'SOB_GEOMETRY') = 'TRUE')
    3 THEN
    4 DBMS_OUTPUT.PUT_LINE('Conversion from STD_LAYER to LRS_LAYER succeeded');
    5 ELSE
    6 DBMS_OUTPUT.PUT_LINE('Conversion from STD_LAYER to LRS_LAYER failed');
    7 END IF;
    8 END;
    9 /
    Conversion from STD_LAYER to LRS_LAYER succeeded
    PL/SQL procedure successfully completed.
    Did I miss out something???? Any suggestions???

    Lap
    How does your metadatrecord looks like?
    Is it 2D or 3D? With other words is it having a DimElement Z or not?
    We had 3D info (dime element 'Z')
    We converted to LRS with the following steps:
    1. convert the 3D Dim array to 2D dim array:
    ==> use the function convert_to_std_dimarray
    2. convert the geometry from 2D to 3D:
    ==> use the function convert_to_std_layer
    3. convert the 2D geometry to LRS:
    ==> use the function convert_to_LRS_layer
    after this the dimarray info is updated automatically:
    the 'M' dimension is added with NULL values for the upper and lower and tolerance values
    if you don't change this NULL values your index creation will fail therefor
    4. SELECT diminfo FROM user_sdo_geom_metadata
    WHERE table_name = 'tablename' AND column_name = 'your GEOMETRY collumn';
    this will give you the values for the 'X' and 'Y' dimelements.
    then you can do an update statement:
    UPDATE user_sdo_geom_metadata
    SET DIMINFO = MDSYS.SDO_DIM_ARRAY(
         MDSYS.SDO_DIM_ELEMENT('X', 22935.54, 295122.12, 0.01),
         MDSYS.SDO_DIM_ELEMENT('Y', 21774.2, 244017.28, 0.01),
         MDSYS.SDO_DIM_ELEMENT('M', 0, 100000, 0.01)
    WHERE table_name = 'tablename' AND column_name = ''your GEOMETRY collumn'';
    so now your M dimelement does not contain any NULL anuymore.
    5. perform your index with parameter PARAMETERS('sdo_indx_dims = 2')
    although the index is created only on the two first dims ('X' and 'Y')
    you cannot leave the dim elements = NULL values for 'M' .
    Hopes this can help you
    Luc VAN LINDEN

  • How do I convert from PAL to NTSC in compressor?

    I have a project I converted from mp4 file to Apple Pro Res to edit it in FCP.  I exported using Compressor and tried to import the files to DVD Studio Pro.  It said it can't put PAL files into an NTSC project.  I didn't even realize it was filmed in PAL (yes, I have the rights to use the footage).  How do I convert the files from PAL to put it into FCP...in Compressor?  If so, how?  Thanks for any help!

    To  convert the 25fps PAL file to a 29.97fps file staying within the ProRes codec:
    • Open up compressor. In the Settings window select: Apple>Formats>Quicktime>ProRes 422
    • Select the "Duplicate Selected Setting" icon in the upper left of the Settings window
    • This creates duplicate of the preset that you can edit
    • Select the preset copy and, in Inspector, give it a new name (something like ProRes PAL>NTSC)
    • In Encoder>Video Settings>Frame rate - and change the frame rate to 29.97
    • In Frame Controls> turn them on and set Resize Filter and Rate Conversion to BETTER.  (If so set them to BEST, be prepared for a long wait)
    • In the Geometry tab, set the Frame Size to 720x480 (you don't say if the file is 16:9 or 4:3)
    • Submit the file and go have dinner. Depending on the length of the file, it may take hours.
    Have fun.
    x

  • How to convert from PAL to NTSC in compressor

    I have a project I converted from mp4 file to Apple Pro Res to edit it in FCP.  I exported using Compressor and tried to import the files to DVD Studio Pro.  It said it can't put PAL files into an NTSC project.  I didn't even realize it was filmed in PAL (yes, I have the rights to use the footage).  How do I convert the files from PAL to put it into FCP...in Compressor?  If so, how?  Thanks for any help!

    Since you've already edited it, export from fcp (file:  export:  quicktime movie - NOT quicktime conversion) with current settings.  Bring this file into compressor and apply the appropriate dvd preset.  Thencustomize the preset, changing the frame rate to 29.97 fps and video format to ntsc in the encoder panel:  the pixel dimensions in the geometry panel to 720x480 (not sure if this is necessary, but doublecheck it).  Then in the frame controls panel, enable frame controls and change the resize filter to best, and rate conversion to 100% of source and rate conversion to best.  This may take a long time to output, so you might want to do a short test by setting an in and out in the compressor preview window.
    Hopefully, I haven't left anything out.  If there are any questions, post back.

  • ABAP code needed to convert from 0calmonth2 & 0calyear to 0calmonth

    Hi SAP GURUS,
    Can anybody give me the ABAP code to convert from 0calmonth2 and 0calyear to 0calmonth.and please suggest me whether i have to write start routine or end routine in transformations.
    Thanks ALL.

    hi,
    in the transformation map 0calmonth2 and 0calyear to the 0calmonth field, and from drop down choose routine.
    there will be an area where it will be mentioned write your piece of code below this line.
    paste the below code:
    Concatenate source_fields-0calmonth2 source_fields-0calyear into result.
    also delete the line result = .
    save the routine and execute the package.
    regards,
    Arvind.

  • The bullet list, numbered list and the normal text is not converting when I am converting from RH 9 to MS Word 2010

    Hi all,
    Greetings for the day
    I am created a new CSS in Robohelp 9. I have also created a new template in Word 2010. The style sets for different information elements like (Heading, bullets, body text, ) are more or less same between the CSS and the new templates. I am also able to map the .css styles to Word template when I am converting from RH to Word as I am getting the necessary option in the drop-down list.
    However, when the output is generated, the bullet, the numbered list and the body text is not converting at all. The body text works sometimes. However, the numbered list and bullet list is coming out as images.
    If anybody knows the solution, I can share the .css and Word template.
    Thanks in advance.
    Regards,
    Parag Deb

    Create a new project with two or three topics containing lists of both types. Generate a printed output that shows the problem. Then zip it up and send it to me. See the Contact page on my site for instructions.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How do I convert from pdf to word? I see an option to do so, however, when I click on it, Ia box opens...

    when I try to convert from pdf to word, a box opens and suggests I am to click on (select) the file I want to convert. It sounds all well but it does not work. I really really just want my files back in word, all of them, no matter, because after having to reinstall windows 7 (done by techs) and me having to re-download all my HP drivers, and tools, and other software, which I imagine included adobe reader, now I see some pdf files won't open. It says, "access denied" and boy that really makes me wantt o scream. I am the ONLY user, it is my notebook, I am the administrator so I can't figure out why some files open and some don't. I can't ascertain any difference.
    I would be grateful for any help. This has become just too exhausting. After reinstalling sooooooooo much, then to have to go through this with what is a free application? I say I think not.
    This should NEVER happen with any free application and boy there is NO help to be found. They blow you off the phone fast telling you it's a free application. Then why are you putting in this kind of  stuff that it won't open? This is NOT a shared notebook, it's mine. I am the only user, personal use.
    HP probook, if anyone needs that info.
    Please, will someone help?
    I would be so grateful.
    thanks,
    Gina

    Gee, Pat, this is a  real big help.
    Nobody could possibly think anyone would ask for help without first trying to fix the issue oneself. Or maybe you do. I have opened the file and looked under security. I have changed it to owner-notebook (which is what the techs called me) and clicked accept but geepers it didn't work.
    Maybe someone else has an idea.
    Take Ownership of a File or Folder
    The above should be a link. At least I copied and pasted the link. I did what was stated in there. It isn't like brain surgery. But it is not working. I ended up being able to open some pdf files after transferring them from one partition category to another. I wish it was that easy as you seem to think.
    Thanks for the help. Have a great year.

  • How do you stop DNG Converter from embedding Adobe's ACR default settings instead of custom settings?

    I notice that the new version of Adobe DNG Converter (8.6, and maybe earlier) appears to place Adobe's ACR defaults in the converted file.  Thus, the converted files open up in Bridge with an indication that they already have settings made, and, hence, ACR does not apply the custom camera settings.  One has to Clear Settings first in Bridge, then open in ACR.
    This behavior is new, perhaps to 8.6.  But it's presence defeats the purpose of having custom Camera Defaults.
    Is there any way to prevent DNG Converter from installing settings?

    ssprengel wrote:
    What do you mean by “custom camera settings”?  Do you mean you’ve changed the Camera Raw defaults for a particular camera and those aren’t being seen until you do a Reset?  Or do you mean some sort of Nikon-settings that Adobe never looks at?
    Also at what point in the workflow are you converting these files, just after copying them to your hard-disk and before touching them with any other Adobe software, or after they’ve been adjusted in Nikon software, or after they’ve been adjusted in Bridge/ACR, initially as NEFs?
    I mean my custom camera defaults that are set by the Save New Camera Defaults for a given camera.
    My workflow is to take my original raw files first into Adobe DNG Converter.  I then open the folder in Bridge.  At this point I notice that my original raw files remain unaltered (there is no "settings" icon in the top right corner – circle with two lines and up-arrows – in the image's thumbnail), but the converted dng's (otherwise untouched and unopened in ACR) have a "settings" icon.  When I open the original raw file in ACR, it opens using my custom camera defaults.  When I open the otherwise virgin dng in ACR, it opens using the Adobe defaults (the same defaults that would be employed if no custom camera default had been set).
    This behavior is new.  DNGs formed by earlier versions of the DNG Converter did not apply any settings to the converted file, and when they opened in Bridge, they were given the custom camera settings.
    In order to retain the old (and proper) behavior, I now have to take the just-converted documents into Bridge, select them, and immediately apply Develop Settings/Clear Settings.  That gets rid of the settings that have been installed by the DNG Converter (as well as the "settings" icon on the thumbnail).
    I notice there is a new feature in Adobe DNG Converter 8.6, namely, a panel-specific toggle between the settings and the default settings. This indicates to me the likelihood that Adobe has been making some alterations with the settings that is having unintended consequences.  It clearly is not proper for DNG Converter to be adding (installing) settings, because that prevents the custom camera default settings from being applied, and hence defeats the purpose of the custom camera default settings.

  • Applescript to convert from AW6 spreadsheets to Excel

    I have an iMac (iMac12,2) running OS 10.9.1 with applications of Pages’09 (4.3), Pages (5.0.1), Numbers’09 (2.3) and Numbers (3.0.1) available.
    One of my laptops is a MBA (MacBookAir1,1) that I have kept at 10.6.8 with applications Appleworks (6.2.2) and Appleworks (6.6.9) available.
    Recently, I converted many CWWP documents from AW6 into Pages.  This was done on the iMac with an Applescript that copied a file (AnyDocumentCWWP) to the desktop as a file named AWV6, opened AWV6 with Pages’09, saved the result as AWV6.Pages, applied the creation date and modify dates of the original to AWV6.Pages, moved the new AWV6.Pages to the original directory and moved the original file to the trash, renamed AWV6.Pages to the original filename (excluding extension).  The Pages version of the original document does not preserve the formatting of the CWWP, but the content was now discoverable with Spotlight.  Since I was primarily concerned with the content, I would consider the conversion effort successful enough.
    I performed the same sort of process on the iMac with CWSS documents converting from AW6 into Numbers.  Here the results were less successful.  I discovered that many of the converted spreadsheets had cells where the cell contained the last calculated value in substitute for the formula originally present -or- Numbers was unable to open the CWSS spreadsheet due to size limitations.  Neither problem occurs when the file is converted on the MBA by Appleworks into an Excel format.  For those CWSS files that did not properly convert to Numbers, I would like to perform a conversion to Excel.
    When a given spreadsheet is manually opened on the MBA with either version of Appleworks, one can “Save as” using several formats of Excel.  That operation will preserve the formula which cannot be recognized in Numbers’09. An example of this issue is when a spreadsheet has a cell that contains a formula with the function “ISNUMBER”.  When I manually open a CWSS in Appleworks (either 6.2 version), I can Save As Excel Win 97 … or Excel Mac 98 … creating an XLS file that preserves the formula.
    I have attempted two techniques with Applescript to be able to convert my CWSS documents into XLS format.  Neither seem to work.
    The first technique is very similar to a few lines extracted from a canned script found on http://macscripter.net/viewtopic.php?id=8296 the relevant code is:
    set theSprTranslator to "Excel Win 97, 2000, XP 2002 spr"
    tell application "System Events" to set mfpath to get path of disk item ("~/desktop/" as string)
    set newfile to (mfpath & "AWV6" as string)
    set NewFilename to AWV6XLS
    tell application "AppleWorks 6"
        activate
        open newFile -- alias reference is ok
        save using translator theSprTranslator with NewFilename and replace
        close front document without saving
    end tell
    When this did not work, I attempted a scripted GUI solution as a second option.  The GUI code I had found at http://stackoverflow.com/questions/17348326/applescript-to-save-an-appleworks-do cument-wont-compile-end-tell-vs-end-easy is:
    tell application "System Events"
             tell process "AppleWorks"
                     click menu item "Save As…" of menu "File" of menu bar 1
                     click menu button "File Format" of window "Save : AppleWorks 6"
                     click menu item "Excel Mac 5 spreadsheet" of menu 1 of menu button  "File Format" of window "Save : AppleWorks 6"
                     keystroke return
             end tell
    end tell
    Unfortunately there is no “File Format” menu button, after a bit of further research, I discovered UI Browser and wrote my own Applescript equivalent:
    set mytempwork1 to AWV6
    set theSprTranslator to “Excel Win 97, 2000, XP 2002 spr”
    tell application "Finder" to open file (mytempwork1 as string) of the desktop
    tell application "System Events"
        tell process "AppleWorks"
            click menu item "Save As…" of menu "File" of menu bar 1
            tell text field 1 of window "Save : AppleWorks 6"
                set value to "XX" & mytempwork1
            end tell
            click pop up button 1 of group 1 of window "Save : AppleWorks 6"
            click menu item theSprTranslator
            —click radio button 2 of group 1 of window "Save : AppleWorks 6"
            —delay 3
            —click radio button 1 of group 1 of window "Save : AppleWorks 6"
        end tell
    end tell
    tell application "System Events"
        tell process "AppleWorks"
            delay 10 — <<<<<IF YOU CLICK ON THE BUTTON WHILE IN THIS DELAY, THE SCRIPT WILL BEHAVE PROPERLY
            click button "Save" of window "Save : AppleWorks 6"
            delay 1
        end tell
    end tell
    This GUI script behaves almost as I would like.  It seems to ignore the setting of the “pop up button 1” unless I actually intervene while the script is running and I click on the button.  When I do so, the script runs as intended.
    Is there a way to force Appleworks to recognize the Applescripted value of the “clicked” menu item?

    Hello
    As far as I know, there's no need to resort to GUI scripting. The problem in exporting in AppleScript is that AppleWorks 6 only accepts typeChar (TEXT) data as translator name while AppleScript string has become always being represented as typeUnicodeText (utxt) since OS X 10.5. This makes passing translator name to save command difficult but there's a workaround method as shown in the sample code below. The |TEXT|() handler does the job. Tested with AppleWorks 6.2.4 under 10.6.8.
    main()
    on main()
        set export_translator to "Excel Mac 98, 2001 spreadsheet"
            "Excel Mac 5 spreadsheet"
            "Excel Mac 98, 2001 spreadsheet"
            "Excel Win 5 spreadsheet"
            "Excel Win 97, 2000, XP 2002 spr"
        set export_translator_TEXT to my |TEXT|(export_translator)
        set src to (path to desktop)'s POSIX path & "in.cwk"
        set dst to (path to desktop)'s POSIX path & "out.xls"
        set srca to src as POSIX file as alias
        set dsta to touch(dst) as POSIX file as alias
        tell application "AppleWorks 6"
            --return export translators
            open srca
            tell document 1
                if document kind = spreadsheet document then
                    save in dsta using translator export_translator_TEXT
                end if
                close saving no
            end tell
        end tell
    end main
    on touch(f)
        do shell script "touch " & f's quoted form
        return f
    end touch
    on |TEXT|(u)
            string u : source text
            return data : «data TEXT...» representing u converted to MACROMAN encoding
        do shell script "u=" & u's quoted form & "; printf '%s' \"$u\" | iconv -f UTF-8 -t MACROMAN | xxd -p"
        run (run script "
    script
        «data TEXT" & result & "»
    end script")
    end |TEXT|
    Hope this helps,
    H

  • Converting from a Business View connection to a non-Business View Error

    I have CR 2008 report with SP1. The report has a sub report. The main report is based off of a BV but the sub report is using an ODBC connection. When I try to update the ODBC connection I recieve an error message telling me that:
    Quote:
    "Converting from a Business View connection to a non-Business View connection is not supported."
    I am do not want to update the BusinessView just the ODBC connection for the subreport.

    Hi Michael,
    When you try to update both the Business views and ODBC connection you will be  prompted for  those errors.
    You need to break the link  in the report and update the connections individually.
    Thanks,
    Naveen.

  • Converting from a Business View connection to a non-Business View connectio

    I have a report on our Crystal Reports Server that I need to move to a machine with Crystal Reports XI installed and no connection to the Business Objects Server.
    When I create an ODBC connection pointing to the same table and then try to use Set Datasource Location to Update the Data Source I get an errormessage:
    Converting from a Business View connection to a non-Business View connection is not supported.
    What can I do? It is a complex report that I don't want to take the time and energy to rewrite.
    Thank You for any answers.
    <a href="http://farm4.static.flickr.com/3234/2942702182_72365cc04f_o.jpg">Screen Shot</a>

    Hello Brundibar,
    I recommend to post this query to the [Universe Designer and Business Views Designer|Semantic Layer; forum.
    This forum is dedicated to topics related to the universes and business views.
    It is monitored by qualified technicians and you will get a faster response there.
    Also, all Universe Designer and Business Views Designer queries remain in one place and thus can be easily searched in one place.
    Best regards,
    Falk

Maybe you are looking for