Oracle spatial query with php

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

Thank you very much CJ.
Now there isn't any problems: you and this link (Re: PHP and spatial data and Adamo Bozzetti helped me
I have used SDO_UTIL.GETVERTICES
my complete php script is:
$conn = @OCILogon("xxxxxx", "xxxxx", "xxxxx") or die
( "Non riesco a connettermi al server $host ");
$query = "select
TABLE_A.tipo_via,
TABLE_A.nome_via,
c.codice_via,
t.X,
t.Y
from TABLE B c, TABLE_A , TABLE(SDO_UTIL.GETVERTICES(c.geometry1)) t
where c.codice_via = 830
and c.codice_via = TABLE_A.id_via
$istruzione = @OCIParse($conn, $query);
@OCIExecute($istruzione);
$nrows = @OCIFetchInto($istruzione, $results);
$trovati = 0;
while(@OCIFetchInto($istruzione, $results))
$trovati++;
?>     
<table border width="800" >
<tr>     
<td align="center" width="80" bgcolor ="#aaffee"><?echo trim($results[0]);?></td>
<td align="center" width="150" bgcolor ="#eeffee"><?echo trim($results[1]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[2]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[3]);?></td>
<td align="center" width="50" bgcolor ="#eeffee"><?echo trim($results[4]);?></td>
</tr>
</table>
<?
} //fine While
@OCIFreeStatement($istruzione);
@OCILogOff($conn);

