ArcSDE SHAPE to SDO_GEOMETRY conversion

Hello, savvy folks out there -
I have a huge ArcSDE database that I want to query using Oracle Spatial's SQL API. I imagine that I need to add an SDO_GEOMETRY column to each feature class (a spatial table, really) and replicate into it the geometry data serialized in the SHAPE column of the feature class. Then, I would basically have regular spatial tables the Oracle way and play from there (spatial indexes, metadata, SQL, etc. good stuff).
Is this the right general idea? If anyone has gone thru a similar excercise, please share.
Thanks!
Ilya

Hello Ilya:
Your approach looks sound, although I have never tried to do this conversion using the same source and destination tables. I would watch for mutating table errors. There are PL/SQL methods for avoiding this error.
How do you plan to convert the LONG RAW (SDEBINARY) to SDO_GEOMETRY?. In our office, we use FME (www.safe.com) to get this sort of thing done. You would need their highest level of licence (costliest) to read and write the ESRI Geodatabase and SDO_GEOMETRY. If you cannot afford this, I would recommend contracting this task to a data conversion house.
Another alternative is to use ArcCatalog to export the data into new tables, and set your geometry type parameter in the SDE.DBTUNE table to SDO_GEOMETRY using a keyword other than DEFAULT. See the "ArcSDE Configuration and Tuning Guide for Oracle" (ESRI publication) for details.
Good Luck -
Richard Clement
Alaska Department of Natural Resources

