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

Similar Messages

  • 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

  • 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.

  • Extracting start/end vertex... no spatial index problem - please help!

    Hi All,
    I've got a table of lines and i'm trying to create a view of the start and end points of each line. I've managed to do this but i want to display it as a layer in my wms and i keep getting the no spatial index error.
    I've tried a couple of ways of doing this...
    1) using getvertices and extracting the start and end, then reconstructing an sdo_geometry in the view - can quite understand the no spatial index error here.
    2) using SDO_LRS.GEOM_SEGMENT_END_PT and SDO_LRS.GEOM_SEGMENT_START_PT - would of thought this would use the index on the base table?
    Any other methods or help would be most appreciated..
    Thanks

    You might be able to do this using a function-based index (with no view). Here is a quick example (using a table I have):
    DELETE FROM USER_SDO_GEOM_METADATA
    WHERE TABLE_NAME = 'NTC_MAP_ROAD_HIGHWAY_AGGR'
    AND COLUMN_NAME = 'MDSYS.SDO_LRS.GEOM_SEGMENT_START_PT(GEOMETRY)';
    INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
    VALUES ('NTC_MAP_ROAD_HIGHWAY_AGGR', 'MDSYS.SDO_LRS.GEOM_SEGMENT_START_PT(GEOMETRY)',
    SDO_DIM_ARRAY
    (SDO_DIM_ELEMENT('LONG', -180.0, 180.0, 0.5),
    SDO_DIM_ELEMENT('LAT', -90.0, 90.0, 0.5)
    8307);
    COMMIT;
    drop index NTC_MAP_ROAD_HWY_AGGR_FBSIDX;
    create index NTC_MAP_ROAD_HWY_AGGR_FBSIDX
    on NTC_MAP_ROAD_HIGHWAY_AGGR(MDSYS.SDO_LRS.GEOM_SEGMENT_START_PT(GEOMETRY))
    indextype is mdsys.spatial_index;
    select link_id, MDSYS.SDO_LRS.GEOM_SEGMENT_START_PT(GEOMETRY)
    from NTC_MAP_ROAD_HIGHWAY_AGGR
    where sdo_filter(MDSYS.SDO_LRS.GEOM_SEGMENT_START_PT(GEOMETRY),
    sdo_geometry(2003,8307,null,sdo_elem_info_array(1,1003,3),
    sdo_ordinate_array(-122.5,37.5,-122.3,37.7)))='TRUE';

  • Spatial Index problem again

    I have a TAR open and I am awaiting an answer, but the representative is based in Austraila so I am assuming I will not get another answer until tomorrow, so hopefully someone can see what I have going on and can offer some advice (Thanks in advance Dan :-) )
    Trying to create my spatial index:
    create index locations_test_sidx on locations_test(map_loc_data) indextype is
    mdsys.spatial_index
    ERROR at line 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:AAAJMWAADAAAJsLAEp] in spatial indexing.
    ORA-13206: internal error [] while creating the spatial index
    ORA-13032: Invalid NULL SDO_GEOMETRY object
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
    ORA-06512: at line 1
    Our Data in the table looks like the following:
    Yuma Proving Ground, AZ SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(32.773,-114.5, NULL), NULL, NULL)
    I do not understand why I am getting the ORA-13032 error. From all that I have on documentation my table is created correctly. Here is a script I used to create my Spatial Table, maybe somethng in there will give some pointers as to what is wrong.
    Thank you!
    declare
    lv_loc_id locations.location_id%TYPE;
    lv_lat locations.latitude%TYPE;
    lv_long locations.longitude%TYPE;
    CURSOR loc
    IS
    SELECT DISTINCT location_id
    FROM locations_test
    WHERE state IS NOT NULL;
    BEGIN
    OPEN loc;
    LOOP
    FETCH loc
    INTO lv_loc_id;
    EXIT WHEN loc%NOTFOUND;
    SELECT latitude,
    longitude
    INTO
    lv_lat,
    lv_long
    FROM locations_test
    WHERE location_id = lv_loc_id;
    UPDATE locations_test
    SET map_loc_data = MDSYS.SDO_GEOMETRY(
    2001,
    8307,
    MDSYS.SDO_POINT_TYPE(lv_lat,lv_long,NULL),
    NULL,
    NULL)
    WHERE location_id = lv_loc_id;
    END LOOP;
    CLOSE loc;
    END;

    Here is the update:
    Recreated the Index, YAY no errors!!!
    Trying to generate my map though in Mapviewer gives the following:
    05/03/30 12:06:42 java.sql.SQLException: ORA-29902: error in executing ODCIIndex Start() routine
    ORA-13208: internal error while evaluating [window SRID does not match layer SRID] operator
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 259
    Here is the code that I am generating my map with:
    <?xml version="1.0" standalone="yes"?>
    <map_request
    title="Testing Dynamic Themes"
    basemap="Demo_MAP"
    datasource ="mvdemo"
    width="640"
    height="480"
    bgcolor="#a6cae0"
    antialiase="false"
    format="PNG_STREAM">
    <center size="45">
    <geoFeature
    render_style="M.cyan pin"
    label="Center" label_always_on="true"
    text_style="T.Title" radius="100000">
    <geometricProperty>
    <point>
    <coordinates>-96.2, 39</coordinates>
    </point>
    </geometricProperty>
    </geoFeature>
    </center>
    <themes>
    <theme name="Locations">
    <jdbc_query
    datasource="mvdemo"
    spatial_column="map_loc_data"
    render_style="M.STAR"
    label_column="CITY"
    label_style="T.CITY NAME">
    select map_loc_data
    from resources.locations_test l
    where l.country = 'US'
    and l.region_ID = 1
    and l.location_id IN (Select distinct d_loc_id from cii.devices)
    </jdbc_query>
    </theme>
    </themes>
    </map_request>
    this does display a map with a center point, just none of the cities are labeled or displayed.
    Here is my USER_SDO_GEOM_METADATA
    TABLE_NAME
    COLUMN_NAME
    DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SRID
    LOCATIONS_TEST
    MAP_LOC_DATA
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('LONGITUDE', -180, 180, .5), SDO_DIM_ELEMENT('LATITUDE', -90, 90, .5))
    8307
    Here is an example of my data:
    LOCATION_ID LOCATION ST LATITUDE LONGITUDE REGION_ID CO
    MAP_LOC_DATA(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    6264 NASHUA NH 42.7486 -71.491848 1 US
    SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-71.491848, 42.7486, NULL), NULL, NULL)
    My data looks like the following:

  • Spatial Index problems - Newbie here

    Hello,
    I am pretty new to Oracle and have had an issue pop up. I was able to solve it but I am wondering what the issue really is so I can have a better understanding of how Oracle works.
    I am trying to run a spatial index on a table which contains partitions, here is the code I was running.
    CREATE INDEX "xxx_ADMIN"."CODED_PART_CODE_SIDX" ON "xxx_ADMIN"."CODED_PART_CODE" ("GEOMETRY")
    INDEXTYPE IS "MDSYS"."SPATIAL_INDEX" LOCAL (
    PARTITION "PART_v1234" PARAMETERS ('tablespace=xxx_coded_part_code sdo_rtr_pctfree=0 pctincrease=0 layer_gtype=POINT'),
    PARTITION "PART_v2345" PARAMETERS ('tablespace=xxx_coded_part_code sdo_rtr_pctfree=0 pctincrease=0 layer_gtype=POINT'),
    PARTITION "PART_v3456" PARAMETERS ('tablespace=xxx_coded_part_code sdo_rtr_pctfree=0 pctincrease=0 layer_gtype=POINT'),
    PARTITION "PART_OTHER" PARAMETERS ('tablespace=xxx_coded_part_code sdo_rtr_pctfree=0 pctincrease=0 layer_gtype=POINT')) ;
    commit;
    This never seems to work but when I change the name of the partitions to start with a 'd' instead of a 'v' (PART_v1234 becomes PART_d1234) everthng works just fine.
    Any idea why this happens?
    Any help would be appreciated,
    Tom

    Well the first thing you need to learn about Oracle is basic concepts such as when asking a question about Spatial to post in the forum that discusses Spatial.
    This group, Advanced Queuing is totally unrelated to Spatial.

  • Spatial Index problem with query

    I created a spatial index with user A. When i do a spatail query, i receive a good result. But, when i execute the same query with user B, i receive the following error :
    ERROR at line 1:
    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 58
    I don't understand why user B seems not to be able to see or use the spatal index created by user A.

    Hi,
    What version of spatial are you using? You might have to grant select access on the spatial index table to user b in older versions of spatial.

  • Oracle materialized view + spatial index

    Hello,
    i faced with problem when i create spatial index on materialized view.
    I create materialized view on 2 table which contains spatial geometrys.
    create materialized view mv_geom as
    select g.nid, g.geometry
    from geom1
    union all
    select select g.nid, g.geometry
    from geom2
    i created spatial index - all works fine, but when i try to drop table, i get exception "ORA-04020"...
    Materialized view become invalid but don't drop from database.
    SQL> drop materialized view mv_geom;
    Materialized view dropped
    But object does not drop
    select * from all_objects z where z.OBJECT_NAME = 'geom1'
    and z.OBJECT_TYPE ='MATERIALIZED VIEW'
    Any ideas?
    Thank's for help!

    I don't quite follow you. Do you mean that after you dropped mv "mv_geom".
    you expect that the base table "geom1" should be dropped?

  • Creating a combined view of two spatially indexed tables

    Hi All,
    I'm using oracle 10g and C++ occi to store and retrieve data. I have two tables that are identical in structure, they have an SDO_GEOM column where I store lat/long/altitude info. When I store the data using a stored procedure, the data is put into the correct table. I now want to retrieve the data using a spatial operator - I use SDO_NN to retrive data within a given distance of a lat/long/altitude point. This works fine for a single or multiple tables as I use a stored function to give me the data back as an object. I now have a requirement to list all the data from both tables - I thought I could do this by creating a combined view but I understand this cannot be done with spatial data - I habe also tried using the join operator but I am having problems since the columns for each table are identical. Is there any workaround for this - the combined view will not have any spatial operators run on it, I just need to return each row (the spatial data can be returned as individual lat/long/alt instead of as a SDO_GEOM. A second idea I had would be to return all the data using a ref cursor - this works for a single table but I do not understand how I can open the cursor with a select from two tables with identical column names.
    Unfortunately it is a requirement that the tables are seperate so combining the two tables into one is not an option.
    Thanks in advance for any help anyone can offer,
    Cheers,
    Rob

    You can create a UNION ALL view:
    CREATE TABLE cola_markets_1 (
    mkt_id NUMBER PRIMARY KEY,
    name VARCHAR2(32),
    shape SDO_GEOMETRY);
    CREATE TABLE cola_markets_2 (
    mkt_id NUMBER PRIMARY KEY,
    name VARCHAR2(32),
    shape SDO_GEOMETRY);
    CREATE VIEW v1 AS
    SELECT * FROM cola_markets_1 UNION ALL SELECT * FROM cola_markets_2;
    If both tables have a spatial index on their shape column, a query plan will look
    like:
    explain plan for SELECT c.mkt_id, c.name FROM v1 c WHERE SDO_NN(c.shape, SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(4,6, 8,8)) , 'sdo_num_res=1') = 'TRUE';
    0 SELECT STATEMENT     |           |
    1 VIEW               | V1          |
    2 UNION-ALL          |           |
    3 TABLE ACCESS BY INDEX ROWID| COLA_MARKETS_1
    4 DOMAIN INDEX     | COLA_SPATIAL_IDX_1
    5 TABLE ACCESS BY INDEX ROWID| COLA_MARKETS_2
    6 DOMAIN INDEX     | COLA_SPATIAL_IDX_2
    However, the above SDO_NN query will return 2 rows (one from each table),
    because it can only work on one table, it won't return the nearest neighbor
    from the combined view without some tweaks. For example, to return the
    top one, you may try:
    select * from (SELECT c.mkt_id, c.name FROM v1 c WHERE SDO_NN(c.shape, SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(4,6, 8,8)) , 'sdo_num_res=1') = 'TRUE' order by sdo_geom.sdo_distance(c.shape, SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(4,6, 8,8)), 0.0001)) where rownum < 2;
    Note that you can only pass literals or bind variables into the second input parameter
    of spatial operators (including SDO_NN), when a UNION ALL view is used. i.e. the following
    query won't work right now:
    SELECT c.* FROM v1 c, another_table b WHERE b.id =1 and SDO_NN(c.shape, b.shape, 'sdo_num_res=1')= 'TRUE';

  • Performance problem on view with spatial column - resolved

    I have had a problem with queries on a view that had a spatial column, where the view did not belong to the logged in user. Where my spatial window was retrieved by a sub-query, the spatial scan did a full table scan instead of using the spatial index.
    I have found that the problem can be resolved by granting MERGE VIEW on the view to the querying user.
    The view can be as simple as SELECT * FROM table.
    The badly performing query could be as simple as
    select id from T1.tstview
    where SDO_RELATE(coordinates,
    (SELECT coordinates FROM T1.tstWINDOW WHERE ID = '1')
    ,'mask=INSIDE+COVEREDBY querytype=WINDOW') = 'TRUE'  ;
    I think this is a bug, and have raised an SR - MERGE VIEW is supposed to override issues with the "security intent" of a view.
    The workaround is simple enough once you're aware of it and I thought it was worth passing on.

    Thanks for sharing this workaround!
    Which ORACLE version did you test ?

  • Numeric character problems when creating spatial index

    Hi,
    We have run into a problem when trying to create spatial indexes. The problem seems to be that an mdsys-procedure tries to use a number with a comma as decimal symbol in an update statement
    Error message:
    ERROR at line 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: Stmt-Execute Failure: begin mdsys.prvt_idx.execute_update(NULL,NULL,'set sdo_rtree_quality = 1,00000000 where UPPER(sdo_index_owner) = UPPER(''BK'') AND UPPER(sdo_index_name)=UPPER(''TEST_RTREE_IDX'') AND UPPER(sdo_index_table)=UPPER(''MDRT_8120$'')',NULL); end;
    ORA-29400: data cartridge error
    ORA-01747: invalid user.table.column, table.column, or column specification
    ORA-06512: at "MDSYS.PRVT_IDX", line 17
    ORA-06512: at line 1
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
    ORA-06512: at line 1
    Our problem seems to be identical to the one discussed in this thread: create RTREE falied on 9.2.0.4
    Regional settings, language versions etc:
    Client:
    OS: Windows 2000
    Regional options (OS): Swedish, Sweden
    Sqlplus (console and windows versions): v 9.2.0.1.0
    Registry: NLS_LANG =SWEDISH_SWEDEN.WE8MSWIN1252
    Server:
    OS: Windows Server 2003
    Regional options (OS): Swedish, Sweden
    Oracle: v 9.2.0.3.0
    Registry: NLS_LANG =SWEDISH_SWEDEN.WE8MSWIN1252
    We have also tried building the indexes after overriding these settings by setting the environment variables NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1 on both the client- and the server computer. This gives exactly the same error. We have tried setting NLS_NUMERIC_CHARACTERS to '.,' instead of ',.', but this does not help either.
    We haven't tried changing the NLS_LANG registry entry on the server, because this is a production server at a customer's site that hosts several other databases, so we would prefer not to have to restart it if we can avoid it. However, as we understand it, the environment variable NLS_LANG should override the registry setting anyway, right?
    We first experienced the problem when trying to build indexes on imported data. To verify that the problem was not with the data, we wrote a simple test script that:
    1)Creates a table
    2)Creates metadata
    3)Inserts a simple geometry
    4)Tries to create an index
    The error message above is from running this script. We have verified that the script
    works ok on another database server.
    Below are the values of some of the language parameters right before running the script
    (we have tried many other settings with the same result).
    parameter...........................db................................instance...............session
    NLS_CHARACTERSET.......WE8MSWIN1252..................................................
    NLS_LANGUAGE...............AMERICAN...................AMERICAN...........AMERICAN
    NLS_NCHAR_CH...............AL16UTF16 ..........................................................
    NLS_NCHAR_CONV... ......FALSE..........................FALSE..................FALSE..
    NLS_NUMERIC_CH...---------.,---------------------------------------------------------------.,
    NLS_TERRITORY..............AMERICA......................AMERICA..............AMERICA
    The guy who started the thread referenced above solved the problem, but we haven't been able to get it working by changing registry entries and session parameters.
    The question is: Which setting will make the number in 'set sdo_rtree_quality = 1,00000000...' be generated with a . instead of a , as decimal symbol?

    Ok, so here is my plan to solve this:
    1) Change the default user locale (the language under "standards and formats") to English for the account under which the Oracle server runs.
    2) Reboot (or is there an easier way to make Oracle reload the settings?)
    This should make the index creation work. It may break something else however, so to avoid this I can set the user locale back to Swedish afterwards .
    You can subsequently change the setting and update the sdo_rtree_quality in
    the metadata and it should work fine. Do you mean I have to update the sdo_rtree_quality in some way to make it work after I have changed the default user locale back to Swedish? How do I do this?
    Thanks a million both of you!

  • Index problem in a spatial query

    I try to run following query in SQL Plus:
    SELECT A.objectid FROM TABBDG A, TABREG B
    WHERE A.objectid = 68 AND B.regionname = 'Hong2'
    AND SDO_RELATE(A.geoloc, B.geoloc, 'mask=INSIDE querytype = WINDOW') = 'TRUE';
    To find out weather or not objectid = 68 is inside of region (='Hong2"). I got following error messages:
    ERROR at line 1:
    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 57
    ORA-06512: at line 1
    But when I try to add an index to table TABREG, I got following error:
    ERROR at line 1:
    ORA-29879: cannot create multiple domain indexes on a column list using same indextype
    Seem to me that the index was already there. Can any one help me? Thanks.

    I found out the reason of problem. I used an old version of EasyLoader (4.5?). When I get the latest EasyLoader V6.5, there is no problem any more to run spatial query. You can get lates EasyLoader V6.5 from MapInfo or from me at: [email protected]
    Thanks for all help.

  • Spatial Index Creation Problem - 11g

    Dear all,
    I have a customer with a problem creating a spatial index in her database. The thing is, she is also storing rasters in the database in a different schema and those indices are created OK. Also in 2 other databases, mine & another consultant, the indices are created OK. The error is:
    Error starting at line 1 in command:
    CREATE INDEX rs_idxSPAT ON road_segments(RD_GEOMETRY)
    INDEXTYPE IS mdsys.spatial_index
    PARAMETERS ('SDO_INDX_DIMS=2 SDO_RTR_PCTFREE=20 geodetic = false layer_gtype=LINE')
    Error at Command Line:1 Column:13
    Error report:
    SQL Error: ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13205: internal error while parsing spatial parameters
    ORA-13249: Stmt-Execute Failure: SELECT DBMS_ASSERT.QUALIFIED_SQL_NAME( :1 ) FROM DUAL
    ORA-29400: data cartridge error
    ORA-44004: invalid qualified SQL name
    ORA-06512: at "SYS.DBMS_ASSERT", line 188
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    29855. 00000 - "error occurred in the execution of ODCIINDEXCREATE routine"
    *Cause:    Failed to successfully execute the ODCIIndexCreate routine.
    *Action:   Check to see if the routine has been coded correctly.
    The table road_segments is empty when the statement is executed.
    Any thoughts, anyone?
    Thanks very much,
    Jim Greetham

    Jim,
    We typically don't support these kind of schema names for Spatial schemas
    as they have to be created with double quotes.
    Like create user "3droads".
    In this case, the schema name is the problem. They should pick a schema name
    they can create without using the double quotes.
    siva

  • 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.

  • 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

  • Purchased apps do not show up on my mac book air?

    How do I sync my purchased apps to my new macbook air?  They do not show up in the app store under purchases.  I do see all of them in my itues account, but do not know how to sync them to my macbook?

  • Unable to delete imported photos on iphone 3G - no trashcan option

    I recently got an iphone 3G - 8GB model. I wanted to store some of my images located on my winXP notebook on the iphone, and figured as it uses iTunes to synch data and download mp3s etc, I simply dragged and dropped one of my notebook's photo folder

  • Oracle not getting started

    Hi, We just upgraded to oracle patch set 9.2.0.8.0 Now We are not able to start database. OS Win2k3 Logs: trc file: "dev_w0", trc level: 1, release: "640" ACTIVE TRACE LEVEL           1 ACTIVE TRACE COMPONENTS      all, M B  B Mon Nov 10 22:02:15 200

  • Transformation File - Syntax

    While loading the data in to BPC from BW i want to load the addition of the months ,how to achieve this using the Transformation file in BPC say for same dimension below the new amount should be additions jan=jan feb=jan+feb march=Janfebmarch April=J

  • Metaread Setup

    Essbase 9.3.1. I have the following hierarchy: Total Region --North America --------USA --------------East -------------------Boston -------------------New York --------------West -------------------LA.... After I setup the security filter as below R