Changes between Initial Version and Version 1 of OracleSpatial


Ignore:
Timestamp:
Jan 28, 2009, 9:01:01 AM (15 years ago)
Author:
jmckenna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OracleSpatial

    v1 v1  
     1= OracleSpatial Support =
     2
     3----
     4The official document is at: http://www.mapserver.org/input/vector/oracle.html
     5----
     6
     7Author: Bart van den Eijnden, The Netherlands, bartvde@xs4all.nl
     8
     9== BINARIES ==
     10Mapserver binaries with Oracle spatial support can be download at the !MapServer download site. But you need Oracle client software in the server on which you are running mapserver. Oracle client software can be obtained for development purposes from http://otn.oracle.com, but you need to register, which by the way is free. The most recent version is Oracle 9i client. The ORACLE TECHNOLOGY NETWORK DEVELOPMENT LICENSE AGREEMENT applies to this software. Download from: http://otn.oracle.com/software/htdocs/devlic.html?/software/products/oracle9i/htdocs/winsoft.html
     11
     12== MAPFILE SYNTAX ==
     13Oracle Spatial layers in !MapServer can be used through 2 interfaces:
     14
     151) the native built-in support through maporaclespatial.c 2) OGR, but watch out: OGR is not compiled with Oracle Spatial support so it won't work without compiling in OCI (Oracle client) yourself. This requires both recompiling GDAL/OGR as well as recompiling Mapserver itself against the new GDAL/OGR !!!!
     16
     17OPTION 1 NATIVE ORACLE SPATIAL SUPPORT There are two possible syntaxes in the mapfile for the DATA statement:
     18
     19   1. DATA "GEOMETRIE FROM KWADRANTEN USING SRID 90112"
     20   2. DATA "GEOMETRIE FROM (SELECT GEOMETRIE FROM KWADRANTEN)"
     21
     22When used with the WMS interface, syntax 1. takes in the bbox into the request which is sent to Oracle. Syntax 2 does not do this and gets in the example above all the records from the table, although only displaying a few with my example URL. When leaving out the USING SRID I get an error: msDrawMap?(): Image handling error. Failed to draw layer named 'kwadranten'.
     23
     24Example URL: http://myserver/cgi-bin/mapserv/mapserv_gif.exe?map=C:\mapfiles\kwadranten.map&request=map&layers=kwadranten&bbox=171760,449736,178257,456421&version=1.1.0&format=gif&width=500&height=500
     25
     26Complete layer syntax:
     27{{{
     28  LAYER
     29    NAME kwadranten
     30    TYPE POLYGON
     31    CONNECTIONTYPE oraclespatial
     32    CONNECTION "user/pwd@service"
     33    DATA "GEOMETRIE FROM KWADRANTEN USING SRID 90112"
     34    DUMP TRUE
     35    CLASS
     36     OUTLINECOLOR       0 0 0
     37     COLOR 0 128 128
     38    END
     39  END
     40}}}
     41Where service is the alias (in this example MYDB) supplied in the tnsnames.ora file of the Oracle client, e.g.
     42{{{
     43  MYDB =
     44   (DESCRIPTION =
     45    (ADDRESS_LIST =
     46      (ADDRESS = (PROTOCOL = TCP)(HOST = www.mydomain.com)(PORT = 1521))
     47    )
     48    (CONNECT_DATA =
     49      (SERVICE_NAME = DB1)
     50    )
     51  )
     52}}}
     53BTW with Oracle Spatial layers it is also possible to put labels, like for normal mapserver layers, e.g.:
     54{{{
     55  LAYER
     56    NAME kwadranten
     57    TYPE POLYGON
     58    CONNECTIONTYPE oraclespatial
     59    CONNECTION "user/pwd@service"
     60    DATA "GEOMETRIE FROM KWADRANTEN USING SRID 90112"
     61    LABELITEM "KWADRANTNR"
     62    CLASS
     63      OUTLINECOLOR      0 0 0
     64      LABEL
     65        COLOR 0 0 0
     66        POSITION CC
     67      END
     68    END
     69  END
     70}))
     71An example of the query which will be run against Oracle is:
     72{{{
     73SELECT rownum, KWADRANTNR, GEOMETRIE FROM KWADRANTEN WHERE SDO_FILTER( KWADRANTEN.GEOMETRIE, MDSYS.SDO_GEOMETRY(2003, 90112, NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(171673.094,449742.685,178343.906,456414.315) ),'querytype=window') = 'TRUE'
     74}}}
     75OPTION 2 ORACLE SPATIAL SUPPORT THROUGH OGR Mapserver 4.0.1 Windows binary with OGR Oracle Spatial support (GDAL version 1.2) downloadable from: http://www.vz.geodan.nl/users/bart/mapserv4.0.1-OGR-Oracle.zip
     76
     77Syntax for your MAP file:
     78{{{
     79  CONNECTION "OCI:user/pwd@service"
     80  CONNECTIONTYPE OGR
     81  DATA "Tablename"
     82}}}
     83Make sure you set the wms_extent METADATA for the LAYER, as otherwise the "Getcapabilities" request takes a lot of time.
     84
     85http://www.xlmhx.com.cn
     86
     87== ORACLE SPATIAL FAQ ==
     88
     89The Oracle Spatial FAQ is located at http://www.orafaq.com/faqsdo.htm