Similar Messages

  • JPA Error with SDO_GEOMETRY conversion

    Attempted to perform a native SQL query which invokes
    the Oracle SDO_UTIL.ELLIPSE_POLYGON() function within
    a JPA context and got a ClassCastException. Here is code snippet:
    try
    javax.persistence.Query query = entityManager_.createNativeQuery(
    "select SDO_UTIL.ELLIPSE_POLYGON( 32.4, 112.6, 1124.2, 992.4, 18.0, 5.0 ) from DUAL" );
    oracle.sql.STRUCT obj = ( oracle.sql.STRUCT ) query.getSingleResult();
    }catch( Exception e ) {}
    When the query is executed this error occurs:
    ERROR: java.lang.ClassCastException: org.eclipse.persistence.internal.helper.NonSynchronizedVector cannot be
    cast to oracle.sql.STRUCT
    NOTE: using Toplink 11G
    Thanks ...
    Edited by: user11177655 on Jul 22, 2009 12:45 PM

    I assume you are getting back a List (Vector) with the Struct inside it. Try ((List)query.getSingleResult()).get(0).
    In JPA you should get the Struct back directly if the result size was 1, otherwise an Object[], this was a bug in EclipseLink 1.0 that was fixed in EclipseLink 1.1.
    You should probably upgrade to EclipseLink 1.1.
    James : http://www.eclipselink.org

  • Differences between Oracle's and ArcSDE's validation routines

    I am having a small number of problems with valid Oracle geometries not displaying through ArcSDE.
    I have read the following on ESRI's website.
    Features stored in Oracle's SDO_GEOMETRY can be validated after storage using Oracle's validation subprograms, such as VALIDATE_GEOEMTRY_WITH_CONTEXT. The validation rules are similar to, but not the same as, ArcSDE shape validation rules.
    Does anyone know what these differences are?

    I found an example which shows a difference of ESRI's and Oracle's validation routines:
    A polygon with two holes where the holes share one point.
    Here is the Oracle version:
    SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 33, 2003, 1, 43,2003, 1),
    SDO_ORDINATE_ARRAY(128212.114, 395486.529, 128176.43, 395481.085, 128177.792, 395471.529,
    128178.503, 395466.629, 128178.886, 395464.634, 128179.276,395463.348, 128180.136, 395461.264,
    128180.967, 395459.722, 128183.295, 395460.172, 128184.51, 395458.984, 128186.224, 395458.298,
    128188.128, 395458.374, 128204.149, 395461.887, 128212.15, 395463.629, 128215.611, 395464.395,
    128212.114, 395486.529, 128193.512, 395475.783, 128192.739, 395480.726, 128202.224, 395482.209,
    128203.003, 395477.267, 128193.512, 395475.783, 128193.814, 395473.856, 128194.085, 395473.898,
    128194.57, 395470.854, 128195.977, 395471.074, 128196.503, 395467.712, 128195.108, 395467.493,
    128195.515, 395464.937, 128187.326, 395463.655, 128185.922, 395472.622, 128187.078, 395472.803,
    128186.778, 395474.73, 128193.512, 395475.783, 128193.814, 395473.856))
    ESRI ArcCatalog (ArcMap) 9.0 stops drawing with an error message when this geometry is in the data set.
    The 9.1.version shows the geometry and continues drawing but draws a line from the common point to the origin point (0,0)
    which looks a bit strange in a map.
    Validating by SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT gives the result: TRUE
    ESRI validation-tools show an error. After a correction by ESRI tools we
    get the following geometry:
    SDO_GEOMETRY(2007, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1, 33, 2003, 1),
    SDO_ORDINATE_ARRAY(128176.43, 395481.085, 128177.792, 395471.529, 128178.503, 395466.629,
    128178.886, 395464.634, 128179.276, 395463.348, 128180.136, 395461.264, 128180.967, 395459.722,
    128183.295, 395460.172, 128184.51, 395458.984, 128186.224, 395458.298, 128188.128, 395458.374,
    128204.149, 395461.887, 128212.15, 395463.629, 128215.611, 395464.395, 128212.114, 395486.529,
    128176.43, 395481.085, 128192.739, 395480.726, 128202.224, 395482.209, 128203.003, 395477.267,
    128193.512,395475.783, 128193.814, 395473.856, 128194.085, 395473.898, 128194.57, 395470.854,
    128195.977, 395471.074, 128196.503, 395467.712, 128195.108, 395467.493, 128195.515, 395464.937,
    128187.326, 395463.655, 128185.922, 395472.622, 128187.078, 395472.803, 128186.778, 395474.73,
    128193.512, 395475.783, 128192.739, 395480.726))
    This is a polygon with one hole.
    Now Oracle shows an error:
    The Oracle validation function gives the result:
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(SHAPE,DIMINFO)
    13349 [Element <1>] [Ring <2>][Edge <15>][Edge <4>]
    This is a self intersecting polygon.
    The two holes are now a self intersecting polygon.
    I didn't find any way to get a geometry that is accepted by Oracle and ESRI
    without modifications of coordinates.

  • Using OFFLINE_INSTANTIATION with a spatial object - SDO_GEOMETRY type

    Hello
    I am looking for guidance on the usage of DBMS_REPCAT_RGT.INSTANTIATE_OFFLINE for a table object with an SDO_GEOMETRY
    column defined.
    The table is:
    SQL> descr jtx.jtx_jobs_aoi
    Name Null? Type
    OBJECTID NOT NULL NUMBER(38)
    JOB_ID NUMBER(10)
    SHAPE MDSYS.SDO_GEOMETRY
    SE_ANNO_CAD_DATA BLOB
    The mview is defined as:
    CREATE MATERIALIZED VIEW jtx.JTX_JOBS_AOI REFRESH FAST WITH PRIMARY KEY FOR UPDATE AS
    SELECT * FROM JTX.JTX_JOBS_AOI@ncgsdb_master_s;
    And the command we are using is:
    SQL> SET SERVEROUTPUT ON
    SQL>
    SQL> DECLARE
    2 dt_num NUMBER;
    3 BEGIN
    4 dt_num := DBMS_REPCAT_RGT.INSTANTIATE_OFFLINE(
    5 refresh_template_name => 'jtx_refg_dt',
    6 user_name => 'jtx',
    7 site_name => 'NCGSDB_MVSITE1',
    8 next_date => SYSDATE,
    9 interval => 'SYSDATE + (1/96)');
    10 DBMS_OUTPUT.PUT_LINE('Template ID = ' || dt_num);
    11 END;
    12 /
    When we run this on an 11.1.0.6 database we get:
    DECLARE
    ERROR at line 1:
    ORA-30373: object data types are not supported in this context
    ORA-06512: at "SYS.DBMS_REPCAT_RGT_CUST", line 1991
    ORA-06512: at "SYS.DBMS_REPCAT_RGT", line 1330
    ORA-06512: at line 4
    Now the strange thing is this appears to work for ONLINE_INSTANTIATION.
    1. Is this supported?
    2. If so what are we doing wrong?
    Thanks
    Richard

    Here a full example with  CAST MULTISET as @PhilHerring wrote and with CAST COLLECT using the simplest possible function make_geometry:
    CREATE OR REPLACE TYPE t_sdo_geometries AS TABLE OF MDSYS.sdo_geometry;
    CREATE OR REPLACE FUNCTION make_geometry (p_points t_sdo_geometries)
      RETURN t_sdo_geometries IS
    BEGIN
      RETURN p_points;
    END;
    SELECT make_geometry (
            t_sdo_geometries (
              sdo_geometry(2001, 32774, sdo_point_type(1, 1, null), null, null),
              sdo_geometry(2001, 32774, sdo_point_type(2, 2, null), null, null),
              sdo_geometry(2001, 32774, sdo_point_type(3, 3, null), null, null),
              sdo_geometry(2001, 32774, sdo_point_type(4, 4, null), null, null)))
            AS geom
      FROM DUAL;
    WITH geoms(pcol) AS
    (SELECT sdo_geometry(2001, 32774, sdo_point_type(1, 1, null), null, null) FROM dual UNION ALL
      SELECT sdo_geometry(2001, 32774, sdo_point_type(2, 2, null), null, null) FROM dual UNION ALL
      SELECT sdo_geometry(2001, 32774, sdo_point_type(3, 3, null), null, null) FROM dual UNION ALL
      SELECT sdo_geometry(2001, 32774, sdo_point_type(4, 4, null), null, null) FROM dual)
    SELECT make_geometry(cast(multiset(select pcol from geoms a) as t_sdo_geometries)) FROM dual;
    WITH geoms(pcol) AS
    (SELECT sdo_geometry(2001, 32774, sdo_point_type(1, 1, null), null, null) FROM dual UNION ALL
      SELECT sdo_geometry(2001, 32774, sdo_point_type(2, 2, null), null, null) FROM dual UNION ALL
      SELECT sdo_geometry(2001, 32774, sdo_point_type(3, 3, null), null, null) FROM dual UNION ALL
      SELECT sdo_geometry(2001, 32774, sdo_point_type(4, 4, null), null, null) FROM dual)
    SELECT make_geometry(cast(collect(pcol) as t_sdo_geometries)) FROM geoms;
    Hope that helps
    _jum

  • How to [b]update[/b] [b]sdo_geometry[/b] field via [b]Database Link[/b]

    I need to update a geom field(defined as mdsys.sdo_geometry) of a remote table via database link,but I failed; This is the SQL statement and the error;
    update [email protected] set shape=mdsys.SDO_GEOMETRY(2002, NULL, NULL, mdsys.SDO_ELEM_INFO_ARRAY(1, 2, 1), mdsys.SDO_ORDINATE_ARRAY(2340411, 749349.375, 2340505.75, 749663.25, 2340571.75, 749924.813))
    where objectid=1;
    ORA-22804: remote operations not permitted on object tables or user-defined type columns
    How could I update geometry field of a remote table?
    Is there any method available ?
    Thanks!!

    Hi Percy,
    Oracle distributed does not support objects. If you are using 9i there might be just enough functionality to support what you want to do (replication required some distributed support, which might be enough for you).
    If it doesn't work then you may be out of luck with respect to distributed support, but you can connect to the remote database and update it that way.

  • How to view an oracle layer in esri products

    i have created a table in oracle spatial by the use of this command
    create table rectangle4( no number primary key, shape mdsys.sdo_geometry);
    insert into user_sdo_geom_metadata values ('rectangle4', 'shape',
    mdsys.sdo_dim_array(
    mdsys.sdo_dim_element('x', -180, 180, 0.0005),
    mdsys.sdo_dim_element('y', -90, 90, 0.0005)),82089);
    create index idx_rectangle14 on rectangle4(shape) indextype is mdsys.spatial_index
    i have got sdo_geometry inmy dbtune file.
    sdelayer -o describe -i sde:oracle9i -u spatial -p spatial@ocrc
    but when i am trying to view this feature in arcview then it gives error that abstract datatype is not supported.
    i am using direct connection to database. I have got both arcsde 9 n arcgis 9 and oracle 9i database.
    Even when i am using shp2sdo command still it gives me the same error.
    Regards
    Abida

    When i used sdelayer command it gives error "invalid column datatype (-53) while
    sdelayer -o register -l rectange4,shape -u spatial -p spatial@ocrc -i sde:oracle9i -e a -C no
    have created a table in oracle spatial by the use of this command
    create table rectangle4( no number primary key, shape mdsys.sdo_geometry);
    insert into user_sdo_geom_metadata values ('rectangle4', 'shape',
    mdsys.sdo_dim_array(
    mdsys.sdo_dim_element('x', -180, 180, 0.0005),
    mdsys.sdo_dim_element('y', -90, 90, 0.0005)),82089);
    create index idx_rectangle14 on rectangle4(shape) indextype is mdsys.spatial_index
    i have got sdo_geometry inmy dbtune file.
    sdelayer -o describe -i sde:oracle9i -u spatial -p spatial@ocrc
    but when i am trying to view this feature in arcview then it gives error that abstract datatype is not supported.
    i am using direct connection to database. I have got both arcsde 9 n arcgis 9 and oracle 9i database.
    Even when i am using shp2sdo command still it gives me the same error.
    sdelayer - describe worked properly
    but at the end again i got the same result

  • OBIEE -Spatial Data in ST Geometry

    Hi,
    Below is my sample spatial data in oracle 10g database.I am trying to build a OBIEE map with Google maps as background map.Can i  use the ST geomotry as below  directly or should i convert it to SDO geometry .I converted ST geometry to SDO  but when i use it for the maps in obiee the lines are all over the map.Can anyone suggest me the steps i need to take when the spatial data is in ST geometry.SRID for google mpas is 3785.
    ST GEMOTRY
    SDE.ST_GEOMETRY(8,20,-8236196.0936,4971596.5728,-8236021.1316,4971750.2835,NULL,NULL,NULL,NULL,8520.953541,512.173693478845,3857,'oracle.sql.BLOB@14f2c59')
    SDO GEOMETRY
    MDSYS.SDO_GEOMETRY(2003,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(-8236058.0112,4971596.5728,-8236049.1351,4971612.8814,-8236034.0083,4971640.7315,-8236025.6322,4971656.1619,-8236021.1316,4971664.1908,-8236034.878,4971671.5954,-8236036.5026,4971672.5993,-8236061.2461,4971686.0279,-8236089.489,4971701.3389,-8236179.0918,4971750.2835,-8236183.4673,4971742.2546,-8236196.0936,4971718.9202,-8236142.1072,4971688.8009,-8236116.7386,4971674.6197,-8236119.9892,4971667.8453,-8236082.6239,4971647.0125,-8236077.5001,4971644.2516,-8236084.1259,4971632.3338,-8236093.2518,4971616.0251,-8236058.0112,4971596.5728))

    Hi Syedurur,
    You may be in the wrong forum as OBIEE only utilizes MapViewer as far as I know.
    MapViewer
    So as Stefan notes, you are not going to be able to use SDE.ST_GEOMETRY with OBIEE as its not an Oracle product.  However, your ArcSDE registered MDSYS.SDO_GEOMETRY geometry should work fine.  Yet in your example you posted you seem to have Web Mercator (3857) ordinates but the SDO_SRID is WGS 84 (8307) so that is mangled and not going to draw anything correctly.  Try changing the SDO_SRID to 3857.
    Now Stefan is a bit incorrect about the ease of moving from SDE.ST_GEOMETRY to MDSYS.SDO_GEOMETRY.  The folks at ESRI make it simple to move in the other direction but - surprise! - not to move away from their proprietary spatial type. 
    ArcGIS Help (10.2, 10.2.1, and 10.2.2)
    Now you can still accomplish this by exporting your data from the geodatabase and then importing it back in as SDO but that is certainly not as simple as using the above one-step migration tool.
    In theory you could convert SDE.ST_GEOMETRY to MDSYS.SDO_GEOMETRY on the fly in the database with SQL.  Both ESRI and Oracle proudly spout their unwavering support for OGC standards.  Thus this should work
    SELECT MDSYS.SDO_GEOMETRY(SDE.ST_AsText(a.shape),8307) FROM my_ESRI_ST_GEO_table a;
    (Note change the 8307 to the matching Oracle SRID of your data)
    But my experience was that the very old Oracle Java WKT parser mixed with the somewhat non-standard ESRI External DLL WKT writer is not a very reliable combination.  But do give it a try and feel free to report back to us how it goes.  I really have not tried this in a couple of years so perhaps things are better now.
    Cheers and Happy New Years,
    Paul

  • Spatial Data in EJB with JBOSS

    Hello,
    how do I handle Entity Beans with spatial fields (type sdo_geometry)to JBoss?
    I have problems to insert data this way: I get
    an SQL-Exception "Invalid column type"
    I think the problem is the jdbc-datatype mapping in JBoss (jbosscmp-jdbc). No matter which jdbc-type I use, the exception occurs anyway.

    Hi Syedurur,
    You may be in the wrong forum as OBIEE only utilizes MapViewer as far as I know.
    MapViewer
    So as Stefan notes, you are not going to be able to use SDE.ST_GEOMETRY with OBIEE as its not an Oracle product.  However, your ArcSDE registered MDSYS.SDO_GEOMETRY geometry should work fine.  Yet in your example you posted you seem to have Web Mercator (3857) ordinates but the SDO_SRID is WGS 84 (8307) so that is mangled and not going to draw anything correctly.  Try changing the SDO_SRID to 3857.
    Now Stefan is a bit incorrect about the ease of moving from SDE.ST_GEOMETRY to MDSYS.SDO_GEOMETRY.  The folks at ESRI make it simple to move in the other direction but - surprise! - not to move away from their proprietary spatial type. 
    ArcGIS Help (10.2, 10.2.1, and 10.2.2)
    Now you can still accomplish this by exporting your data from the geodatabase and then importing it back in as SDO but that is certainly not as simple as using the above one-step migration tool.
    In theory you could convert SDE.ST_GEOMETRY to MDSYS.SDO_GEOMETRY on the fly in the database with SQL.  Both ESRI and Oracle proudly spout their unwavering support for OGC standards.  Thus this should work
    SELECT MDSYS.SDO_GEOMETRY(SDE.ST_AsText(a.shape),8307) FROM my_ESRI_ST_GEO_table a;
    (Note change the 8307 to the matching Oracle SRID of your data)
    But my experience was that the very old Oracle Java WKT parser mixed with the somewhat non-standard ESRI External DLL WKT writer is not a very reliable combination.  But do give it a try and feel free to report back to us how it goes.  I really have not tried this in a couple of years so perhaps things are better now.
    Cheers and Happy New Years,
    Paul

  • Spatial index on table with object-column (and inheritance)

    Hi!
    Is it possible to create a spatial index on a table with an object-column (and inheritance) like this:
    CREATE OR REPLACE TYPE feature_type AS OBJECT (
    shape MDSYS.SDO_GEOMETRY
    ) NOT FINAL;
    CREATE OR REPLACE TYPE building_type UNDER feature_type (
    name VARCHAR2(50)
    CREATE TABLE features ( no NUMBER PRIMARY KEY, feature feature_type);
    [...] user_sdo_geom_metadata [...]
    Then
    CREATE INDEX features_idx ON features(feature.shape) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    throws:
    ORA-01418: specified index does not exist
    Curious! :)
    If I define feature_type with "NOT FINAL" option but without subtypes, I get (create index):
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01460: unimplemented or unreasonable conversion requested
    So I think besides object tables also inheritance isn't supported whith oracle spatial!?
    Thanks,
    Michael
    ps:
    We use Oracle9i Enterprise Edition Release 9.0.1.4.0 / Linux.
    Solves Oracle9i 9.2 this problems?

    Hi
    You'll need to be on 9.2 to do this....
    Dom

  • 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

  • Problem with spatial query

    Sorry if this is not the right place but I am a GIS student facing trouble with my thesis' programming. I have completed the Ajax user interface with google API. My trouble is in running queries on Spatial Oracle 11g.
    I am using the Oracle SQL Developer together with the georaptor plugin
    (http://georaptor.sourceforge.net/install.xml) just to have some visualisation while evaluating the queries (without the need to execute the bulkier user web interface).
    I will transcode the queries in the interface later on.
    A simple table I have has the following DDL:
    =====================================================
    CREATE TABLE "HR"."RE_POINTS_SDO"
    (     "ID" NUMBER(38,0),
         "NAME" VARCHAR2(20 BYTE),
         "LAT" NUMBER,
         "LNG" NUMBER,
         "DATA" VARCHAR2(40 BYTE),
         "SHAPE" "MDSYS"."SDO_GEOMETRY"
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ;
    CREATE INDEX "HR"."RE_POINTS_SDO_GI" ON "HR"."RE_POINTS_SDO" ("SHAPE")
    INDEXTYPE IS "MDSYS"."SPATIAL_INDEX" ;
    CREATE UNIQUE INDEX "HR"."SYS_IL0000072032C00012$$" ON "HR"."RE_POINTS_SDO" (
    PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    PARALLEL (DEGREE 0 INSTANCES 0) ;
    CREATE UNIQUE INDEX "HR"."SYS_IL0000072032C00013$$" ON "HR"."RE_POINTS_SDO" (
    PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    PARALLEL (DEGREE 0 INSTANCES 0) ;
    =====================================================
    I am having a rather strange problem (sorry but error messages were in greek
    and I tried to translate them in english):
    =====================================================
    Error starting at line 1 in command:
    SELECT ID,NAME,LAT,LNG,DATA
    FROM RE_POINTS_SDO
    WHERE SDO_NN(shape,MDSYS.SDO_GEOMETRY(2001,null,MDSYS.SDO_POINT_TYPE(0,0,null),null,null))='TRUE'
    AND ROWNUM <=2
    Error report:
    SQL Error: ORA-29903: error while evaluating routine ODCIIndexFetch()
    ORA-13234: failure to access index table of the R-tree []
    ORA-13234: failure to access index table of the R-tree [MDRT Table]
    ORA-29400: error of data add-on (cartridge)
    ORA-01410: unacceptable ROWID
    29903. 00000 - "error in executing ODCIIndexFetch() routine"
    *Cause:    The execution of ODCIIndexFetch routine caused an error.
    *Action:   Examine the error messages produced by the indextype code and
    take appropriate action.
    ===============================
    I dropped the Rtree index and created from scratch (the table had the rows):
    ===============================
    drop index RE_POINTS_SDO_GI force;
    CREATE INDEX succeeded;
    ===============================
    But no change???? I am receiving the same errors:
    ===============================
    Error starting at line 1 in command:
    SELECT ID,NAME,LAT,LNG,DATA
    FROM RE_POINTS_SDO
    WHERE SDO_NN(shape,MDSYS.SDO_GEOMETRY(2001,null,MDSYS.SDO_POINT_TYPE(0,0,null),null,null))='TRUE'
    AND ROWNUM <=2
    Error report:
    SQL Error: ORA-29903: error while evaluating routine ODCIIndexFetch()
    ORA-13234: failure to access index table of the R-tree []
    ORA-13234: failure to access index table of the R-tree [MDRT Table]
    ORA-29400: error of data add-on (cartridge)
    ORA-01410: unacceptable ROWID
    29903. 00000 - "error in executing ODCIIndexFetch() routine"
    *Cause:    The execution of ODCIIndexFetch routine caused an error.
    *Action:   Examine the error messages produced by the indextype code and
    take appropriate action.
    ===============================
    Please help me (I really do not know where to look at).
    Regards from sunny springtime Athens, Greece
    Mike

    Here's some other things you can try..
    I create my indexes differently for more control.
    First put an entry in the user_sdo_geom_metadata table as the HR users.
    INSERT INTO USER_SDO_GEOM_METADATA
    VALUES
    'RE_POINTS_SDO',
    'SHAPE',
    MDSYS.SDO_DIM_ARRAY( MDSYS.SDO_DIM_ELEMENT('X', -180, 180, 0.0005 ),
    MDSYS.SDO_DIM_ELEMENT('Y', -90.0, 90.0, 0.0005 ) ),
    NULL
    Next create the index.
    DROP INDEX hr.re_points_sdo_gi FORCE;
    CREATE INDEX hr.re_points_sdo_gi
    ON hr.re_points_sdo (shape)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX
    PARAMETERS ('sdo_rtr_pctfree=0 LAYER_GTYPE=COLLECTION TABLESPACE=ts_name');
    The COLLECTION type is for shapes, POINT would be for coordinates.
    Next analyze the table
    exec DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => 'HR', TABNAME => 'RE_POINTS_SDO', CASCADE => TRUE);
    The query is asking to find the nearest object to the 0/0 coordinates. SDO_NN doesn't doesn't return the objects in closest order so you need to get the distance and then sort by distance.
    Change the query to this, it will return the 5 closest objects.
    SELECT ID,NAME,LAT,LNG,DATA,sdo_nn_distance(1) dist_in_miles
    FROM RE_POINTS_SDO
    WHERE SDO_NN(shape,MDSYS.SDO_GEOMETRY(2001,null,MDSYS.SDO_POINT_TYPE(0,0,null),null,null),'sdo_num_res=5 unit=mile',1)='TRUE'
    ORDER BY dist_in_miles;

  • Suggested query (9i) for 3-d Geodetic point-in-poly?

    Hi there,
    Just getting started with Spatial. Have a SDO_POINT_TYPE layer in 8307 (Geodetic Lat/Lon/Height) 3-dim, indexed with 2-dim (Lat/Lon) and want to know what the best way is to perform point-in-polygon queries on this layer (e.g. basic web-mapping interface)? I recently tried SDO_GEOM.RELATE but it was extremely slow, and incorrect....certainly something I'm doing wrong.
    Any help whatsoever is greatly appreciated.
    Thanks in advance,
    Michael

    Thanks very much.
    However, I the query doesn't seem to be giving me what I think it should. My index is two dimensions:
    create index I_MONUMENT_SHAPE on MONUMENT_CATALOG (SHAPE)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS('layer_gtype=POINT sdo_indx_dims=2');
    "SDO_RELATE" query:
    select mc.char_id as "ID",mc.shape as "Shape" from monument_catalog mc
    where SDO_RELATE(mc.shape,MDSYS.SDO_GEOMETRY(2003,8307,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
    -- MDSYS.SDO_ORDINATE_ARRAY(-110,20,-110,30,-100,30,-100,20,-110,20)),'mask=inside querytype=WINDOW') = 'TRUE';
    MDSYS.SDO_ORDINATE_ARRAY(-110,20,-110,30,-100,30,-100,20,-110,20)),'mask=anyinteract') = 'TRUE';
    ID Shape(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    BURR SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-110.066, 23.516, 535.02537), NULL, NULL)
    ANCN SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-110.03, 23.739, 481.56558), NULL, NULL)
    LPAZ SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-110.319, 24.139, -26.9092), NULL, NULL)
    BLND SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-110.309, 24.326, -10.21309), NULL, NULL)
    "vanilla sql" query:
    select mc.char_id as "ID",mc.shape as "Shape" from monument_catalog mc
    where mc.shape.SDO_POINT.X < -100
    and mc.shape.SDO_POINT.X > -110
    and mc.shape.SDO_POINT.Y < 30
    and mc.shape.SDO_POINT.Y > 20;
    ID Shape(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    CEBO SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-103.161, 20.09, 2009.12022), NULL, NULL)
    JARA SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-101.8, 21.264, 2016.36392), NULL, NULL)
    UMON SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-103.453, 20.737, 1626.65695), NULL, NULL)
    ineg SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-102.284, 21.856, 1888.67922), NULL, NULL)
    AYUT SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-104.374, 20.188, 1648.7741), NULL, NULL)
    CHAC SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-105.429, 20.383, 280.64762), NULL, NULL)
    COSA SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-103.325, 20.293, 1730.68995), NULL, NULL)
    GUAC SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-104.354, 20.501, 1581.31376), NULL, NULL)
    MCAB SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-103.493, 21.092, 1682.41884), NULL, NULL)
    SEBA SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-104.871, 20.699, 1973.90223), NULL, NULL)
    ECER SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-109.81, 24.18, 89.31145), NULL, NULL)
    EMIR SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-109.735, 23.366, 192.75321), NULL, NULL)
    RIVE SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-109.532, 23.549, 40.95293), NULL, NULL)
    LIM2 SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-103.528, 20.335, 1652.13807), NULL, NULL)
    SAUZ SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-103.225, 20.885, 1699.7295), NULL, NULL)
    7122 SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-106.459, 23.343, 27.9281), NULL, NULL)
    3033 SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-109.086, 25.692, -30.58101), NULL, NULL)
    7882 SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-109.864, 22.918, 115.09006), NULL, NULL)
    LIMA SDO_GEOMETRY(3001, 8307, SDO_POINT_TYPE(-103.548, 20.37, 2112.2829), NULL, NULL)
    Any idea why the SDO_RELATE query seems to be giving me stuff just ---outside--- my query window rather that stuff that lies inside?
    Thanks,
    Michael

  • Errors when creating spatial index

    Hi,
    I am new to OTN and oracle technology. I met a problem as I wanted to create a spatial index.
    I created a table 'geoobject' with a column 'shape' of sdo_geometry.
    The I run the following script:
    insert into user_sdo_geom_metadata values ('geoobject', 'shape',
    mdsys.sdo_dim_array(
    mdsys.sdo_dim_element('latitude', 0.0000, 50.0000, 0.000050),
    mdsys.sdo_dim_element('longitude', 0.0000, 80.0000, 0.000050)), 8265
    after that I insert data into the table:
    update geoobject set shape=
    mdsys.sdo_geometry(2001, 8265,
    mdsys.sdo_point_type
    (to_number((select latitude from temp_location where temp_location.gid = geoobject.geo_id)),
    to_number((select longitude from temp_location where temp_location.gid = geoobject.geo_id)), null),
    null, null);
    Then I wanted to create the spatial index:
    create index geoobject_idx on geoobject(shape)
    indextype is mdsys.spatial_index;
    But I got the error messages:
    Error in line 1:
    ORA-29855: Fehler bei Ausführung der Routine ODCIINDEXCREATE (Error at running routine ODCIINDEXCREATE)
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13230: Temporäre Tabelle [temp-table: M2_7A21$$] konnte während Erstellen von R-Baum nicht erstellt werden
    (temporary tables could not be established when R-tree was generated)
    ORA-29400: Data Cartridge-Fehler
    ORA-01659: Kann MINEXTENTS über 2 in Tablespace AMSDB hinaus nicht zuweisen
    ORA-06512: in "MDSYS.SDO_INDEX_METHOD_9I", Zeile 7
    ORA-06512: in Zeile 1
    I read some messages from the OTN forum and got to know to test the data with the following script:
    SELECT geo_id FROM geoobject
    WHERE SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(shape, .005) <> 'TRUE';
    All data passed this test.
    Could somebody give me some suggestions?
    regards,
    Yiwei

    My spatial index has been successfully generated after i enlarged the tablespace. But I encounter a new problem.
    I have saved many points in the table. I can use oracle spatial analyzer to see all the points. But as I tried to run the following query according to the examples in the oracle spatial user guider, I always get error messages. I have no idea about which problems there might be.
    The Query is:
    select geo_id, geo_name from geoobject g
    where mdsys.sdo_filter
    (g.shape, mdsys.sdo_geometry
    (2003, null, null,
    mdsys.sdo_elem_info_array(1, 1003, 1),
    mdsys.sdo_ordinate_array(25.00, 60.00, 25.00, 70.00, 35.00, 70.00, 35.00, 60.00, 25.00, 60.00)
    ), 'querytype=WINDOW') ='true'
    and sdo_relate
    (g.shape, mdsys.sdo_geometry
    (2003, null, null,
    mdsys.sdo_elem_info_array(1, 1003, 1),
    mdsys.sdo_ordinate_array(25.00, 60.00, 25.00, 70.00, 35.00, 70.00, 35.00, 60.00, 25.00, 60.00)
    ), 'masktype=TOUCH querytype=WINDOW') ='true';
    The error messages are:
    ERROR in line 1:
    ORA-29902: Fehler bei der Ausführung von Routine ODCIIndexStart()
    ORA-13207: Falsche Benutzung des Operators [SDO_FILTER]
    ORA-06512: in "MDSYS.SDO_INDEX_METHOD_9I", Zeile 368
    ORA-06512: in Zeile 1
    I use SRID = 8307, I want to use Geodetic Coordinate Support. For that reason, as I insert the information into the database, I just insert '8307' as the SRID both in the geo table and in the table user_sdo_geom_metadata. Except for that I did nothing which seems to be related to support geodetic coordination system. I think the problems might be here.
    I am looking forward to helps.
    Yiwei

  • Sdo_filter fail when query against a spatial view in different schema

    We have a table with X,Y coordinates and would like to run spatial query against it. We do not want to change the table structure, so we opt to use a function based index. USER_SDO_GEOM_METADATA is updated and index is built. Then we created a view with spatial column from the table. Everything works fine with the user who owns the table and view.
    When we try to run a spatial query against the view from a different user, it failed with error. However, if we substitute the select from my_view* with the actual SQL statement that created the view, it works. So it looks like Oracle refuse to acknowledge the spatial index if accessed via view. Here is some simplified scripts:
    --- connect as USER1.
    --update meta data
    INSERT INTO USER_SDO_GEOM_METADATA ( TABLE_NAME, COLUMN_NAME, DIMINFO, SRID ) VALUES
    ('LOCATIONS', 'MDSYS.SDO_GEOMETRY(2001,2264,SDO_POINT_TYPE(NVL(X_COORD,0),NVL(Y_COORD,0),NULL),NULL,NULL)',
    SDO_DIM_ARRAY( SDO_DIM_ELEMENT('X', 1300000, 1600000, 1), SDO_DIM_ELEMENT('Y', 400000, 700000, 1) ), 2264 );
    --created index
    CREATE INDEX LOCA_XYGEOM_IDX ON LOCATIONS
    ( SDO_GEOMETRY(2001,2264,SDO_POINT_TYPE(NVL(X_COORD,0),NVL(Y_COORD,0),NULL),NULL,NULL)
    ) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    --create view
    CREATE VIEW USER1.MY_VIEW AS SELECT ID ,X_COORD,Y_COORD, SDO_GEOMETRY(2001,2264,SDO_POINT_TYPE(NVL(X_COORD,0),NVL(Y_COORD,0),NULL),NULL,NULL) SHAPE
    FROM USER1.LOCATIONS WHERE X_COORD>0 AND Y_COORD>0;
    -- run spatial query from view, works fine by user1 by failed on user2.
    SELECT SHAPE FROM (
    SELECT * FROM USER1.MY_VIEW
    ) a WHERE sdo_filter (shape, sdo_geometry ('POLYGON ((1447000 540000, 1453000 540000, 1453000 545000, 1447000 545000, 1447000 540000))', 2264), 'querytype=window') = 'TRUE';
    -- run spatial query from table directly, simply replace the view with actual statements that created the view. works fine by user1 AND user2.
    SELECT SHAPE FROM (
    SELECT ID ,X_COORD,Y_COORD, SDO_GEOMETRY(2001,2264,SDO_POINT_TYPE(NVL(X_COORD,0),NVL(Y_COORD,0),NULL),NULL,NULL) SHAPE
    FROM USER1.LOCATIONS WHERE X_COORD>0 AND Y_COORD>0
    ) a WHERE sdo_filter (shape, sdo_geometry ('POLYGON ((1447000 540000, 1453000 540000, 1453000 545000, 1447000 545000, 1447000 540000))', 2264), 'querytype=window') = 'TRUE';
    When run against the view by user2, the error is:
    ORA-13226: interface not supported without a spatial index
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 1173
    13226. 00000 - "interface not supported without a spatial index"
    *Cause:    The geometry table does not have a spatial index.
    *Action:   Verify that the geometry table referenced in the spatial operator
    has a spatial index on it.
    Note, the SELECT SHAPE FROM (****) A WHERE SDO_FILTER(....) syntax is a third party application, all we have control is the part inside "(select ...)".
    So it appears Oracle is treating view differently. Have attempted fake the view name into USER_SDO_GEOM_METADATA, did not work. Also, granted select on the index table to user2, did not work.
    if we re-created the view in user2 schema, it worked for user2 but not user1, so it's not something we can do for every user.
    Searched the forum, no good match found. A few posts talked about "union all" in view caused the problem but I do not have the union.
    We are only use Oracle 10g Locator, not full spatial edition.
    Any ideas?
    Thanks!
    Edited by: liu.284 on Oct 4, 2011 12:08 PM

    It seems a bug, where a function-based spatial index is not correctly handled in a view query transformation.
    Not sure if the following works for you or not.
    add a new column "shape" (mdsys.sdo_geometry) in table locations, use a trigger and x_coord/y_coord
    to set values for this new column, and just create a normal spatial index on this new column. (drop the
    function-based spatial index). And create a view like:
    CREATE VIEW USER1.MY_VIEW2 AS SELECT ID , X_COORD, Y_COORD, SHAPE
    FROM USER1.LOCATIONS WHERE X_COORD>0 AND Y_COORD>0;

  • SDO_UTIL.FROM_WKTGEOMETRY doing some odd math

    Hello,
    Can anyone explain simply what's going on here with the WKT transformation? Why are the coordinates snapping to some kind of grid? How do I control this and where is this documented? Why would I want my coordinates to go from 14 digits of precision to 38 digits? I get the same results with the straightforward use of FROM_WKTGEOMETRY where the fucntion
    {color:#008000}SELECT
    MDSYS.SDO_GEOMETRY(
    'GEOMETRYCOLLECTION(POLYGON((
    -76.57573699951172 38.91845748333781,
    -76.57571822404861 38.91807558545071,
    -76.57517105340957 38.918440788391166,
    -76.57573699951172 38.91845748333781
    ',8265)
    from dual{color}
    results in
    {color:#008000}SDO_GEOMETRY
    2004,
    8265,
    NULL,
    SDO_ELEM_INFO_ARRAY
    1,
    1003,
    1
    SDO_ORDINATE_ARRAY
    -76.57573699951171875,
    38.91845748333781074279613676480948925018,
    -76.575718224048614501953125,
    38.91807558545070833133650012314319610596,
    -76.575171053409576416015625,
    38.9184407883911660519515862688422203064,
    -76.57573699951171875,
    38.91845748333781074279613676480948925018
    {color:#000000}Thanks,
    Paul{color}
    {color}

    Hello Siva,
    Thanks for answering my question, I appreciate your time. I would argue that the primary problem here is the utter lack of any documentation concerning this issue by Oracle. I am glad that Oracle will correct this in "the next version". Does that include 10g or just 11g? Does that mean that these utilities will be converted from java into the core database or just rewritten better in java?
    My organization serves basically as data middlemen and processors. We take data from various sources and then host it for services and analysis by our clients. The expectation is that we are not changing the source data beyond our documented processes (reprojection, etc). It not uncommon for a client to compare our output with the original data to see if we are following their specifications. As GIS professionals we value our ability to pass this scrutiny. I would argue that this java number jumble creates the impression of sloppiness. I do understand that this is meaningless in spatial terms.
    Lets look at my triangle again:
    Original valid WKT triangle from source
    {color:#008000}-76.57418668270113{color} {color:#000080}38.91891450597657{color}
    {color:#008000}-76.57484114170074{color} {color:#000080}38.91758725401061{color}
    {color:#008000}-76.57661139965057{color} {color:#000080}38.91881851059802{color}
    {color:#008000}-76.57418668270113{color} {color:#000080}38.91891450597657
    {color}
    After SDO_GEOMETRY conversion (results in invalid geometry)
    {color:#008000}-76.57418668270112505069846520200371742249{color} {color:#000080}38.91891450597657353682734537869691848755{color}
    {color:#008000}-76.57484114170074462890625{color} {color:#000080}38.91758725401061269622005056589841842651{color}
    {color:#008000}-76.57661139965057373046875{color} {color:#000080}38.91881851059802244208185584284365177155{color}
    {color:#008000}-76.57418668270112505069846520200371742249{color} {color:#000080}38.91891450597657353682734537869691848755
    {color}
    After correction via SDO_UTIL.RECTIFY_GEOMETRY
    {color:#008000}-76.5741866827011{color} {color:#000080}38.9189145059766{color}
    {color:#008000}-76.5766113996506{color} {color:#000080}38.918818510598{color}
    {color:#008000}-76.5748411417007{color} {color:#000080}38.9175872540106{color}
    {color:#008000}-76.5741866827011{color} {color:#000080}38.9189145059766
    {color}
    {color:#000000}So if we institute a test and autocorrection of badly converted geometries:
    {color}<ul><li>geometries which convert properly get nutty precision added (out to 38 places in many case)</li>
    <li>geometries which fail conversion and then are rectified actually lose precision</li>
    </ul>
    The issue here is explaining and documenting this so that clients are confident that we know what we are doing. If I pass someone two geometries with 14 digits of precision and they send me back one with 38 digits and a second with 12 digits I might wonder what the heck they are doing to my data. Is there any place where these issues are documented in depth by Oracle?
    Thanks again for your time,
    Paul

Maybe you are looking for

  • 10.4.10 image problem with Firefox and Photoshop on Intel and OD AFP server

    We are working on a new client image (perfect client image to deploy with Netboot) and our Intel machines, new and old, are throwing errors in CS2 Photoshop and refusing to launch Firefox when we log in to home folders from the OSXserver, local accou

  • Why wont iTunes wirelessly sync with my iPhone 5?

    Hi, I was wondering if somebody could help me. I have an iPhone 5, I am running the latest version of iTunes on my iMac and my iPhone is displayed on iTunes. It is ticked to wirelessly sync. Both devices connect to my home wifi. However more often th

  • IMessage contact names issue

    When receiving a notifcation from iMessage, the contact name does not appear. The notification only shows the Apple ID or the phone number of the person messaging me. However, in the iMessage app itself, the contact names correctly appear in the left

  • How do I know the version of Bootcamp installed on my machine?

    I am curious which version of Bootcamp I'm running.  Version information, or other Bootcamp program-level information not obvious in Applications or About My Mac. 

  • Can't remove default repository from EM

    Hi Please can someone give an idea on how to permanently delete the default repository from oracle enterprise manager winfow. I am on windows xp with OBIEE 11g. I tried commenting out the NQSConfig from Star, but it keeps getting re-created Reggards