Similar Messages

  • ORA-03113 in spatial query with xmlReader

    I run a spatial query with xmlReader. but it occurs a ORA-03113 exception. If i use the OracleDataReader,not through xml, the execution is ok. But i have to get the geometry data through xml. I have try to set the validate connection to True, but it seems useless.
    Can some one help me?Thx a lots.
    Here is my code:
         string id = "scott";
         string psw = "tiger";
         string source = "Oracle";
         string connectionstring = "User Id="+id+";password="+psw+";data source="+source+";validate connection=true";
         string sql ="select cname from L218 where sdo_relate(L218.GEOLOC,MDSYS.SDO_geometry(2003,NULL,NULL,MDSYS.SDO_elem_info_array(1,1003,3),MDSYS.SDO_ordinate_array(295596.60260187,2761786.9958782, 316370.598147679,2789383.2780762)),'mask=anyinteract')='TRUE'";
         try
              Oracle.DataAccess.Client.OracleConnection con = new OracleConnection(connectionstring);
              con.Open();
              Oracle.DataAccess.Client.OracleCommand cmd = con.CreateCommand();
              cmd.XmlCommandType = OracleXmlCommandType.Query;
              cmd.BindByName = true;
              cmd.CommandText =sql;
              XmlReader xmlReader = cmd.ExecuteXmlReader();
              XmlDocument xmlDocument = new XmlDocument();
              xmlDocument.PreserveWhitespace = false;
              xmlDocument.Load(xmlReader);
              Console.WriteLine(xmlDocument.OuterXml);
              con.Close();
         catch (OracleException e)
              Console.WriteLine(e);
    And it returns:
    Oracle.DataAccess.Client.OracleException ORA-03113: end-of-file on communication
    channel at Oracle.DataAccess.Client.OracleCommand.XmlHandleException(OracleE
    xception e)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlQuery(Boolean wantResult)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlReader()

    Hi Daniel
    I ran the validation and some of the geometries were invalid. I have now corrected these and all are OK. The db version is 817. However, I am still getting the same error. It appears to be dependant on what cordinates the query is searching:
    Errors
    SELECT 1
    FROM wpe_misc_site, WPE_PLAN_APPLICATION
    WHERE wpe_misc_site.ste_id > 0
    AND WPE_PLAN_APPLICATION.APL_ste_id(+) =
    wpe_misc_site.ste_id
    AND mdsys.sdo_relate(ste_geometry,
    MDSYS.SDO_GEOMETRY(2003, 81989, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
    MDSYS.SDO_ORDINATE_ARRAY(278792,187310,278876,187393)),
    'mask=anyinteract querytype=window') = 'TRUE';
    Substriute those coordinates for 278792,187308,278876,187393 and query works.
    Any ideas??
    Thanks
    Chris

  • Simple spatial query with different SRID

    Can anyone help me with just a real simple spatial query with different SRID.
    Here is the error i get when i perform the query:
    AND SDO_RELATE(A.geometrie_point, B.GEOMETRIE_POLYGONE, 'mask=anyinteract querytype=WINDOW') = 'TRUE'
    ERROR at line 4:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-13207: incorrect use of the [IN COMPATIBLE BOUNDS in SDO_RELATE] operator
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 84
    ORA-06512: at line 4

    Hi,
    I am using 8.1.7.2 and i have the lattest spatial patch.
    From the start i had different SRID. The only thing i changed was the bounds of the coordinate system.
    I reset my bounds of the coordinate system with SRID 8307 to -180,
    180 in X (longitude), and -90,90 in Y (latitude) to see if the query window geometry
    (geom2) will be transformed to the coordinate system of the layer geometries (geom1)
    Her is the content of the user_sdo_geom_metadata :
    GIS_PCP GEOMETRIE_POINT
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -5800000, 3600000, .00000005), SDO_DIM_ELEMENT('Y', 3516000, 6000000, .00000005))
    82227
    GIS_TEST GEOMETRIE_POLYGONE
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .00000005), SDO_DIM_ELEMENT('Y', -90, 90, .00000005))
    8307
    Here is my query :
    select /*+ ordered */ A.no_point
    from gis_pcp A, gis_test B
    WHERE SDO_RELATE(A.geometrie_POINT, B.GEOMETRIE_POLYGONE, 'mask=anyinteract querytype=WINDOW') = 'TRUE';
    Here is my result :
    WHERE SDO_RELATE(A.geometrie_POINT, B.GEOMETRIE_POLYGONE, 'mask=anyinteract querytype=WINDOW') = 'TRUE'
    ERROR at line 3:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-13207: incorrect use of the [IN COMPATIBLE BOUNDS in SDO_RELATE] operator
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 84
    ORA-06512: at line 4
    If i change the bounds of GIS_TEST to the exact bouns of GIS_PCP then i dont have the error message above and i have correct results. Do i have the adjust the bounds of every layer to fit the biggest bound?

  • Oracle spatial query SDO_LRS with php

    Hello, I have this problem,
    I use php for read data from oracle table.
    I know I can't show on web page the result of SDO_ORDINATE_ARRAY
    Christopher Jones has written that I must use SDO_UTIL.GETVERTICES like as
    select
    t.X,
    t.Y
    from table_a, TABLE(SDO_UTIL.GETVERTICES(table_a.GEOMETRY_1)) t
    where
    id_num = 970;
    But now I must read a projection point ordinate of a point with respect to a geometric segment
    and the same problem come back.
    esemple of spatial query that I use:
    SELECT
    SDO_LRS.PROJECT_PT(geometry,
    SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(580094.69, 4998493.68, NULL)) )
    FROM
    TABLE_B
    WHERE
    ID_CODE = 970;
    If I use sql plus I have this result
    SDO_LRS.PROJECT_PT(GEOMETRY,SD(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM
    SDO_GEOMETRY(3301, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(
    580093,325, 4998497,57, 45,2254405))
    Which is exacly the query for extract these coordinates?
    Someone can help me?
    My English is very bad please reply easy.
    Thanks for all!
    Angelo

    Hello thanks for all to everyboby.
    I put the same question on Forum /Category/Database/Spatial and I have received this reply
    from Brian Camire, this query worked well.
    SELECT
    T.X,
    T.Y
    FROM
    TABLE
    SELECT
    SDO_UTIL.GETVERTICES
    SDO_LRS.PROJECT_PT
    GEOMETRY,
    SDO_GEOMETRY
    3301,
    NULL,
    NULL,
    SDO_ELEM_INFO_ARRAY(1, 1, 1),
    SDO_ORDINATE_ARRAY(580093.859, 4998493.5, NULL)
    FROM
    TABLE_B
    WHERE
    ID_CODE = 970
    ) T;
    Best regards
    Angelo.

  • Oracle Spatial Performance with 10-20.000 users

    Does anyone have any experience when Oracle Spatial is used with say 20.000 concurrent users. I am not interested in MapViewer response time, but lets say there is:
    - an app using 800 different tables each having an sdo_geometry column
    - the app is configured with different tables visible on different view scales
    - let's say an average of 40-50 tables is visible at any given time
    - some tables will have only a few records, while other can hold millions.
    - there is no client side caching
    - clients can zoom in/out pan.
    Anwers I am interested in:
    - What sort of server would be required
    - How can Oracle serve all that data (each Refresh renders the map and retrieves the data over the wire as there is no client side caching).
    - What sort of network infrastructure would be required.
    - Can clients connect to different servers and hence use load balancing or does Oracle have an automatic mechanism for that?
    Thanks in advance,
    Patrick

    Patrick, et al.
    There are lots of things one can do to improve performance in mapping environments because of a lot of the visualisation is based on "background" or read-only data. Here are some "tips":
    1. Spatially sort read-only data.
    This tip makes sure that data that is close to each other in space are next to each other on disk! Dan gave a good suggestion when he referenced Chapter 14, "Reorganize the Table Data to Minimize I/O" pp 580- 582, Pro Oracle Spatial. But just as easily one can create a table as select ... where sdo_filter() where the filtering object is an optimized rectangle across the whole of the dataset. (This is quite quick on 10g and above but much slower on earlier releases.)
    When implementing this make sure that the created table is created such that its blocks are next to each other in the tablespace. (Consider tablespace defragmentation beforehand.) Also, if the data is READ ONLY set the PCTFREE to 0 in order to pack the data up into as small a number of blocks as possible.
    2. Generalise data
    Rendering spatial data can be expensive where the data is geometrically detailed (many vertices) esp where the data is being visualised at smaller scales than it was captured at. So, if your "zoom thresholds" allow 1:10,000 data to be used at 1:100,000 then you are going to have problems. Consider pre-generalising the data (see sdo_util.simplify) before deployment. You can add multiple columns to your base table to hold this data. Be careful with polygon data because generalising polygons that share boundaries will create gaps etc as the data is more generalised. Often it is better to export the data to a GIS which can maintain the boundary relationships when generalising (say via topological relationships).
    Oracle's MapViewer has excellent on-the-fly generalisation but here one needs to be careful. Application tier caching (cf Bryan's comments) can help here a lot.
    3. Don't draw data that is sub-pixel.
    As one zooms out objects become smaller and smaller until they reach a point where the whole object can be drawn within a single pixel. If you have control over your map visualisation application you might want to consider setting the SDO_FILTER parameter "min_resolution" flag dynamically so that its value is the same as the number of meters / pixel (eg min_resolution=10). If this is set Oracle Spatial will only include spatial objects in the returned search set if one side of a geometry's MBR is greater than or equal to this value. Thus any geometries smaller than a pixel will not be returned. Very useful for large scale data being drawn at small scales and for which no selection (eg identify) is required. With Oracle MapViewer this behaviour can be set via the generalized_pixels parameter.
    3. SDO_TOLERANCE, Clean Data
    If you are querying data other than via MBR (eg find all land parcels that touch each other) then make sure that your sdo_tolerance values are appropriate. I have seen sites where data captured to 1cm had an sdo_tolerance value set to a millionth of a meter!
    A corollary to this is make sure that all your data passes validation at the chosen sdo_tolerance value before deploying to visualisation. Run sdo_geom.validate_geometry()/validate_layer()...
    4. Rtree Spatial Indexing
    At 10g and above lots of great work went in to the RTree indexing. So, make sure you are using RTrees and not QuadTrees. Also, many GIS applications create sub-optimal RTrees by not using the additional parameters available at 10g and above.
    4.1 If your table/column sdo_geometry data contains only points, lines or polygons then let the RTree indexer know (via layer_gtype) as it can implement certain optimizations based on this knowledge.
    4.2 With 10g you can set the RTree's spatial index data block use via sdo_pct_free. Consider setting this parameter to 0 if the table/column sdo_geometry data is read only.
    4.3 If a table/column is in high demand (eg it is the most commonly used table in all visualisations) you can consider loading (a part of) the RTree index into memory. Now, with the RTree indexing, the sdo_non_leaf_tbl=true parameter will split the RTree index into its leaf (contains actual rowid reference) and non-leaf (the tree built on the leaves) components. Most RTrees are built without this so only the MDRT*** secondary tables are built. But if sdo_non_leaf_tbl is set to true you will see the creation of an additional MDNT*** secondary table (for the non_leaf part of the rtree index). Now, if appropriate, the non_leaf table can be loaded into memory via the following:
    ALTER TABLE MDNT*** STORAGE(BUFFER_AREA KEEP);
    This is NOT a general panacea for all performance problems. One should investigate other options before embarking on this (cf Tom Kyte's books such as Expert Oracle Database Architecture, 9i and 10g Programming Techniques and Solutions.)
    4.4 Don't forget to check your spatial index data quality regularly. Because many sites use GIS package GUI tools to create tables, load data and index them, there is a real tendency to not check what they have done or regularly monitor the objects. Check the SDO_RTREE_QUALITY column in USER_SDO_INDEX_METADATA and look for indexes with an SDO_RTREE_QUALITY setting that is > 2. If > 2 consider rebuilding or recreating the index.
    5. The rendering engine.
    Whatever rendering engine one uses make sure you try and understand fully what it can and cannot do. AutoDesk's MapGuide is an excellent product but I have seen it simply cache table/column data and never dynamically access it. Also, I have been at one site which was running Deegree and MapViewer and MapViewer was so fast in comparison to Deegree that I was called in to find out why. I discovered that Deegree was using SDO_RELATE(... ANYINTERACT ...) for all MBR queries while MapViewer was using SDO_FILTER. Just this difference was causing some queries to perform at < 10% of the speed of MapViewer!!!!
    6. Consider "denormalising" data
    There is an old adage in databases that is "normalise for edit, denormalise for performance". When we load spatial data we often get it from suppliers in a fairly flat or normalised form. In consort with spatial sorting, consider denormalising the data via aggregations based on a rendering attribute and some sort of spatial unit. For example, if you have 1 million points stored as single points in SDO_GEOMETRY.SDO_POINT which you want to render by a single attribute containing 20 values, consider aggregating the data using this attribute AND some sort of spatial BUCKET or BIN. So, consider using SDO_AGGR_UNION coupled with Spatial Analysis and Mining package functions to GROUP the data BY <<column_name>> and a set of spatial extents.
    6. Tablespace use
    Finally, talk to your DBA in order to find out how the oracle database's physical and logical storage is organised. Is a SAN being used or SAME arranged disk arrays? Knowing this you can organise your spatial data and indexes using more effective and efficient methods that will ensure greater scalability.
    7. Network fetch
    If your rendering engine (app server) and database are on separate machines you need to investigate what sort of fetch sizes are being used when returning data from queries to the middle-tier. Fetch sizes for attribute only data rows and rows containing spatial data can be, and normally are, radically different. Accepting the default settings for these sizes could be killing you (as could the sort_area_size of the Oracle session the application server has created on the database). For example I have been informed that MapInfo Pro uses a fixed value of 25 records per fetch when communicating with Oracle. I have done some testing to show that this value can be too small for certain types of spatial data. SQL Developer's GeoRaptor uses 100 which is generally better (but this one can modify this). Most programmers accept defaults for network properties when programming in ADO/ODBC/OLEDB/JDBC: just be careful as to what is being set here. (This is one of the great strengths of ArcSDE: its TCP/IP network transport is well written, tuneable and very efficient.)
    8. Physical Format
    Finally, while Oracle's excellent MapViewer requires data its spatial data to be in Oracle, other commercial rendering engines do not. So, consider using alternate, physical file formats that are more optimal for your rendering engine. For example, Google Earth Enterprise "compiles" all the source data into an optimal format which the server then serves to Google Earth Enterprise clients. Similarly, a shapefile on local disk to the application server (with spatial indexing) may be faster that storing the data back in Oracle on a database server that is being shared with other business databases (eg Oracle financials). If you don't like this approach and want to use Oracle only consider using a dedicated Oracle XE on the application server for the data that is read only and used in most of your generated maps eg contour or drainage data.
    Just some things to think about.
    regards
    Simon

  • Spatial Query with multiple geometries from 2 tables

    Hi,
    I'm using Oracle 8.1.7. I am trying to do a spatial query on two tables with multiple geometries. There are two spatial tables. One made up of points and one made up of polygons. There are 829551 rows in the table of points and 1817795 rows in the table with polygons...
    I want to find all polygons where one of this points is within it...
    This query is pretty intensive querying two large spatial tables against each other and so I need to find the most efficient way of running this query. I've been running variations of my query for the last two week and every time it's bombed out with various errors after 12-24 hrs processing like out of memory, out of tablespace, out of processing, invalid index etc etc etc. I need to get this query run asap... Any tips would be gratefully appreciated..
    For the session running the query I've allocated 16M sort area with
    ALTER SESSION SET SORT_AREA_SIZE=16777216;
    Below is the query I'm running... How can I improve this please? BTW PARCEL_OVERLAPS contains the points and TP$_PARCEL_AREAS the polygons.
    SELECT lu.LNU_PARCEL_ID
         FROM
              seventy.PARCEL_OVERLAPS po,
              imap_topol.TP$_PARCEL_AREAS pa,
              TP$_PARCEL_CENTROID_AREA pca,
              TDCR_LAND_UNIT lu
         WHERE
              SDO_FILTER(po.geometry, pa.area,
              'querytype=WINDOW') = ’TRUE’ and
              sdo_within_distance(po.geometry,pa.area,'distance=0')='TRUE' and
              pa.delete_date is null and
              Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
              pa.AREA_ID = pca.AREA_ID and
              pca.DELETE_DATE IS NULL and
              pa.DELETE_DATE IS NULL;

    Albert,
    Thanks for your reply and the tips you've given. The tp$_parcel_areas table will always be bigger so I've changed the order to sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE'. The requested counts for those queries are
    12:26:29 [email protected]:SQL> select count(*)
    13:46:22 2 from seventy.PARCEL_OVERLAPS;
    COUNT(*)
    612
    13:48:12 [email protected]:SQL> select count(*)
    13:48:17 2 from imap_topol.TP$_PARCEL_AREAS pa,
    13:48:21 3 TP$_PARCEL_CENTROID_AREA pca
    13:48:21 4 where pca.DELETE_DATE IS NULL
    13:48:21 5 and pa.DELETE_DATE IS NULL
    13:48:21 6 and pa.AREA_ID = pca.AREA_ID;
    COUNT(*)
    1310665
    There was no reason for both filter and within_distance. I did try use the anyinteract but for some reason that does not return the desired results(I've added one id row as a test to make sure it returns desired results). Plus Oracle have recomended using the within distance for better performance..
    so the explan plan for
    14:38:37 [email protected]:SQL> EXPLAIN PLAN FOR
    14:38:50 2 SELECT lu.LNU_PARCEL_ID
    14:38:50 3 FROM
    14:38:50 4 seventy.PARCEL_OVERLAPS po,
    14:38:50 5 imap_topol.TP$_PARCEL_AREAS pa,
    14:38:50 6 TP$_PARCEL_CENTROID_AREA pca,
    14:38:50 7 TDCR_LAND_UNIT lu
    14:38:50 8 WHERE
    14:38:50 9 sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE' and
    14:38:50 10 pa.delete_date is null and
    14:38:50 11 Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
    14:38:50 12 pa.AREA_ID = pca.AREA_ID and
    14:38:50 13 pca.DELETE_DATE IS NULL and
    14:38:50 14 pa.DELETE_DATE IS NULL;
    is
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 4G|32920G| 547M| | |
    | NESTED LOOPS | | 4G|32920G| 547M| | |
    | MERGE JOIN | | 547M| 2029G| 230124 | | |
    | SORT JOIN | | 1M| 36M| 85014 | | |
    | MERGE JOIN | | 1M| 36M| 50019 | | |
    | SORT JOIN | | 1M| 17M| 21650 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 1M| 17M| 485 | | |
    | SORT JOIN | | 1M| 22M| 28369 | | |
    | TABLE ACCESS FULL |TDCR_LAND | 1M| 22M| 2127 | | |
    | SORT JOIN | | 42K| 160M| 145111 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 42K| 160M| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    14:43:14 [email protected]:SQL> explain plan for
    14:43:23 2 SELECT pa.AREA_ID
    14:43:23 3 FROM seventy.PARCEL_OVERLAPS po,
    14:43:23 4 imap_topol.TP$_PARCEL_AREAS pa
    14:43:23 5 WHERE SDO_RELATE(po.geometry, pa.area,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:43:23 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 10M| | |
    | NESTED LOOPS | | 6M| 50G| 10M| | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    14:45:03 [email protected]:SQL> explain plan for
    14:45:04 2 SELECT pa.AREA_ID
    14:45:05 3 FROM seventy.PARCEL_OVERLAPS po,
    14:45:05 4 imap_topol.TP$_PARCEL_AREAS pa
    14:45:05 5 WHERE SDO_RELATE(pa.area, po.geometry,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:45:05 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 863554 | | |
    | NESTED LOOPS | | 6M| 50G| 863554 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    --------------------------------------------------------------------------------

  • Oracle Spatial functionality with WFS

    Hi all
    My first post here so be gentle on me ;-)
    This may be an obvious question but here goes ...
    When using a WFS client can you access the full SDO_... SQL functions within Oracle Spatial? I've had a read of the WFS spec and it is all a bit vague on how the queries get passed through to the data store.
    Also with the WFS locking, is this done at the web server level? If so how would that impact on any direct access to the database? A bit dangerous??
    Appreciate any advice on WFS implemtations with a 9i back end. I want to retain the full native Oracle functionality and still deploy via WFS ... a pipe dream??
    Thanks
    Richard

    Thanks for your response Andreas
    Sorry, perhaps I wasn't clear, I realise the WFS client will never directly access the data source, that it is the WFS server that makes the request to the data store, not the client, but can the call be passed through to Oracle as native SQL?
    I think I found the answer in the OGC Filter Encoding Imp Spec where it desribes in great detail the optional filter component of a WFS request. It desribes the CQL filter operators that include some spatial operators. These could, I understand, be translated from CGL and Feature based schema to SQL (in GML?) and relational based schema.
    While I don't think at first glance that the spatial operators in CQL match all the Oracle SDO_ functions they probably go far enough for most normal users.
    Am I on the right track?
    Does anyone know of any work that has been done in this filter translation to SQL and if it has been implemented successfully anywhere.
    I think the locks would still pose a problem, but that's for another day :-)
    Thanks
    Richard

  • Why oracle spatial query execute so slow???

    hi all,
    I have two oracle spatial table CHI_2007r2 and CHI_2008r2, each table has it's own spatial index,and each table has 2000 row record, Now execute this query,I can get the result soon,
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    But I execute the query by geom only,it will take so long time! query(3 more hours):
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';
    I don't upderstand...
    thanks
    David

    Because in the first statement
    select /*+ ORDERED */ a.link_id from chi_2007r2 a,chi_2008r2 b where a.link_id=b.link_id and sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE'; you are joining the two tables while in the second statement
    select /*+ ORDERED */ a.link_id,b.link_id from chi_2007r2 a,chi_2008r2 b where sdo_relate(a.geom,b.geom,'mask=INSIDE querytype=WINDOW')='TRUE';you are doing a cartesian merge first because there is no join between a and b other than te sdo_relate which will be calculated for every row combination you get.
    But I think you'd be better off posting in the {forum:id=76} forum.
    Best regards,
    PP
    Edited by: porzer on Jan 15, 2009 10:34 AM

  • Very basic question Oracle spatial query

    Hi All,
    Iam a newbie to oracle spatial.
    How can i verify that oracle spatial is installed in my database.
    My database is version is 10.2.0.2.0
    Is there any special query i can execute to test oracle spatial is working properly / installed properly.
    All the finctionality oracle spatial is working properly
    Thanks in advance.
    baskar k

    Spatial     VALID     10.2.0.2.0
    I got this message on executing this query
    +++++++++++++++++++++++++++++++
    SELECT comp_name, status, substr(version,1,10) as version
    from dba_server_registry
    where comp_name = 'Spatial';
    ++++++++++++++++++++++++++++++++

  • How oracle spatial deals with self-looping polylines?

    Hi,folks
    I have a general question on self-looping polylines.
    If one polyline is self-closing, can oracle spatial recognize it as a line or polygon?
    Anyone can give some hints on that?

    HI!
    Review this page:
    http://download-west.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88805/sdo_intr.htm#877625
    They say that "Self-crossing polygons are not supported, although self-crossing line strings ARE supported. If a line string crosses itself, it does not become a polygon. A self-crossing line string does not have any implied interior."
    Also, line strings are defined with their own SDO_GTYPE, such as "DL06" for MULTILINE or MULTICURVE, where POLYGON is "DL03" and MULTIPOLYGON is "DL07", so they can't be confused one with another.(See http://download-west.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88805/sdo_objr.htm#1005537)

  • Oracle Spatial Query from SQLPLUS deteriorates in performance

    Hi,
    I am running an sql-procedure, which does spatial queries. When I run this procedure (from SQLPLUS) for the first time it takes around 45 sec to complete, but when I run the same procedure for the second time it takes 65 seconds and the performance keeps on decreasing. But if I open a new SQLPLUS session it takes 45 secs and it also starts deteriorating subsequently. This strange behaviour is only for spatial queries, if I don't have spatial queries in my procedure then its fine.
    I found this behaviour for any type of spatial query.
    Is there something which can be done for improving it ? I found a lot of information on improving performance of a query, but my problem is to maintain the same performance of the same query in the same session.
    Thanks,
    Rishi

    Hi,
    Could you provide version information?
    Also, could you try monitoring memory as the procedure is running an see
    if memory climbs more each time the procedure is run?
    Thanks

  • Spatial query with sdo_aggregate_union taking too much time

    Hello friends,
    the following query taking too much time for execution.
    table1 contains around 2000 records.
    table2 contains 124 rows
    SELECT
    table1.id
    , table1.txt
    , table1.id2
    , table1.acti
    , table1.acti
    , table1.geom as geom
    FROM
    table1
    WHERE
    sdo_relate
    table1.geom,
    select sdo_aggr_union(sdoaggrtype(geom, 0.0005))
    from table2
    ,'mask=(ANYINTERACT) querytype=window'
    )='TRUE'
    I am new in spatial. trying to find out list of geometry which is fall within geometry stored in table2.
    Thanks

    Hi Thanks lot for your reply.
    But It is not require to use sdo_aggregate function to find out whether geomatry in one table is in other geomatry..
    Let me give you clear picture....
    What I trying to do is, tale1 contains list of all station (station information) of state and table2 contains list of area of city. So I want to find out station which is belonging to city.
    For this I thought to get aggregation union of city area and then check for any interaction of that final aggregation result with station geometry to check whether it is in city or not.
    I hope this would help you to understand my query.
    Thanks
    I appreciate your efforts.

  • Why Oracle Spatial Query So Slow???

    I have 90,000 lines in my database. When I did a query about
    finding all the lines within a certain distance of a point, it
    took me nearly 30 seconds. And when I query the intersection
    between the lines, it took me about 5 minutes!! God, I can't
    believe it!
    Do you guys met the problem before? Please share something with
    me, thank you so much!
    Xiong

    Hi,
    Are you using a spatial index for your within distance query? If
    so, what kind, and have you tuned it at all?
    As far as the intersection question goes, how many geometries are
    you testing? Are they big? Are you only comparing the ones
    returned by within distance?
    If they are big geometries, there are some very large performance
    gains in 9i when dealing with larger geometries.
    Dan

  • Interfacing Oracle spatial data with ArcView 9

    Hello,
    I'm trying to take my spatial data in Oracle which has SDO_GEOMETRY fields, and have it display in ArcView. I know I have to do something with SDO_GEOMETRY, but I'm not sure how. I've been reading that 3rd party tools can be used. Is this the only way, or is there something else I can do?
    Thanks much,
    Nora

    the way i use is through arcsde. register the oracle table with sde and then you can view it in any arc software.
    there is another way through direct connect. i havent used it but you can find some help on esri website.
    V

  • Oracle 9i Connectivity with php

    Hi,
    I am new to php and unable to connect to oracle database 9i.
    I have php and appache on one server and databse on the other server.
    I am using Appache 2.2 and php 5.2.8 (un-zippedinc:\php).
    I have place the php.ini in windows directory
    I m getting the following error: PHP Warning:  PHP Startup: Unable to load dynamic library 'C:/php/ext\\php_oci8.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
    in appache error log.
    and on php page i use the oci_connect which give the following error:
    Fatal error: Call to undefined function oci_connect() in C:\Apache\htdocs\main.php on line 3
    Please Help me to solve this problem._
    Regards,
    Raza

    From error listing we can see that your PHP+Apache installation doesn't support Oracle(OCI) functions
    Additional modules not installed
    I recommend you use "Zend for Oracle"
    You may learn and download that product from this url:
    http://www.zend.com/en/products/core/for-oracle
    Edited by: Vladandr on 17.02.2009 1:54

Maybe you are looking for