Is it possible to create a spatial index on a view?

Hi
Is it possible to create a spatial index on a view?
We would like to link our spatial tables to each other (using only one of the SDO_GEOMETRY fields) in a view & make it very easy so that anybody can work with the data.
Thanks Caroline.

Simon,
In order for autoregistration to work, you first need to make sure that all entries in mdsys.sdo_geom_metadata_table are registered with SDE. All tables not just one schema. None of our spatial tables or views exist in the SDE schema.
Also make sure all Oracle Spatial tables in sde.table_registry are held in mdsys.sdo_geom_metadata_table.
When a user makes a database connection in ArcCatalog, all Oracle Spatial tables will be registered with SDE automatically. Also, entries will be inserted into mdsys.sdo_geom_metadata_table and indexes will be created. If you do not have primary key fields, you will have to Register with Geodatabase and it will create the OBJECTID field.
This did not work for us originally. but after cleaning up metadata and installing SP1, it is working now and it is very convenient.
VIEWS:
You have to create the view thru SDE. You cannot register foreign views. There are bugs in support of views containing SDO_GEOMETRY objects. I have been told some problems will be fixed in SP2 and there may be a patch out to address some others.
Here are the incidents I have filed in reference to views:
1.
I created a view consisting of a geometry column from a "foreign" Oracle
Spatial table (SDO_GEOMETRY) and corresponding attribution in another table.
I used the following command to create the view through SDE:
C:\arcgis\arcexe81\BIN>sdetable -o create_view -T gis_v_traffic -t
"trims_traffi c_geom,traffic" -c
"trims_traffic_geom.geometry,trims_traffic_geom.fid,traffic.i
d_number,traffic.aadt" -w "trims_traffic_geom.mslink = traffic.mslink" -u
gis -p spatial -i esri_sde -s JJ0DN10
ArcSDE 8.1 Build 832 Thu Mar 22 14:08:07 PST 2001 Attribute Administration
Utility ----------------------------------------------------- Successfully
created view gis_v_traffic.
I can preview the geometries in ArcCatalog without error.
However, when I try to select a feature in ArcMap I get the following error:
The instruction at "0x125222dd" referenced memory at "0x00000000". The
memory could not be "read".
I click ok.
Then I get this error:
The insruction at "0x5f8012d3" referenced memory at "0x00000004". the memory
could not be "read".
I click ok and ArcMap terminates.
I can select features from the spatial table the view is pointing to, but
not from the view itself.
2.
I need to create views utilizing database links to tie attribution in other
databases to geometries created for that data in a spatial database.
I issued the following command from command prompt and got this error:
C:\arcgis\arcexe81\BIN>sdetable -o create_view -T link_v_traffic -t
"trims_traff ic_geom,[email protected]" -c
"trims_traffic_geom.geometry,trims_traffic_ge
om.fid,[email protected],[email protected]" -w
"trims_t raffic_geom.mslink = [email protected]" -u gis -p
spatial -i esri_sd e -s JJ0DN10
ArcSDE 8.1 Build 832 Thu Mar 22 14:08:07 PST 2001 Attribute Administration
Utility ----------------------------------------------------- Error:
Underlying DBMS error (-51). Error: Unable to create view link_v_traffic
ORA-00957: duplicate column name (link_v_traffic)
3.
Spatial Views created on Oracle Spatial LRS layers containing SDO_GEOMETRY
objects are not recognized as feature classes unless they are created with
the sdetable -o create_view command.
Here is typical SQL for the view creation:
create or replace view trims_v_traffic as select a.geometry,
b.nbr_tenn_cnty, b.nbr_rte, b.spcl_cse, b.cnty_seq, b.tr_beg_log_mle,
b.tr_end_log_mle, b.yr_trfc, b.aadt, b.pct_peak_hr, b.dhv_pct, b.drct_distr,
b.vhcl_pass_pickups, b.vhcl_su_trk, b.vhcl_mu_trk, b.actl_cnt, b.updt_by,
b.updt_on, b.mslink, b.mapid, b.id_number, b.sta_nbr from
gis.trims_traffic_geom a, gis.traffic b where a.mslink = b.mslink;
The table containing the SDO_GEOMETRY object is registered with SDE in the
following manner:
C:\arcgis\arcexe81\BIN>sdelayer -o register -l trims_traffic_geom,geometry
-e slM -k SDO_GEOME
TRY -s JJ0DN10 -i esri_sde -u gis -p spatial -c fid -C SDE
A feature class is successfully created for this layer and the data can be
added successfully to a map.
However, there is no way of adding data to a map from a spatial database
view containing an SDO_GEOMETRY object which was created externally from
SDE.
We are using Oracle Spatial 8.1.7 on NT 4.0. We are also using ArcGIS 8.1
and ArcSDE 8.1.1.
4.
SDE does not support spatial database views which reference snapshot
objects.
I was unable to create a view using sdetable -o create_view which referenced
a snapshot object.
The snapshot was created using the following sql syntax:
CREATE SNAPSHOT SNP_TEST
BUILD IMMEDIATE
REFRESH FAST
ON DEMAND
AS
SELECT * FROM [email protected]
We are using ArcSDE 8.1.1 with Oracle 8.1.7 on NT 4.0.
Here are the permissions I granted, they need to be the same for every schema:
for sde (these are all the permissions that might be needed for any type of
activity - new install or upgrade)..lets just step through and go ahead and
grant them all...
grant create session to sde;
grant create table to sde;
grant create procedure to sde;
grant create sequence to sde;
grant create trigger to sde;
grant unlimited tablespace to sde;
grant select any table to sde;
grant create any sequence to sde;
grant create any procedure to sde;
grant execute any procedure to sde;
grant drop any procedure to sde;
grant select any sequence to sde;
grant create any view to sde;
grant drop any view to sde;
grant create any trigger to sde;
grant drop any sequence to sde;
each Oracle user will also need the following privileges...
grant create session to gis;
grant create table to gis;
grant create procedure to gis;
grant create sequence to gis;
grant create trigger to gis;
grant unlimited tablespace to gis;
Viewer
The viewer is allowed to connect to an ArcSDE database. Other users grant
select privileges on their tables and feature classes to the viewer or to
the public role. The DBA can create a role that can be granted select
privileges on data objects owned by other users. The role can be granted to
the viewer.
create session
select on other user's data objects
Editor
The editor is allowed to connect to an ArcSDE database. Other users grant
select and insert, update, or delete on data objects they own to editor. The
DBA may create a role that can be granted select, insert, update, and delete
privileges on data objects owned by other users. The role can be granted to
the editor.
create session
select, insert, update, or delete on other user's data objects
Creator
The creator is allowed to connect to an ArcSDE database and create data
objects. The creator may grant privileges on their
objects to other users or roles. Other users can grant select and insert,
update, or delete on data objects they own to creator. The DBA may create a
role that can be granted select, insert, update, and delete privileges on
data objects
owned by other users. The role can be granted to the creator:
create session
create table
create procedure
create sequence
create trigger
unlimited tablespace
select, insert, update, or delete on other user's objects
It might be worthwhile to rebuild your SDE metadata. I can walk you thru that if you need help.
Hope this helps.
Dave
null

