Mapserver dengan menggunakan data Oracle Spatial
Konversi data ESRI Shapefile (.shp) ke Oracle Spatial
D:\BAYU\data\fix\shp>shp2sdo
shp2sdo - Shapefile(r) To Oracle Spatial Converter
Version 2.13 24-Apr-2002
Copyright 1997,1998,1999,2000,2001,2002 Oracle Corporation
For use with Oracle Spatial.
Input shapefile (no extension): kecamatan
Shape file kecamatan.shp contains 1555 polygons
Output table [kecamatan]:
Output data model [O]:
Geometry column [GEOM]:
ID column []: id
Starting number [1]:
Use a spatial reference system ID (SRID) ? [N]: y
Please enter an SRID value: 4326
Change tolerance value from the default (0.00000005) ? [N]:
Generate data inside control files ? [N]:
Target database Oracle8i? [N]:
Spatial Data requires more than 6 digits precision? [N]:
Bounds: X=[108.594556,114.556928] Y=[-8.776988,-6.398623]
Override ? [N]:
Processing shapefile kecamatan into spatial table KECAMATAN
Data model is object-relational
Geometry column is GEOM
Id column is ID
Numbered from 1
Points stored in SDO_POINT attributes
Data is in a separate file(s)
Control file generation for Oracle9i or higher
Spatial data loaded with 6 digits of precision
SRID set to 4326
Conversion complete : 1555 polygons processed
The following files have been created:
kecamatan.sql : SQL script to create the table
kecamatan.ctl : Control file for loading the table
kecamatan.dat : Data file
Buat table di Oracle dari hasil konversi (.sql)
– kecamatan.sql
–
– This script creates the spatial table.
–
– Execute this script before attempting to use SQL*Loader
– to load the kecamatan.ctl file.
–
– This script will also populate the USER_SDO_GEOM_METADATA table.
– Loading the .ctl file will populate the KECAMATAN table.
–
– To load the .ctl file, run SQL*Loader
– with these parameters:
– USERID=username/password CONTROL=kecamatan.ctl
–
– After the data is loaded in the KECAMATAN table, you should
– tune the dataset and create the spatial index
–
– Creation Date : Sat Dec 22 18:09:02 2007
– Copyright 1999, 2000, 2001, 2002 Oracle Corporation
– All rights reserved
–
DROP TABLE KECAMATAN;
CREATE TABLE KECAMATAN (
ID NUMBER(38)
PRIMARY KEY,
KECAMATAN VARCHAR2(50),
DISTRICT VARCHAR2(50),
PROVINCE VARCHAR2(50),
J_RW VARCHAR2(2),
J_RT VARCHAR2(3),
J_KK NUMBER,
J_LAKI2 NUMBER,
J_PEREM NUMBER,
P_BBM VARCHAR2(7),
K_LOGAM NUMBER,
K_GERABAH NUMBER,
MAKANAN NUMBER,
KEDAI NUMBER,
SMB_PENGHA VARCHAR2(15),
LETAKGEOGR VARCHAR2(13),
KELOMPOK NUMBER,
KODE_KECAM NUMBER,
KODE_KABUP NUMBER,
KODE_PROPI NUMBER,
GEOM MDSYS.SDO_GEOMETRY);
DELETE FROM USER_SDO_GEOM_METADATA
WHERE TABLE_NAME = ‘KECAMATAN’ AND COLUMN_NAME = ‘GEOM’ ;
INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES (’KECAMATAN’, ‘GEOM’,
MDSYS.SDO_DIM_ARRAY
(MDSYS.SDO_DIM_ELEMENT(’X’, 108.594555840, 114.556928040, 0.000000050),
MDSYS.SDO_DIM_ELEMENT(’Y’, -8.776988010, -6.398622990, 0.000000050)
),4326
);
COMMIT;
Insert data menggunakan sql loader
D:\BAYU\data\fix\shp>sqlldr user/password
control = kecamatan
SQL*Loader: Release 10.2.0.1.0 - Production on Sat Dec 22 18:10:44 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 41
Commit point reached - logical record count 82
Commit point reached - logical record count 123
Commit point reached - logical record count 164
Commit point reached - logical record count 205
Commit point reached - logical record count 246
Commit point reached - logical record count 287
Commit point reached - logical record count 328
Commit point reached - logical record count 369
Commit point reached - logical record count 410
Commit point reached - logical record count 451
Commit point reached - logical record count 492
Commit point reached - logical record count 533
Commit point reached - logical record count 574
Commit point reached - logical record count 615
Commit point reached - logical record count 656
Commit point reached - logical record count 697
Commit point reached - logical record count 738
Commit point reached - logical record count 779
Commit point reached - logical record count 820
Commit point reached - logical record count 861
Commit point reached - logical record count 875
Commit point reached - logical record count 916
Commit point reached - logical record count 957
Commit point reached - logical record count 998
Commit point reached - logical record count 1039
Commit point reached - logical record count 1080
Commit point reached - logical record count 1121
Commit point reached - logical record count 1162
Commit point reached - logical record count 1165
Commit point reached - logical record count 1206
Commit point reached - logical record count 1247
Commit point reached - logical record count 1288
Commit point reached - logical record count 1329
Commit point reached - logical record count 1370
Commit point reached - logical record count 1411
Commit point reached - logical record count 1452
Commit point reached - logical record count 1493
Commit point reached - logical record count 1534
Commit point reached - logical record count 1554
Commit point reached - logical record count 1555
Copy libmap.dll dari D:\ms4w\Apache\cgi-bin\ignored-libmap\oracle10g\ ke D:\ms4w\Apache\cgi-bin
Edit httpd.conf, tambahkan baris
SetEnv TNS_ADMIN “D:/oracle/product/10.2.0/client_2/NETWORK/ADMIN/”
Folder where the tnsnames.ora exist
SetEnv PATH “D:/oracle/product/10.2.0/client_2/BIN/”
SetEnv ORACLE_HOME “D:/oracle/product/10.2.0/client_2?
Pada mapfile :
CONNECTIONTYPE oraclespatial
CONNECTION “username/password@service”
DATA “GEOM FROM (SELECT ID, KECAMATAN, DISTRICT, PROVINCE, GEOM FROM KECAMATAN) USING UNIQUE ID SRID 4326?
Kalo pake OGR, koneksinya ya begini :
CONNECTIONTYPE OGR
CONNECTION “OCI:username/password@service”
DATA “tablename”
Jadi deh….







Nice Site!
http://google.com
I found your site on technorati and read a few of your other posts. Keep up the good work. I just added your RSS feed to my Google News Reader. Looking forward to reading more from you down the road!
Your blog is interesting!
Keep up the good work!
Thank you for all
Blog yang bagus mas.
Mohon pencerahannya mas, sy punya data oracle spatial rencananya mau ditampilkan pake mapserver. Pinginnya ntar user bs download file dalam format GML sesuai dgn layer yg diaktifkan.