Similar Messages

  • Create a spatial index on a large table

    Hi all
    I think that I might be starting to push XE beyond what it is capable of, but I thought I would ask here to see if anyone has some ideas how to get around my problem.
    I have a table with around 8,000,000 record in it. It has position data in it (SDO_GEOMETRY) which I would like to index. The geometry is not complex, just a single point for each record. The SQL I use is
    CREATE INDEX "ANNOTATION_TEXT_SX" ON "ANNOTATION_TEXT" ("GEOLOC") INDEXTYPE IS "MDSYS"."SPATIAL_INDEX"
    The command fails, due to memory issues. The errors thrown are
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13236: internal error in R-tree processing: [failed to cluster in memory]
    ORA-13232: failed to allocate memory during R-tree creation
    ORA-13236: internal error in R-tree processing: [failed to allocate memory 7272216 (mdrtsalloc)]
    ORA-04031: unable to allocate ORA-04031: unable to allocate 7272264 bytes of shared memory ("lar
    I have done a bit of reading up, this type of error generally occurs when the tablespace runs out of memory. Since I am using the SYSTEM tablespace, I figure I am running it out to its capacity before the index is completed.
    I have not created any other tablespaces. Is this an option to allow the creation of the index? Storage and Memory are at about 60% capacity (due to this one table) so is it just too big to create a spatial index on in XE? Am I barking up the wrong tree?
    Cheers
    James

    Good to see you are not using the SYSTEM tablespace. (And no need to apologize too profusely for being new at this - we all were at one time.)
    It normally doesn't matter how many rows are involved. The issue is how much actual space those rows require. 8,000,000 rows is actually not a lot in the GIS world, esp. if all you have is simple point data. Using the sdo_point field instead of the arrays should be a lot more compact as well.
    Some steps I would take:
    - Identify the actual amount of space used, in total as well as by tablespace. (One of the web-based admin screens can show you this.)
    - Load it all up usnig the free 'developer license' Enterprise Edition insead of XE just to verify it'll work.
    - Try indexing a smaller data set and see whether that works. (Export the table first) Delete about 1/2 rows and try indexing.
    The ORA-04031 is really telling you something about the SGA is not big enough. One of the SGA pools is trying to extend by 7M. Post the info about your SGA, as well ass some details about your machine (disk/processor/total memory)
    Message was edited by:
    forbrich
    The actual error causing the problem is the last line. It ends with "la and the rest is cut off. Could it have said 'large pool'???

  • Creating a spatial index problem

    Hi there
    I have to create a table in Oracle Spatial and use it with MapInfo MapX 4.51 OCX to insert some features in it.
    I read a thread in the MapX forum where I learnt that I had to create my table (CREATE TABLE statement), add a record in MAPINFO_MAPCATALOG table, and then add a line to the SDO_GEOM_METADATA_TABLE table. With this, I can add some features in the table by MapInfo, and I can use the INSERT clause in Oracle. Well. But when I try to use the table in MapX, I can't even load it nor insert a feature : I have an Oracle error saying "ORA-13226 interface not supported without a spatial index".
    When creating a spatial index in Oracle, I have got this message :
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
    ORA-06512: at line 1
    The index is still created but marked at FAILED, so it is now impossible to insert features in it (even by INSERT clause).
    The newly created table is empty, and it was created on the basis of another existing table. The records added in SDO_GEOM and MAPINFO_MAPCATALOG were copies of the records concerning the source table.
    And I have finally granted SELECT and UPDATE on SDO_GEOM_METADATA_TABLE table and USER_SDO_GEOM_METADATA view to the user doing the operations.
    Any clue ? I am using MapX 4.51 and Oracle 9.2.0.1.0.
    Thank you for any idea. I am puzzled.

    Hi,
    There is something wrong with accessing metadata.
    To identify where the problem is:
    - run the create-index from sqlplus (and not from mapx)
    - check whether the user creating the index can
    see the metadata from user_sdo_geom_metadata. (This
    user also needs create-table, create-sequence privs).
    Let us know what happens.
    - Ravi.

  • Problems creating a spatial index

    I have tried to create spatial indexes the same way that the MapInfo Easy Loader does but when I issue the following sql:
    CREATE INDEX SPATIAL.TEST_TABLE3_SX ON
    "SPATIAL".TEST_TABLE3(GEOMETRY)
    TABLESPACE SYSTEM PCTFREE 0
    I get the following error message:
    The following error has occurred:
    ORA-02327: cannot create index on expression with datatype ADT
    Which is described further in the Oracle documentation as follows:
    ORA-02327 cannot create index on expression with datatype string
    Cause: An attempt was made to create an index on a non-indexable expression.
    Action: Change the column datatype or do not create the index on an expression whose datatype is one of VARRAY, nested table, object, LOB, or REF.
    It seems as if spatial indexing can not be performed on the GEOMETRY column. However, both columns, GEOMETRY or GEOLOC, in each table, TEST_TABLE3 created by my java app and TEST4 created by EasyLoader, has the same type: SDO_GEOMTRY.
    How do I go about creating the spatial index?

    Hi,
    ORA-13354 incorrect offset in ELEM_INFO_ARRAY
    Cause: The offset field in ELEM_INFO_ARRAY of SDO_GEOMETRY references
    an invalid array subscript in SDO_ORDINATE_ARRAY.
    Action: Confirm that the offset is a valid array subscript in SDO_ORDINATE_ARRAY.
    So your geometry definition in the SDO_ELEM_INFO has an offset to a location in
    SDO_ORDINATES that doesn't exist.
    The correct call signature for sdo_geom.validate_layer is:
    begin
    sdo_geom.validate_layer('TEST_TABLE3','GEOMETRY','KEY_COLUMN','VALIDATION_TABLE');
    end;
    where:
    TEST_TABLE3 is the table name
    GEOMETRY is the column name
    KEY_COLUMN is the name of the column in the table that is a numeric key
    VALIDATION_TABLE is the name of a pre-created table that has the first field
    defined as a numeric and the second field defined as varchar2(10), e.g.:
    create table validation_table (id number, status varchar2(10));
    If you don't have a numeric key then you can't run this procedure, and perhaps
    to should run validate_geometry for each geometry in the layer:
    CREATE TABLE validation_results as
    SELECT SOME_KEY_FIELD,
    SDO_GEOM.VALIDATE_GEOMETRY(s.geometry,
    (SELECT diminfo
    FROM user_sdo_geom_metadata
    WHERE table_name = 'TEST_TABLE3'
    AND column_name = 'GEOMETRY')) STATUS
    FROM TEST_TABLE3 s;
    SELECT * FROM validation_results
    WHERE status <> 'TRUE';
    You can look at values in the SDO_ELEM_INFO field by doing the following:
    select a.geometry.sdo_elem_info from test_table3 a
    where (info that resticts the select to the row you are interested in);

  • Data Modeler - can't create a spatial indexes

    Good day, colleagues!
    I have a 584 release of Dala Modeler.
    Here is the cite from Oracle SQL Developer Data Modeler Guide:
    "3.82 Spatial Definition Properties
    Coordinate System ID: Oracle Spatial SRID value. ...
    +Create Spatial Index: Controls whether a spatial index is created.+
    Spatial Index Name: Name for the spatial index.
    I have a SDO_GEOMETRY column in my table and want to create spatial index.
    The problem is that there is no "Create Spatial Index" option in my Spatial Definition Properties window. There is only "Spatial Index Name" option. When I'm trying to create spatial index manually, I can't, because "Spatial" option for creating index is inactive. I've checked "Register as Spatial Table" table option, but it also didn't help.
    So, I have no way to create a spatial index. How can I do it?

    Hello usamytch,
    creation of spatial index is confusing. We'll improve it in next releases. Here are the steps:
    1) create index - no need to add columns
    2) create spatial column definition ("Spatial properties" in table dialog)
    3) In spatial column definition you can select your spatial column, coordinate system ID, dimensions and you can select one of existing indexes to be used as spatial one.
    4) after that index appear as spatial and you can set spatial related properties in index dialog
    5) you have to check "Register as Spatial Table" in order to get spatial meta-data generated in DDL
    There are additional spatial properties you can set in physical model.
    Philip

  • Spatial Index Problem in View

    Hello everyone.
    I have a table (A) that stores point locations (X,Y) and contains the following fields:
    ID NUMBER(10,0) No 1
    CD_CODIGO_EMA VARCHAR2(10 BYTE) Yes 2
    TX_NOMBRE_EMA VARCHAR2(50 BYTE) Yes 3
    CD_PROVINCIA_EMA NUMBER(5,0) Yes 4
    CD_MUNICIPIO_EMA NUMBER(5,0) Yes 5
    NU_UTMX_EMA NUMBER(10,2) Yes 6
    NU_UTMY_EMA NUMBER(10,2) Yes 7
    NU_HUSO_EMA NUMBER(5,0) Yes 8
    NU_TIPO_EMA NUMBER(3,0) Yes 9
    TX_URL_EMA VARCHAR2(255 BYTE) Yes 10
    I have created a view (V) with a field of type SDO_GEOMETRY values based on longitude (NU_UTMX_EMA) and latitude columns (NU_UTMY_EMA) in Table A, as follows:
    CREATE VIEW A_VIEW (ID, SHAPE)
    AS SELECT
    ID, MDSYS.SDO_GEOMETRY(2001, 83030, MDSYS.SDO_POINT_TYPE(NU_UTMX_EMA, NU_UTMY_EMA, NULL), NULL, NULL)
    FROM A
    I have updated the view USER_SDO_GEOM_METADATA:
    insert into user_sdo_geom_metadata values (
    'A_VIEW',
    'SHAPE',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('Longitude',90000,630000,0.005),
    MDSYS.SDO_DIM_ELEMENT('Latitude',3980000,4300000,0.005)
    83030
    I can see the spatial view in differentes clientes (for example, Geoserver and ArcMap). The problem is when I try to Zoom into the View I receive the message: Interface not supported without a spatial index+
    If I try to make an spatial index on the view, I receive the message:
    create index V_idx on A_VIEW(SHAPE) indextype is MDSYS.SPATIAL_INDEX;
    ORA-01702 A view is nos appropiate here.
    How can I fix it? The original table (A) has a spatial index and it works fine.
    Thanks in advance

    This should be answered in your other post:
    View with SDO_GEOMETRY column

  • Create local spatial index on range sub-partitions?

    Is is possible to create a local spatial index on a table with range sub-partitions? We're trying to do this on a table that contains lots of x,y,z point data.
    Trying to do so gives me the error: ORA-29846: cannot create a local domain index on a composite partitioned tableAccording to the spatial documentation:The following restrictions apply to spatial index partitioning:
    - The partition key for spatial tables must be a scalar value, and must not be a spatial column.
    - Only range partitioning is supported on the underlying table. All other kinds of partitioning are not currently
    supported for partitioned spatial indexes.So there is nothing saying it can or can't be done. The examples I've seen in the documentation tend to partition based on a single value and don't use subpartitioning.
    Example of what we're trying to do:SQL> SELECT * FROM V$VERSION;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    SQL>
    SQL> --- Create a table, partioned by X and subpartitioned by Y
    SQL> CREATE TABLE sub_partition_test
      2  (
      3      x               NUMBER,
      4      y               NUMBER,
      5      z               NUMBER,
      6      geometry        MDSYS.SDO_GEOMETRY
      7  )
      8  PARTITION BY RANGE (x)
      9  SUBPARTITION BY RANGE (y)
    10     (
    11     PARTITION p_x100 VALUES LESS THAN (100)
    12     (
    13                     SUBPARTITION sp_x100_y100 VALUES LESS THAN (100),
    14                     SUBPARTITION sp_x100_y200 VALUES LESS THAN (200),
    15                     SUBPARTITION sp_x100_yMAXVALUE VALUES LESS THAN (MAXVALUE)
    16     ),
    17     PARTITION p_x200 VALUES LESS THAN (200)
    18     (
    19                     SUBPARTITION sp_x200_y100 VALUES LESS THAN (100),
    20                     SUBPARTITION sp_x200_y200 VALUES LESS THAN (200),
    21                     SUBPARTITION sp_x200_yMAXVALUE VALUES LESS THAN (MAXVALUE)
    22     ),
    23     PARTITION p_xMAXVALUE VALUES LESS THAN (MAXVALUE)
    24     (
    25                     SUBPARTITION sp_xMAXVALUE_y100 VALUES LESS THAN (100),
    26                     SUBPARTITION sp_xMAXVALUE_y200 VALUES LESS THAN (200),
    27                     SUBPARTITION sp_xMAXVALUE_yMAXVALUE VALUES LESS THAN (MAXVALUE)
    28     )
    29  );
    Table created.
    SQL>
    SQL> -- Insert some sample data
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (1, 1, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(1, 1, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (50, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(50, 150, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (150, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 150, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (150, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 250, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (150, 300, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 300, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 210, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 210, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 150, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 250, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 300, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 300, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 250, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 160, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 160, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 290, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 290, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 320, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 320, 50), NULL, NULL));
    1 row created.
    SQL>
    SQL> -- Create some metadata
    SQL> DELETE FROM user_sdo_geom_metadata WHERE TABLE_NAME = 'SUB_PARTITION_TEST';
    1 row deleted.
    SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SUB_PARTITION_TEST','GEOMETRY',
      2  SDO_DIM_ARRAY(
      3     SDO_DIM_ELEMENT('X', 0, 1000, 0.005),
      4     SDO_DIM_ELEMENT('Y', 0, 1000, 0.005)
      5  ), 262152);
    1 row created.
    SQL>
    SQL> -- Create an Unusable Local Spatial Index
    SQL> CREATE INDEX sub_partition_test_spidx ON sub_partition_test (geometry)
      2    INDEXTYPE IS MDSYS.SPATIAL_INDEX
      3  LOCAL
      4  UNUSABLE;
    CREATE INDEX sub_partition_test_spidx ON sub_partition_test (geometry)
    ERROR at line 1:
    ORA-29846: cannot create a local domain index on a composite partitioned tableThanks,
    John

    Ok, thanks. That's what we're planning on doing now.
    SQL> CREATE TABLE partition_test
      2  (
      3      x               NUMBER,
      4      y               NUMBER,
      5      z               NUMBER,
      6      geometry        MDSYS.SDO_GEOMETRY
      7  )
      8  PARTITION BY RANGE (x, y)
      9     (
    10     PARTITION p_x100y100 VALUES LESS THAN (100, 100),
    11     PARTITION p_x100y200 VALUES LESS THAN (100, 200),
    12     PARTITION p_x100yMAX VALUES LESS THAN (100, MAXVALUE),
    13     PARTITION p_x200y100 VALUES LESS THAN (200, 100),
    14     PARTITION p_x200y200 VALUES LESS THAN (200, 200),
    15     PARTITION p_x200yMAX VALUES LESS THAN (200, MAXVALUE),
    16     PARTITION p_x300y100 VALUES LESS THAN (300, 100),
    17     PARTITION p_x300y200 VALUES LESS THAN (300, 200),
    18     PARTITION p_x300yMAX VALUES LESS THAN (MAXVALUE, MAXVALUE)
    19  );
    Table created.
    SQL>
    SQL> INSERT INTO user_sdo_geom_metadata VALUES ('PARTITION_TEST','GEOMETRY',
      2     SDO_DIM_ARRAY(
      3        SDO_DIM_ELEMENT('X', 0, 1000, 0.005),
      4        SDO_DIM_ELEMENT('Y', 0, 1000, 0.005)
      5     ), 262152);
    1 row created.
    SQL> CREATE INDEX partition_test_spidx ON partition_test (geometry)
      2     INDEXTYPE IS MDSYS.SPATIAL_INDEX
      3  LOCAL
      4  UNUSABLE;
    Index created.

  • Problems creating an spatial index with srid=4326

    Hi!
    I would like to know if somebody can help me with the following problem: We are using the 10.2.0.1 version and we need that our SRID value is 4326. We do not have problems with 8307 or another value. However, when we tried to use srid = 4326, appears the following error message:
    Error on line 17 CREATE INDEX SIDX_D3M_SDO_GEOMETRY ON DAT_3DM_MODEL (DM3_SDO_GEOMETRY) INDEXTYPE ORA-29855: an error in the execution of routine ODCIINDEXCREATE has taken place ORA-13249: internal error in Spatial index: [mdidxrbd] ORA-13249: Error initializing geodetic transform ORA-06512: in “MDSYS.SDO_INDEX_METHOD_10I”, line 10
    The PL/SQL that we used is the following one:
    DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = “DAT_3DM_MODEL”
    COMMIT
    INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID) VALUES('DAT_3DM_MODEL', 'DM3_SDO_GEOMETRY', MDSYS.SDO_DIM_ARRAY ( MDSYS.SDO_DIM_ELEMENT ('LONGITUDE', -180, 180, 0,05), -- MDSYS.SDO_DIM_ELEMENT ('LATITUDE', -90, 90, 0.05) ), 4326 )
    CREATE INDEX SIDX_D3M_SDO_GEOMETRY ON DAT_3DM_MODEL (DM3_SDO_GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX
    Thanks in advance,
    Susana.

    I cannot reproduce the error, in my environment. However:
    Your insert statement into USER_SDO_GEOM_METADATA appears to have included some typos. They might have happened, when transcribing. Please make sure you use the following:
    INSERT INTO USER_SDO_GEOM_METADATA (
    TABLE_NAME,
    COLUMN_NAME,
    DIMINFO,
    SRID)
    VALUES(
    'DAT_3DM_MODEL',
    'DM3_SDO_GEOMETRY',
    MDSYS.SDO_DIM_ARRAY (
    MDSYS.SDO_DIM_ELEMENT ('LONGITUDE', -180, 180, 10),
    MDSYS.SDO_DIM_ELEMENT ('LATITUDE', -90, 90, 10)),
    4326);
    However, the actual culprit is most certainly different. As I suspected, it might be related to the "decimal comma": In Germany, for instance, a decimal comma is used, instead of a decimal point. You have used a decimal comma in your original INSERT, as well (0,05 instead of 0.05).
    Please try the following:
    SQL> select wktext from cs_srs where srid = 4326;
    WKTEXT
    GEOGCS [ "WGS 84", DATUM ["World Geodetic System 1984 (EPSG ID 6326)", SPHEROID
    ["WGS 84 (EPSG ID 7030)", 6378137, 298.257223563]], PRIMEM [ "Greenwich", 0.0000
    00 ], UNIT ["Decimal Degree", 0.01745329251994328]]
    On your system, you will likely find a decimal comma, where my output has a decimal point. This is bug 5097326, which has been fixed, and backported to 10.2.0.3 and 10.2.0.4.

  • Is it possible to create a spatial view with paramete?

    Is it possible to create a view with parameter like following:
    SELECT GEOM FROM INTERSTATES WHERE MDSYS.SDO_FILTER(GEOM, MDSYS.SDO_GEOMETRY(2003, 8307, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 3), MDSYS.SDO_ORDINATE_ARRAY(?, ?, ?, ?)), 'querytype=WINDOW') = 'TRUE'
    so that I can specify ???? at run time.
    If not, is there a way to create a view that perform variable window query?

    You may want to look at application contexts, that way you may have code something like this:
    create or replace context gis_ctx using gis_params ;
    create or replace package gis_params
    as
    procedure set_bounds( minx in number, miny in number, maxx in number,maxy in number );
    end;
    create or replace package body gis_params
    as
    procedure set_bounds( minx in number, miny in number, maxx in number,maxy in number )
    is
    begin
    dbms_session.set_context( 'gis_ctx', 'minx', minx);
    dbms_session.set_context( 'gis_ctx', 'miny', miny);
    dbms_session.set_context( 'gis_ctx', 'maxx', maxx);
    dbms_session.set_context( 'gis_ctx', 'maxy', maxy);
    end ;
    end ;
    To use this method you´ll have to execute
    gis_params.set_bounds(-3,40,-2.9,40.1) ;
    before doing the select.
    SELECT GEOM
    FROM INTERSTATES
    WHERE MDSYS.SDO_FILTER(GEOM,
    MDSYS.SDO_GEOMETRY(2003,
    8307,
    NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 3),
    MDSYS.SDO_ORDINATE_ARRAY(sys_context ('gis_ctx', 'minx'),
    sys_context ('gis_ctx', 'miny'),
    sys_context ('gis_ctx', 'maxx'),
    sys_context ('gis_ctx', 'maxy'))),
    'querytype=WINDOW') = 'TRUE' ;
    I f you are in a web environment, read about GLOBAL CONTEXT ACCESSED GLOBALLY .
    Regards, Nico.

  • Ora-29879 on creating a spatial index

    Database version 11.2.0.1
    --STEP 1
    DELETE FROM USER_SDO_GEOM_METADATA WHERE table_name='P_WALLACE_WORKPLAN';
    commit;
    --STEP 2
    INSERT INTO USER_SDO_GEOM_METADATA
    (table_name, column_name, diminfo,srid )
    VALUES ('P_WALLACE_WORKPLAN','GEOMETRY',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('X', -2.147E+09, 2147483647, .000005),
    MDSYS.SDO_DIM_ELEMENT('Y', -2.147E+09, 2147483647, .000005)),4000000);
    commit;
    select * from user_sdo_geom_metadata WHERE table_name='P_WALLACE_WORKPLAN';
    -- RECORD DOES EXIST
    --STEP 3
    drop index P_WALLACE_WORKPLAN_INDX_RTREE force;
    -- DOESNT EXIST
    --STEP 4
    CREATE INDEX P_WALLACE_WORKPLAN_INDX_RTREE
    ON P_WALLACE_WORKPLAN (GEOMETRY) INDEXTYPE IS
    MDSYS.SPATIAL_INDEX PARAMETERS (' SDO_INDX_DIMS=3
    LAYER_GTYPE="COLLECTION" SDO_RTR_PCTFREE=2 INITIAL=64K
    NEXT=8192 MINEXTENTS=1 MAXEXTENTS=2147483645 PCTINCREASE=0');
    --error ORA-29879 cannot create multiple domain indexes on a column list using same indextype                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Your example works for me with little adjustments:
    DROP   TABLE P_WALLACE_WORKPLAN;
    CREATE TABLE P_WALLACE_WORKPLAN(
      id       NUMBER,
      GEOMETRY MDSYS.SDO_GEOMETRY);
    DELETE FROM USER_SDO_GEOM_METADATA WHERE table_name='P_WALLACE_WORKPLAN';
    COMMIT;
    --STEP 2
    --  SRID 4000000 does not exist ?!
    --  changed to 2029
    --  added third dimension
    INSERT INTO USER_SDO_GEOM_METADATA
    (table_name, column_name, diminfo,srid )
    VALUES ('P_WALLACE_WORKPLAN','GEOMETRY',
      MDSYS.SDO_DIM_ARRAY(
      MDSYS.SDO_DIM_ELEMENT('X', -2.147E+09, 2147483647, .000005),
      MDSYS.SDO_DIM_ELEMENT('Y', -2.147E+09, 2147483647, .000005),
      MDSYS.SDO_DIM_ELEMENT('Z',          0,      10000, .000005)
        ),2029);
    COMMIT;
    SELECT table_name from user_sdo_geom_metadata
    WHERE table_name='P_WALLACE_WORKPLAN';
    -- RECORD DOES EXIST
    --STEP 3
    DROP INDEX p_wallace_workplan_indx_rtree FORCE;
    -- DOESNT EXIST
    --STEP 4
    --   here the geometry is 3-dimensional
    CREATE INDEX P_WALLACE_WORKPLAN_INDX_RTREE
      ON P_WALLACE_WORKPLAN (GEOMETRY) INDEXTYPE IS
      MDSYS.SPATIAL_INDEX PARAMETERS (' SDO_INDX_DIMS=3
      LAYER_GTYPE="COLLECTION" SDO_RTR_PCTFREE=2 INITIAL=64K
      NEXT=8192 MINEXTENTS=1 MAXEXTENTS=2147483645 PCTINCREASE=0');

  • 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

  • Error when creating spatial index in 10g

    Hello.
    I have a problen when I try to create a spatial index. The strange thing is that the same commands always works fine in some machines, but if always fails in others. I tryed in diferent versiones of Oracle, but I have the error in al of them. The versions I have tryed are:
    - 10.2.0.1
    - 10.2.0.4
    The operating systems are:
    Windows XP professional 32 bits
    Windows 2003 Server 32 bits
    These are the steps i make:
    1) Create a Table with a SDO_GEOMETRY column (GEOMETRY)
    2) Load data with SQLLDR (I hve tryed different SRID's, and all fail)
    So far everything is ok
    3) Create the INDEX
    When I execute the CREATE INDEX command CREATE INDEX MADRID_SX ON MADRID (GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    I obtain the error:
    ERROR en linea 1:+
    ORA-29855: se ha producido un error en la ejecucion de la rutina+
    ODCIINDEXCREATE+
    ORA-13282: fallo al inicializar la transformacion de coordenadas+
    ORA-06512: en "MDSYS.SDO_INDEX_METHOD_10I", line 10+
    I too have noticed that if I execute the next command, I have an error:
    SELECT MDSYS.sdo_cs.transform(sdo_geometry(2001,8192,sdo_point_type(13.6,52.4,null),null,null),25830) from dual;
    ERROR en linea 1:+
    ORA-13282: fallo al inicializar la transformacion de coordenadas+
    ORA-06512: en "MDSYS.SDO_CS", linea 75+
    ORA-06512: en "MDSYS.SDO_CS", linea 112+
    ORA-06512: en "MDSYS.SDO_CS", linea 2678+
    And if I execute the next command, I too have another error:
    SELECT SDO_CS.VALIDATE_WKT(25830) FROM DUAL;
    FALSE (169)*
    Any ideas? Could it be related with something inside the machines, user privileges, etc.?
    Thanks in advance.

    I have found that the problem is to use a SRID of AUTH_NAME column in MDSYS.CS_SRS table without the value "Oracle." in it.
    If I use an Oracle’s SRID, everything works fine. If I use an EPSG’s SRID, fails.
    For example, this command uses an Oracle SRID (8192) and one from the EPSG (25830), and fails:
    SELECT MDSYS.sdo_cs.transform(sdo_geometry(2001,8192,sdo_point_type(13.6,52.4,null),null,null),25830) from dual;
    ERROR en linea 1:
    ORA-13282: fallo al inicializar la transformacion de coordenadas
    ORA-06512: en "MDSYS.SDO_CS", linea 79
    ORA-06512: en "MDSYS.SDO_CS", linea 116
    ORA-06512: en "MDSYS.SDO_CS", linea 2690
    However, if I use two Oracle SRID (8192 and 83030), it works.
    SELECT MDSYS.sdo_cs.transform(sdo_geometry(2001,8192,sdo_point_type(13.6,52.4,null),null,null),83030) from dual;
    SDO_GEOMETRY(2001, 83030, SDO_POINT_TYPE(1625183.71, 5936269.06, NULL), NULL, NULL
    Therefore, the problem seems to be to use a non Oracle SRID.

  • Creating spatial indexes at the same time

    Are there any locks on common DB objects when spatial index is created on one table?
    We have application which creates a table with geometry column, fills this table and at the finish creates the spatial index. It seems, that this blocks other users to do this on other tables. The problem is also when the index on large table is created outside the application and this blocks the index creation for app users.
    regards
    Saso

    Hi,
    I believe you can create multiple spatial indexes concurrently. I'm not sure if there are special database parameters, but on my default Oracle9i release 2 install I can create multiple indexes at the same time.
    Users cannot query the table using spatial operators until the index is built. Adding/deleting data may also be disabled while the index is building. Accessing data is allowed.
    Can you describe the sequence of steps where the blocking occurs?

  • ORA-29855 while creating spatial index

    Hello, I am having trouble creating a spatial index.
    When I execute the following:
    create index la2003geoidx on polygons("GEOMETRY1")
    indextype is mdsys.spatial_index;
    I get the error
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    I've seen a few topics in this forum that mention this error, but in my case that is the ONLY error message.

    whew. had trouble with the login.
    Hi Daniel,
    we are using 8.1.6 with the latest patches available. We have been using a spatial database for some time, but have never gotten the indexing to work. We always got wierd stuff, but now it's just the one error message.
    We are using Geomedia Pro 4 to access the data on the client end, if that makes a difference

  • Problem on creating spatial index

    Hi,
    I am newbie in Oracle Spatial and looking for help on creating spatial index
    I am working on OpenStreetMap data. I intended to import the OSM data from PostGis to Oracle Spatial. This code is executed to import the data
    ogr2ogr -f OCI OCI:osm/password@pdborcl PG:"host=localhost user=postgres password=password dbname=gis port=5432" -lco OVERWRITE=yes -lco SRID=8307 -nln planet_osm_polygon planet_osm_polygon
    However, I got this error when importing the data.
    ERROR 1: ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in spatial index: [mdrcrtxfergm]
    ORA-13249: Error in spatial index: [mdpridxtxfergm]
    ORA-13200: internal error [ROWID:AAAW/iAAQAAAIfsAAP] in spatial indexing.
    ORA-13206: internal error [] while creating the spatial index
    ORA-13033: Invalid data in the SDO_ELEM_INFO_ARRAY in SDO_GEOMETRY object
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    in CREATE INDEX "OSI_12283" ON PLANET_OSM_POLYGON("ORA_GEOMETRY") INDEXTYPE IS
    MDSYS.SPATIAL_INDEX
    This creating index failure only happen when I tried to import planet_osm_polygon table. I did not get this error when I imported the planet_osm_point, planet_osm_roads and planet_osm_line and indexing worked fine. The geometry type of column which was failed to index is ST MultiPolygon ( I am not sure if this is the cause).
    Apparently, the data is imported to database. I tried to create index on that table, and it returns the same error.
    CREATE INDEX PLANET_OSM_POLYGONI ON PLANET_OSM_POLYGON(ORA_GEOMETRY)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    Please help!

    Hi Ivan Bush
    Thank you for the reply.
    Sorry for the lengthy reply. To be honest, I dont understand how to read query result. This is the query that I executed:
    select * from (select sdo_geom.validate_geometry_with_context(p.ora_geometry, 0.05) from planet_osm_polygon p) where rownum <100;
    And the snippet of the query result:
    Could you help me to explain the meaning of the query result? I chose 0.05 as tolerance value based on this reference (http://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_intro.htm#i884589) .
    Anyway, this information might be useful in solving the problem. When I imported the OSM data to PostGis, the SRID of geometry data was 900913. Since I want the data in WGS84 coordinate system, I change the SRID of the geometry data to 4326. I could perform this below-mentioned PostgreSQL query to change its SRID for geometry column in table planet_osm_point, planet_osm_roads and planet_osm_line. However, this query did not work on planet_osm_polygon one since this query does not recognize multipolygon datatype.
    ALTER TABLE planet_osm_point
        ALTER COLUMN way TYPE geometry(point,4326) USING ST_Transform(way,4326);
    So for planet_osm_polygon case, I check this post (QGIS, Postgis: Geometry type does not match column type - Geographic Information Systems Stack Exchange) and follow @dbaston's answer to change the geometry data type to generic'geometry'. Then change the SRID, and return the geometry data type to MultiPolygon.
    ALTER TABLE planet_osm_polygon ALTER  COLUMN way SET data type geometry(MultiPolygon) USING ST_Multi(way);
    Let me know if this might be the cause of the indexing problem.

Maybe you are looking for

  • How to set the size of a Font in Pixel?

    Hi, i know how to get the screen resolution of the current monitor and I know how to use Fonts (and I know how to read the API, but that didnt help). Is there a way to set the size (or at least the height) of a Font in pixel rather then in points? Al

  • My iPod has files "in use by another application"?

    Ever since the new iTunes version came out, my iPod classic says this. It erased everything on it and now will not let me sync it. Is there anyway I can fix this by myself or is this something I have to take it in for? I've repeatedly restored it wit

  • Can I change a hard cover book to soft cover?

    I've spent hours creating a photobook on iphoto and now that I'm ready to buy, I wish it were soft cover.  Can I change it at the last minute?  I can't figure out how to.

  • Wireless internet can't connect in morning

    There are many mornings when I find my internet connection disconnected. I can usually get connection by going to my Network prefs and clicking the Renew DHCP Lease button. Sometimes I have to go to my router's settings page to manually connect by hi

  • CRM- Find Service contract from Internal Order Number

    Hi Friends, I would like to know how to get service contract from internal oredr number. From service contract we can find internal order number by using CRM_ORDER_READ function module- table et_document_flow, but my requirement is how to find servic