Simplify geometry

I'm trying to simplify a layer with line (spaghetti) geometries that are geodetic (SRID 8307).
1. Does the SDO_SAM.SIMPLIFY_LAYER work with Geodetic data?
When I try to use sdo_sam.simplify_layer function, the number of vertices does not change, regardless of the "pct_area_change_limit" I use (the only parameter where I can change the value). I even tried 100 (which I take to mean 100%).
execute sdo_sam.simplify_layer('TRACK_TEST','SHAPE','SMPL_SHAPE', '10', '100');
Maybe this is only applicable for polygon data?
2. Should I use SDO_UTIL.SIMPLIFY, instead, for geodetic data?
I was able to create a simplified layer using SDO_UTIL.SIMPLIFY, but I had understood that the SDO_SAM.SIMPLIFY_LAYER was simply a wrapper around SDO_UTIL.SIMPLIFY. I incrementally tried increasingly larger values for the parameters in SDO_UTIL.SIMPLIFY, and it ended up that I had to change the threshold parameter to 10000, and the tolerance parameter to 9999 before I saw a significant difference in the number of vertices.
CREATE TABLE TRACK_TEST_2
AS SELECT ID,
sdo_util.simplify(
MDSYS.SDO_GEOMETRY(
A.SHAPE.SDO_GTYPE,A.SHAPE.SDO_SRID,A.SHAPE.SDO_POINT,A.SHAPE.SDO_ELEM_INFO,A.SHAPE.SDO_ORDINATES),
10000,9999) SMPL_SHAPE
FROM TRACK_TEST A;
3. Why are the parameters controlling the functions different for SDO_SAM.SIMPLIFY_LAYER (commit interval, pct_area_change_limit)
SDO_SAM.SIMPLIFY_GEOMETRY (tolerance,pct_area_change_limit)
and SDO_UTIL.SIMPLIFY (threshold, tolerance)?
I tried changing the tolerance in my layer's metadata, but that didn't seem to affect sdo_sam.simplify_layer.
4. Perhaps my data are not suited for simplifying, but I was hoping to achieve data that displayed more quickly in an on-line map viewer. Are the SIMPLIFY functions best suited to geometries with very closely spaced vertices?
Any insight would be appreciated!
--Nancy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Hi Nancy,
first of all: it works... :)
ok, you have between point 1 and point 2 a difference in Longitude with 0.0001 (-4.4782 -4.4783). This is roughly approached 11m (40.000.000 m/360°*0.0001). If you use a threshold oh 10m and then a threshold of 20m you will see the difference of the result (or 100m, 10000m, 100000m)...
The number of points will be reduced by the algorithm, if there are possible distances to reduce!
for douglas peuker you should see:
http://geometryalgorithms.com/Archive/algorithm_0205/algorithm_0205.htm#Douglas-Peucker%20Algorithm
create table TEST_SP(
ID NUMBER NOT NULL,
GEOM MDSYS.SDO_GEOMETRY,
constraint PK_TESTSP primary key(ID));
insert into MDSYS.USER_SDO_GEOM_METADATA values ('TEST_SP', 'GEOM',
MDSYS.SDO_DIM_ARRAY (
MDSYS.SDO_DIM_ELEMENT ('Longitude', -180, 180, .05),
MDSYS.SDO_DIM_ELEMENT ('Latitude', -90, 90, .05)),8307);
create index TEST_SP_GIDX on TEST_SP(GEOM) indextype is MDSYS.SPATIAL_INDEX parameters('sdo_indx_dims=2');
INSERT INTO TEST_SP(ID,GEOM)
VALUES (1,
       MDSYS.SDO_GEOMETRY(2006, 8307, NULL,
       MDSYS.SDO_ELEM_INFO_ARRAY(1, 2, 1),
       MDSYS.SDO_ORDINATE_ARRAY(-4.4782, 48.383, -4.4783, 48.3839, -4.5072, 48.3523, -4.8323, 48.2802, -4.9683, 48.2977
       , -5.2159, 48.4632, -5.4231, 48.9394, -5.6304, 49.4157, -5.8376, 49.8919, -5.8881, 50.016, -5.8588, 50.5097, -5.8296
       , 51.0035, -5.8003, 51.4972, -5.7041, 51.9855, -5.608, 52.4738, -5.5118, 52.9621, -5.4198, 53.3168, -5.3821, 53.3369
       , -5.3164, 53.6902, -5.2506, 54.0435, -5.1849, 54.3968, -5.4752, 54.7332, -5.7656, 55.0696, -6.0559, 55.406, -6.5756
       , 55.4709, -6.8982, 55.76, -7.2207, 56.0492, -7.5433, 56.3383, -7.2575, 56.7691, -6.9716, 57.2, -6.6858, 57.6308, -6.6665
       , 57.6427, -6.2458, 57.8083, -5.825, 57.9738, -5.5861, 58.4546, -5.3473, 58.9355, -5.1084, 59.4163, -4.9137, 59.7915
       , -4.719, 60.1667, -4.5436, 60.5136, -4.3682, 60.8605, -4.1047, 61.3391, -3.8412, 61.8176, -3.5777, 62.2962, -3.361
       , 62.7598, -3.8819, 63.1987, -4.4027, 63.6375, -4.9236, 64.0764, -5.4563, 64.4946, -5.989, 64.9128, -5.9889, 64.9258
       , -5.3195, 65.2554, -4.65, 65.5851, -3.9806, 65.9147, -3.7081, 66.3963, -3.4357, 66.878, -3.1632, 67.3596, -3.0062
       , 67.7413, -2.9647, 68.0694, -2.9232, 68.3976, -2.8955, 68.7173, -2.887, 68.8462, -2.8182, 69.3409, -2.7494, 69.8357
       , -2.6806, 70.3304, -2.6327, 70.7036, -2.5849, 71.0769, -2.537, 71.4501, -2.4891, 71.8233, -2.4831, 71.8485, -2.4675
       , 71.8937, -2.4678, 71.9014, -2.4799, 71.9143, -2.4814, 71.9087, -2.4772, 71.9077, -1.9743, 71.7427, -1.5918, 71.8198
       , -.3136, 72.0398, .9646, 72.2599, 2.2428, 72.4799, 3.3439, 72.6617, 4.4449, 72.8435, 4.4565, 72.8586, 4.418, 72.8691
       , 2.9688, 72.6301, 1.5196, 72.3912, .0704, 72.1522, -.6649, 72.0252, -1.4002, 71.8982, -1.417, 71.8855, -1.3403, 71.8332
       , -1.2964, 71.8326, .1123, 72.074, 1.5209, 72.3153, 2.9296, 72.5567, 3.7046, 72.6857, 4.4796, 72.8146, 4.5257, 72.8115
       , 4.5476, 72.799, 4.5273, 72.786, 3.696, 72.6769, 3.6234, 72.638, 2.2485, 72.4053, .8735, 72.1727, -.5014, 71.94, -.5454
       , 71.9384, -.7357, 72.0499, .4759, 72.2537, 1.6876, 72.4575, 2.8992, 72.6613, 2.9211, 72.6507, 1.9359, 72.4834, .9506
       , 72.316, -.0346, 72.1487, -.028, 72.1346, .009, 72.1265, .9959, 72.2905, 1.9827, 72.4546, 2.9696, 72.6186, 3.0143
       , 72.6149, 3.0332, 72.6001, 3.002, 72.5875, 2.0095, 72.42, 1.0169, 72.2524, .0244, 72.0849, .0186, 72.0717, .0446
       , 72.0605, .0888, 72.0604, 1.0737, 72.2246, 2.0587, 72.3887, 3.0436, 72.5529, 3.111, 72.5134, 2.14, 72.3481, 1.169
       , 72.1829, .198, 72.0176, .2107, 72.0031, .2599, 71.9984, 1.2471, 72.1609, 2.2343, 72.3234, 3.2215, 72.4859, 3.2602
       , 72.478, 3.2657, 72.4632, 2.278, 72.2965, 1.2903, 72.1297, .3026, 71.963, .2758, 71.952, .2828, 71.9386, .3297, 71.9323
       , 1.2185, 72.0805, 1.7223, 72.1642, 2.503, 72.2919, 3.2837, 72.4196, 3.3688, 72.3642, 2.4037, 72.2013, 1.4386, 72.0384
       , .4735, 71.8755, .5692, 71.8254, .6111, 71.8254, 1.125, 71.9124, 2.0029, 72.0607, 2.7263, 72.1807, 2.7578, 72.1925
       , 2.2202, 72.4803, 1.6826, 72.7682, 1.5122, 72.7334, 2.1082, 72.3975, 2.7043, 72.0615, 3.3003, 71.7256, 3.3001, 71.7124
       , 3.2157, 71.6973, 3.1737, 71.6952, 2.3869, 72.1318, 1.6002, 72.5685, .8134, 73.0051, .5468, 73.1462, .3685, 73.1217
       , .3595, 73.1095, 1.1552, 72.6727, 1.9509, 72.2359, 2.7466, 71.7991, 3.2359, 71.5183, 3.2114, 71.5062, 3.0948, 71.4854
       , 3.0524, 71.4834, 2.2702, 71.9181, 1.488, 72.3528, .7058, 72.7875, .121, 73.0845, -.0487, 73.0569, .2024, 72.9178
       , .388, 72.9389, .4762, 72.9269, .5364, 72.89, .3319, 72.8554, .3409, 72.8406, 1.0959, 72.4252, 1.8508, 72.0099, 2.6058
       , 71.5945, 2.4501, 71.5637, 2.4042, 71.566, 1.6172, 71.9987, .8302, 72.4313, .0432, 72.864, -.1008, 72.9388, -.1515
       , 72.9379, -.6602, 72.8529, -.6974, 72.8597, -.8222, 72.9223, -.8075, 72.9346, -.7236, 72.9474, -.5355, 72.9736, -.5009
       , 72.9844, -.4884, 72.9991, -.5006, 73.0334, -.3954, 72.9838, .2817, 72.6227, .9588, 72.2616, 1.6359, 71.9005, 1.603, 71.8921
       , 1.4702, 71.8735, 1.4273, 71.8777, .8944, 72.1673, .3614, 72.4568, .3643, 72.4713, 1.4427, 72.6505, 2.521, 72.8297, 2.6168
       , 72.7773, 2.5908, 72.767, 1.1703, 72.5281, -.2502, 72.2891, -.2771, 72.2779, -.2594, 72.2632, -.212, 72.2585, .8306
       , 72.4334, 1.8733, 72.6083, 2.9159, 72.7832, 2.9674, 72.7852, 2.9902, 72.7712, 2.9657, 72.7592, 1.9165, 72.5801
       , .8673, 72.4009, -.1819, 72.2218, -.1901, 72.2083, -.1611, 72.1973, -.1161, 72.1973, .9307, 72.3749, 1.9774, 72.5525
       , 3.0242, 72.7301, 3.0573, 72.7214, 3.3182, 72.5681, 2.3711, 72.4083, 1.6896, 72.4105, 1.4702, 72.2525, .0765, 72.0164
       , -1.3172, 71.7804, -1.5303, 71.9025, -1.5214, 71.9157, -.7819, 72.0493, -.7584, 72.0625, -.1361, 72.1707, -.0875, 72.1713
       , .0304, 72.0919, .0141, 72.0786, -.9506, 71.905, -1.9152, 71.7315, -1.9596, 71.7391, -1.9712, 71.7533, -1.9458, 71.7646
       , -1.8996, 71.7677, -1.8199, 71.7848, -1.7743, 71.7845, -1.7465, 71.7709, -1.7419, 71.7559, -1.8251, 71.744, -1.8392, 71.73
       , -1.7998, 71.7272, -1.7953, 71.7285, -1.6374, 71.7675, -1.6548, 71.7691, -1.8372, 71.7472, -1.8217, 71.746, -1.8177, 71.7408
       , -1.7915, 71.748, -1.8019, 71.7254, -1.9911, 71.2377, -2.1803, 70.7499, -2.3695, 70.2622, -2.55, 69.7684, -2.7305, 69.2745
       , -2.911, 68.7807, -3.0756, 68.2892, -3.2401, 67.7976, -3.4047, 67.3061, -3.5591, 66.8129, -3.7134, 66.3197, -3.8678, 65.8265
       , -4.0106, 65.3313, -4.1534, 64.8361, -4.2962, 64.3409, -4.3917, 64.0736, -4.5101, 63.6701, -4.6284, 63.2665, -4.7468, 62.863
       , -4.8133, 62.5646, -4.8797, 62.2661, -5.0123, 61.8243, -5.1449, 61.3824, -5.2784, 60.8876, -5.412, 60.3927, -5.5455, 59.8979
       , -5.6914, 59.4059, -5.8373, 58.914, -5.9832, 58.422, -6.1319, 58.0188, -6.1481, 58.0064, -6.4952, 57.9001, -6.8148, 57.4395
       , -7.1344, 56.979, -7.454, 56.5184, -7.5405, 56.3236, -7.1569, 56.009, -6.7734, 55.6943, -6.3898, 55.3797, -6.1153, 55.3535
       , -5.8063, 55.0412, -5.4973, 54.7289, -5.1883, 54.4166, -5.3286, 53.9254, -5.4688, 53.4341, -5.6091, 52.9429, -5.7337, 52.4541
       , -5.8583, 51.9652, -5.9829, 51.4764, -5.9945, 50.9804, -6.0062, 50.4845, -6.0178, 49.9885, -5.7687, 49.5197, -5.5196, 49.0509
       , -5.2705, 48.5821
-- Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
-- Threshold value to be used for the geometry simplification.
-- Should be a positive number. (Zero causes the input geometry to be returned.)
-- If the input geometry is geodetic, the value is the number of meters;
-- if the input geometry is non-geodetic, the value is the number of units associated with the data.
-- Tolerance reflects the distance that two points can be apart and still be considered the same
-- MUST NOT! be greater than threshold, or null (then internally = 0.005)
--> You have defined a tolerance in metadata with 0.05; so why don't use here?
        SELECT ID,
               sdo_util.simplify(
                                 GEOM,
                                 10000,0.05) SMPL_SHAPE
              FROM TEST_SP A;
         1
SDO_GEOMETRY(2006, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
-4,4782378, 48,3825828, -4,8323474, 48,2797711, -5,2159566, 48,4627829, -5,88816
28, 50,0156972, -5,1849215, 54,3967266, -6,0559248, 55,4059499, -6,5756301, 55,4
708485, -7,5433349, 56,3382611, -6,6858165, 57,6307846, -5,8250091, 57,9737903,
-3,3610006, 62,7598027, -5,9890247, 64,9128292, -3,9806117, 65,9147493, -3,16320
41, 67,3597054, -2,4798621, 71,9148546, -1,9742256, 71,7432283, 4,41878772, 72,8
698623, -1,416879, 71,8860517, 4,52649053, 72,8122526, -,50120336, 71,9405632, -
,73551748, 72,0504801, 2,89978127, 72,6620086, -,03435262, 72,1492992, 2,97018311
, 72,6193014, ,018847266, 72,0722867, 3,04418215, 72,5535901, ,198259139, 72,0181787
, 3,22209193, 72,4865797, ,276061466, 71,9525685, 3,28428939, 72,4202686, ,473772831
, 71,8760574, 2,72680263, 72,1813226, 1,68306421, 72,7689189, 3,30060056
, 71,7129527, ,547178691, 73,1469855, 3,05285269, 71,4839162, ,121326784, 73,085271
, 2,45051033, 71,5642229, -,10050751, 72,9395414, -,82198316, 72,9230354, -,50034338
, 73,0341583, 1,47055648, 71,874063, ,364605226, 72,4719567, 2,52156221, 72,8304369
, -,24996327, 72,2897221, 2,91649976, 72,7839314, -,18986264, 72,2089086
, 3,02480439, 72,7308224, 3,31881376, 72,5687954, -1,3170745, 71,7809355, -1,5212864
, 71,9162563, -,13586013, 72,1713025, ,014347302, 72,0791878, -1,9711251
, 71,75383, -1,6372994, 71,7680328, -3,7134102, 66,319762, -5,5455029, 59,897899
, -6,1319107, 58,0187899, -6,4952136, 57,9000878, -7,540535, 56,3235608, -5,1883214
, 54,4165272, -5,9829533, 51,4761912, -6,0178661, 49,9881936, -5,2705573, 48,5816924))
        SELECT ID,
               sdo_util.simplify(
                                 GEOM,
                                 1000,0.05) SMPL_SHAPE
              FROM TEST_SP A;
         1
SDO_GEOMETRY(2006, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
-4,4782378, 48,3825828, -4,5072387, 48,35188, -4,8323474, 48,2797711, -4,9683509
, 48,2972713, -5,2159566, 48,4627829, -5,8881628, 50,0156972, -5,8003495, 51,496
9942, -5,5118342, 52,9619711, -5,4198306, 53,3166867, -5,3821299, 53,3367877, -5
,1849215, 54,3967266, -6,0559248, 55,4059499, -6,5756301, 55,4708485, -7,5433349
, 56,3382611, -6,6858165, 57,6307846, -5,8250091, 57,9737903, -4,7190009, 60,166
6997, -3,5777005, 62,2962013, -3,3610006, 62,7598027, -4,4027049, 63,6375088, -5
,9890247, 64,9128292, -3,9806117, 65,9147493, -3,1632041, 67,3597054, -3,006201,
67,7414256, -2,4798621, 71,9148546, -1,9742256, 71,7432283, ,964944602, 72,2605
232, 2,24328978, 72,4805703, 4,44568645, 72,8442578, 4,41878772, 72,8698623, 1,5
2000878, 72,3918494, -1,416879, 71,8860517, -1,3401746, 71,8337437, -1,2962712,
71,8331437, ,112555419, 72,0745875, 1,52130154, 72,3159363, 4,52649053, 72,81225
26, 4,52808622, 72,7867478, 3,69667156, 72,6776188, 3,6240575, 72,638711, 2,2489
818, 72,4059572, -,50120336, 71,9405632, -,54520702, 71,9389628, -,73551748, 72,
0504801, ,476199597, 72,2543194, 2,89978127, 72,6620086, 2,92168221, 72,6514068,
1,93635925, 72,4840686, -,03435262, 72,1492992, ,009249796, 72,1270957, 2,97018
311, 72,6193014, 3,03378745, 72,6007986, 3,00258239, 72,588196, ,024648569, 72,0
854889, ,018847266, 72,0722867, ,089052559, 72,0609852, 3,04418215, 72,5535901,
3,11158397, 72,5140836, ,198259139, 72,0181787, ,260163137, 71,9989759, 3,222091
93, 72,4865797, 3,26629348, 72,4638761, ,276061466, 71,9525685, ,329964682, 71,9
328656, 3,28428939, 72,4202686, 3,36939068, 72,3648597, ,473772831, 71,8760574,
,569477285, 71,82595, ,611380719, 71,8259502, 2,72680263, 72,1813226, 2,75830711
, 72,1931249, 1,68306421, 72,7689189, 1,5126426, 72,7341112, 3,30060056, 71,7129
527, 3,17418717, 71,6957489, 1,60063452, 72,5691815, ,547178691, 73,1469855, ,35
9854829, 73,1102772, 1,95133441, 72,2365257, 3,23637231, 71,518823, 3,05285269,
71,4839162, 1,48840202, 72,3534425, ,121326784, 73,085271, -,04839361, 73,057664
8, ,202722649, 72,9185387, ,388343833, 72,9396437, ,47655216, 72,9276418, ,53675
5404, 72,890735, ,33223128, 72,8561273, ,341231045, 72,8413245, 1,09627118, 72,4
258526, 2,60622659, 71,5950287, 2,45051033, 71,5642229, 2,40460672, 71,5665229,
1,61758053, 71,999284, -,10050751, 72,9395414, -,65997036, 72,8536226, -,8219831
6, 72,9230354, -,50064638, 72,9851486, -,50034338, 73,0341583, 1,63627318, 71,90
10684, 1,47055648, 71,874063, 1,42765317, 71,8782634, ,894730643, 72,1679072, ,3
64605226, 72,4719567, 2,52156221, 72,8304369, 2,61736591, 72,7780277, 2,59136171
, 72,7677256, -,24996327, 72,2897221, -,25916558, 72,2638176, -,21176165, 72,259
117, 2,91649976, 72,7839314, 2,96800578, 72,7859322, 2,96630196, 72,7599273, -,1
8166113, 72,2224109, -,18986264, 72,2089086, -,1158568, 72,197907, ,931051106, 7
2,3755428, 3,02480439, 72,7308224, 3,31881376, 72,5687954, 2,37159441, 72,408958
7, 1,69002721, 72,411154, 1,47059079, 72,2531252, -1,3170745, 71,7809355, -1,521
2864, 71,9162563, -,13586013, 72,1713025, -,08725586, 72,1719028, ,014347302, 72
,0791878, -1,9151213, 71,7320267, -1,9711251, 71,75383, -1,7742095, 71,7850351,
-1,7418077, 71,7564308, -1,8250142, 71,7445288, -1,8391156, 71,7305266, -1,79971
27, 71,7277262, -1,6372994, 71,7680328, -1,8371151, 71,7477293, -1,7914116, 71,7
485295, -2,5499818, 69,7686808, -3,7134102, 66,319762, -4,296207, 64,3409166, -4
,7468036, 62,8630039, -4,8797025, 62,2661018, -5,5455029, 59,897899, -5,9832082,
58,4219931, -6,1319107, 58,0187899, -6,4952136, 57,9000878, -7,4540322, 56,5183
651, -7,540535, 56,3235608, -6,3898286, 55,3796474, -6,1153258, 55,3534483, -5,1
883214, 54,4165272, -5,9829533, 51,4761912, -6,0178661, 49,9881936, -5,2705573,
48,5816924))
        SELECT ID,
               sdo_util.simplify(
                                 GEOM,
                                 100000,0.05) SMPL_SHAPE
              FROM TEST_SP A;             
         1
SDO_GEOMETRY(2006, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY(
-4,4782378, 48,3825828, -7,5433349, 56,3382611, -3,3610006, 62,7598027, -5,9890247
, 64,9128292, -2,4798621, 71,9148546, 4,54839096, 72,7997504, ,569477285, 71,82595
, ,547178691, 73,1469855, 3,23637231, 71,518823, -,82198316, 72,9230354, 3,31881376
, 72,5687954, -1,9711251, 71,75383, -7,540535, 56,3235608, -5,1883214, 54,4165272
, -5,2705573, 48,5816924))              Which version of server and client do you use (database)?
regards, Andreas

Similar Messages

  • ORA13226 when using view with geometry created using sdo_util.simplify

    I have a polygon table (and spatial index) using Ora11.1 that i can query such as:
    Select ID From MyTable A where (MDSYS.SDO_RELATE(A.GEOMETRY, SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3), SDO_ORDINATE_ARRAY(73.091805, 18.312310, 72.250051, 19.076872)), 'mask=INSIDE+COVEREDBY+EQUAL querytype=window') = 'TRUE');
    This query returns 2 rows. I have created a view:
    create or replace view v_MyTable as
    select id, sdo_util.simplify(geometry,20,2) as s_geometry
    from MyTable;
    The subsequent query returns ORA13226
    Select ID From v_MyTable A where (MDSYS.SDO_RELATE(A.S_GEOMETRY, SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3), SDO_ORDINATE_ARRAY(73.091805, 18.312310, 72.250051, 19.076872)), 'mask=INSIDE+COVEREDBY+EQUAL querytype=window') = 'TRUE');
    If I create a view which does not use the simplify function the query works.

    tcbalent,
    This is correct behaviour if you are trying the query the view:
    Select ID
      From V_MyTable A
    where (MDSYS.SDO_RELATE(A.GEOMETRY, SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 3), SDO_ORDINATE_ARRAY(73.091805, 18.312310, 72.250051, 19.076872)), 'mask=INSIDE+COVEREDBY+EQUAL querytype=window') = 'TRUE');This is because the A.GEOMETRY is not the geometry in the original table (MyTable) but a programmatically
    constructed geometry on the fly which is not indexed.
    You can fix this with a function based index as follows (NOTE: This uses my own test data that is projected and not geodetic):
    DROP  table myTable;
    create table myTable
    as
    select rownum as Id, geom as geometry
    from  projpoly2d
    where polytype NOT IN ('COMPOUNDOUTERSHELL','VERTEXWITHARCNOHOLE');
    delete from user_sdo_geom_metadata where table_name = 'MYTABLE' and column_name = 'GEOMETRY'; commit;
    insert into user_sdo_geom_metadata(table_name, column_name,diminfo,srid)
    select 'MYTABLE','GEOMETRY',diminfo,srid
      from user_sdo_geom_metadata
    where table_name = 'PROJPOLY2D'
       and column_name = 'GEOM';
    commit;
    create or replace view v_MyTable
    as
    select id, sdo_util.simplify(geometry,20,2) as S_geometry
    from MyTable;
    -- Create index metadata
    delete from user_sdo_geom_metadata where table_name = 'MYTABLE' and column_name = 'MDSYS.SDO_UTIL.SIMPLIFY(GEOMETRY,20,2)'; commit;
    insert into user_sdo_geom_metadata(table_name, column_name,diminfo,srid)
    select 'MYTABLE','MDSYS.SDO_UTIL.SIMPLIFY(GEOMETRY,20,2)',diminfo,srid
      from user_sdo_geom_metadata
    where table_name = 'MYTABLE' and column_name = 'GEOMETRY';
    commit;
    select * from user_sdo_geom_metadata;
    -- Now create index
    drop   index MyTable_sgeometry_spdx;
    create index MyTable_sgeometry_spdx on MyTable(MDSYS.SDO_UTIL.SIMPLIFY(GEOMETRY,20,2))
         indextype is mdsys.spatial_index parameters('sdo_indx_dims=2, layer_gtype=polygon');
    Select ID
      From v_MyTable A
    where (MDSYS.SDO_RELATE(A.S_GEOMETRY,
                             MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3), MDSYS.SDO_ORDINATE_ARRAY(190000.0, 5120000.0, 640000.0, 5630000.0)),
                            'mask=INSIDE+COVEREDBY+EQUAL querytype=window') = 'TRUE');
    -- Result
    ID                    
    5                     
    1                     
    4                     
    2                     
    6If this fixes your problem please mark this thread as answered.
    regards
    Simon

  • Simplifying Complex Polygons

    Hi all,
    I need to simplify a coverage data by removing the number of vertices for speeding up the analysis..I understand teh sdo_util.simplify will help us to acheive this.Can someone help me how to go about this.Do i need to write PL/sql to acheive this , can anyone post any examples how they simplify the complex polygons.
    And what is teh difference between teh wrapper(sdo_sam.simplify_geometry) and sdo_util.simplify?
    Thank you very much.

    Hi,
    sdo_util.simplify uses the Douglas-Peuker algorithm to simplify geometry. It is the algorithm used by most GIS to achieve this as it removes vertices whilst retaining shape.
    You do not need to use PL/SQL as you can do using SQL.
    I have done some experiments with simplify to achieve greater performance in an application. It uses the same algorithm but uses a 3rd party package.
    I used
    CREATE TABLE SIMPLIFIED AS
    SELECT fz_id, sdo_util.simplify(c.geom, 1) simplified, c.geom
    FROM nfcdd_owner_flood_zone_3_fluv1 c
    in my tests.
    Ivan

  • ObjectFile.load() getting in an infinite loop?

    Hi all,
    I am having problems loading ObjectFiles with Java3D, essentially it appears that the load method of the ObjectFile class gets stuck in some sort of loop. I discovered this since the method would be executing for minutes for something that I assume would not take that long without throwing any exceptions. I have tried loading with a string for the filename, as well as a URL and the result is the same. To ascertain the problem I have been using the Debugger in Netbeans to see the trace.
    I know the Object file must be fine since I can load it fine with a library called JOGLOBJ http://code.google.com/p/joglobj/ . I did suspect it may be something to do with the version of Java3D included with Snow Leopard, but changing the default libraries with the latest version does not change anything.
    File f = new File("woman1.obj");
    URL urlToModel = f.toURI().toURL();
    ObjectFile fl = new ObjectFile();
    Scene s = fl.load(urlToModel);The hang happens at with the call to load. Unfortunately I cant seem to get the source for Java3D to show up in the Debugger, so the Java3D methods calls are not visible. The calls above are to BufferedReader.read then below that are calls to StreamDecoder and below the Java3D calls are to InputStreamReader, BufferedReader and StringTokenizer, then calls to ObjectFile.
    BufferedInputStream.read:308
    StreamDecoder.readBytes:264
    StreamDecoder.implRead:306
    StreamDecoder.read:158
    InputStreamReder.read:167
    BufferedReader.fill:136
    BufferedReader.read:157
    StreamTokenizer.read:486
    StreamTokenizer.nextToken:527
    ObjectFileParser.getToken:99
    ObjectFileParser.skipToNextLine:145
    ObjectFile.readFile:602
    My code:
    I suppose that one alternative is to Build up Java3D objects from the raw vertex data that I have read with JOGLOBJ. Would I need to build Objects such as GeometryArrays. The main reason I wish to use Java3D is for the Vertex Splitting methods that it has, so that I can simplify geometry.
    Thanks,
    Lawrence

    Seems that this is an issue in Java3D when using files from Meshlab which have no EOF character [ Issue 587|https://java3d.dev.java.net/issues/show_bug.cgi?id=587] I guess that the Java3D parser is not robust enough to recognise when the end of file occurs. Would a workaround be to insert an EOF into each obj file manually?

  • Sdo_util.simplify - Error? Bug? Totally stumped !

    Hi folks,
    I have a confusing problem/error with using sdo_util.simplify. I am using Oracle 11G R2 with Spatial Option.
    I have loaded just over 2000 UK postown polygons - based on an OS source. These loaded fine and have been working perfectly well with spatial sql.
    The source data specifies the projection as British National Grid GCS_OSGB_1936 and the SRID within the Oracle metadata was correctly (i believe) determined (by calculate mbr) and set to 7405 - OSGB36 / British National Grid
    I can view the polygons perfectly fine in SqlDeveloper/GeoRaptor and if export them to KML and view them in Google Earth they position and display exactly as I would expect.
    All other spatial functions I have tried on the polygons work fine.
    The problem comes when I try and use sdo_util.simplify to reduce the number of co-ordinates used on the polygons :
    select sdo_util.simplify(poly_hi,100,0.005)
    from posttown_boundaries;
    ORA-13199: the given geometry cannot be rectified
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.SDO_UTIL", line 716
    ORA-06512: at "MDSYS.SDO_UTIL", line 770
    ORA-06512: at line 1
    13199. 00000 - "%s"
    *Cause:    This is an internal error.
    *Action:   Contact Oracle Support Services.
    I've tried various threshold and tolerance values ( the only threshold value that works is 0 which returns the same geometry.
    I have successfully used the sdo_util.simpify functions on the other spatial objects in the database so I don't believe it to be a database setup issue.
    When I run a validate geometry on the table for the geometry column I get the ORA-13029: Invalid SRID in the SDO_GEOMETRY object.
    However, as explained above the SRID was selected and checked using calculate MBR and it matches exactly what I would have expected given the source data and i have not found any other issues with the SRID.
    The error can be reproduced without any of the source tables by just taking one small polygon definition as follows:
    select sdo_util.simplify(
    MDSYS.SDO_GEOMETRY(
    2003,7405,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
    MDSYS.SDO_ORDINATE_ARRAY(407207.997315803,287087.001455892,
    406802.999914517,286916.000404434,
    406677.996543163,286831.004734191,
    406518.001132497,286741.000497636,
    406863.996876543,286566.000590838,
    407284.000289033,286672.000248752,
    407207.997315803,287087.001455892))
    ,5,0.005)
    FROM dual;
    ORA-13199: the given geometry cannot be rectified
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.SDO_UTIL", line 716
    ORA-06512: at "MDSYS.SDO_UTIL", line 770
    ORA-06512: at line 1
    13199. 00000 - "%s"
    *Cause:    This is an internal error.
    *Action:   Contact Oracle Support Services.
    Am totally stumped with this!
    Can anyone offer any thoughts or guidance?
    Many thanks in advance.
    Mike.

    Hi Mike,
    Usually someone jumps in early with the "geometry ain't valid" answer so I am late to the party. When I attempt to validate your 7405 geometry using 11gR2, I receive back error 13029.
    SELECT
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(
       MDSYS.SDO_GEOMETRY(
          2003,
          7405,
          NULL,
          MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
          MDSYS.SDO_ORDINATE_ARRAY(
             407207.997315803,287087.001455892,
             406802.999914517,286916.000404434,
             406677.996543163,286831.004734191,
             406518.001132497,286741.000497636,
             406863.996876543,286566.000590838,
             407284.000289033,286672.000248752,
             407207.997315803,287087.001455892
       0.005
    FROM
    dualThe error indicates that SRID 7405 "is invalid" which is not really all that informative. As you note above 7405 exists in MDSYS but its marked as a COMPOUND CRS which to keep it simple is a 3D CRS.
    (see http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28400/sdo_cs_concepts.htm#autoId18)
    Thus "invalid" in this context means the SRID is invalid for the geometry you are putting it upon.
    So if we just add a Z to your geometry everything works hunky-dory
    SELECT
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(
       MDSYS.SDO_GEOMETRY(
          3003,
          7405,
          NULL,
          MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
          MDSYS.SDO_ORDINATE_ARRAY(
             407207.997315803,287087.001455892,0,
             406802.999914517,286916.000404434,0,
             406677.996543163,286831.004734191,0,
             406518.001132497,286741.000497636,0,
             406863.996876543,286566.000590838,0,
             407284.000289033,286672.000248752,0,
             407207.997315803,287087.001455892,0
       0.005
    FROM
    dualAnd your SIMPLIFY task also then works fine
    SELECT
    SDO_UTIL.SIMPLIFY(
       MDSYS.SDO_GEOMETRY(
          3003,
          7405,
          NULL,
          MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
          MDSYS.SDO_ORDINATE_ARRAY(
             407207.997315803,287087.001455892,0,
             406802.999914517,286916.000404434,0,
             406677.996543163,286831.004734191,0,
             406518.001132497,286741.000497636,0,
             406863.996876543,286566.000590838,0,
             407284.000289033,286672.000248752,0,
             407207.997315803,287087.001455892,0
       5,
       0.005
    FROM
    dualSo long-winded way to reiterate what Ivan said - you are using the wrong SRID. 10g was more forgiving than 11g when mixing and matching 3D and 2D SRIDs with data. 11g is more picky but not always that great at explaining the pickiness. I would bet if you had got back an error such as "2D coordinates not valid with 3D SRID" you would never have needed to post the question. I would suggest putting in an enhancement request to Support for some better error messages.
    Cheers,
    Paul
    Edited by: Paul Dziemiela on Nov 6, 2011 10:58 AM

  • SDO_UTIL.SIMPLIFY - 101 Uses (almost)

    SDO_UTIL.SIMPLIFY
    “Simplifies the input geometry, based on a threshold value, using the Douglas-Peucker algorithm.”
    This is an understated description if there is one. This function can do much more for you than just simplify the geometry, it will also convert arcs to line stings, eliminate duplicate verticies, and correct many overlapping edge polygon problems.
    I “discovered” this additional functionality while trying to get a process down to import reference ESRI shapefile data (GeoBase CIP's) stored in state-plane format into OS (Oracle Spatial) using Lat/Long. Most of the problems I encountered were due to overlapping polygon edges, duplicate verticies, and arcs in line strings. At first, I discreetly defused these issues by finding the errors (with code) and then fixing them based on the returned error codes. This was painfully slow and a real pain to code.
    Then I took a look at the incoming data, and determined that many times, the drafters (possibly from a CAD to GIS conversion) really went overboard and included many times more points than necessary for the accuracy I was interested in for the reference data. I looked at several of the simplify options and since I wanted to simplify the data in-place using an update statement, I choose this one. Then once, I ran the simplify command out of order by accident (before the arc/duplicate/overlap routine). Not only did it simply the data, it also “fixed” all the other problems as well!
    So – note to Oracle staff – great job! You might want to update the documentation to mention all the things it does while simplifying the data, as this is VERY useful for migrating troublesome data. However, I noticed that it can overtake all the memory (and take forever to run) on your database box if you make the mistake of specifying the same values for threshold and tolerance. The docs do state that the tolerance “Must not be greater than threshold.”, but I'd add that they also should not be the same.
    As always, YMMV...
    Bryan

    tdsacilowski wrote:
    All together there are about 20 machines that display a page that has one of the above 5 second refreshes. The application is also public; there is no authentication. From my understanding about how APEX handles sessions there is a max session length (8 hours in my case) even for public sessions. As a page is rendered, a hidden form variable is created called p_instance and the AJAX calls send this to the server to process the request within the active session. In theory, the application shouldn't be generating a lot of new sessions since once a page is loaded it is used simple to display an updating value. In other words, there's no user interaction. No page reloads, no new items being set in session state.
    no interaction, 24/7 uptime, refreshing every 5s, and it is all public.....
    I'd almost look at a slightly different architecture.
    option one:
    have a basic, static web page that calls an APEX REST service.
    This html file and any neccessary css, js files will reside on the same webserver as the APEX listener, but in a different WAR file.
    option two:
    make a simple java swing app using JDBC to connect directly to the database.
    use Oracle Wallet technology so you don't have to hardcode the name/password in plain text.
    have the DBA create an account with very limited access and a profile to guarantee it will never suck-up DB resources.
    *** IIRC -- the OCI version includes the capability of triggering an event (in Java) when a table gets update. ****
    APEX is a very good tool.
    But, for your case, it sounds like it is overkill for your requirements.
    MK

  • Error while running spatial queries on a table with more than one geometry.

    Hello,
    I'm using GeoServer with Oracle Spatial database, and this is a second time I run into some problems because we use tables with more than one geometry.
    When GeoServer renders objects with more than one geometry on the map, it creates a query where it asks for objects which one of the two geometries interacts with the query window. This type of query always fails with "End of TNS data channel" error.
    We are running Oracle Standard 11.1.0.7.0.
    Here is a small script to demonstrate the error. Could anyone confirm that they also have this type of error? Or suggest a fix?
    What this script does:
    1. Create table object1 with two geometry columns, geom1, geom2.
    2. Create metadata (projected coordinate system).
    3. Insert a row.
    4. Create spacial indices on both columns.
    5. Run a SDO_RELATE query on one column. Everything is fine.
    6. Run a SDO_RELATE query on both columns. ERROR: "End of TNS data channel"
    7. Clean.
    CREATE TABLE object1
    id NUMBER PRIMARY KEY,
    geom1 SDO_GEOMETRY,
    geom2 SDO_GEOMETRY
    INSERT INTO user_sdo_geom_metadata (table_name, column_name, srid, diminfo)
    VALUES
    'OBJECT1',
    'GEOM1',
    2180,
    SDO_DIM_ARRAY
    SDO_DIM_ELEMENT('X', 400000, 700000, 0.05),
    SDO_DIM_ELEMENT('Y', 300000, 600000, 0.05)
    INSERT INTO user_sdo_geom_metadata (table_name, column_name, srid, diminfo)
    VALUES
    'OBJECT1',
    'GEOM2',
    2180,
    SDO_DIM_ARRAY
    SDO_DIM_ELEMENT('X', 400000, 700000, 0.05),
    SDO_DIM_ELEMENT('Y', 300000, 600000, 0.05)
    INSERT INTO object1 VALUES(1, SDO_GEOMETRY(2001, 2180, SDO_POINT_TYPE(500000, 400000, NULL), NULL, NULL), SDO_GEOMETRY(2001, 2180, SDO_POINT_TYPE(550000, 450000, NULL), NULL, NULL));
    CREATE INDEX object1_geom1_sidx ON object1(geom1) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    CREATE INDEX object1_geom2_sidx ON object1(geom2) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    SELECT *
    FROM object1
    WHERE
    SDO_RELATE("GEOM1", SDO_GEOMETRY(2001, 2180, SDO_POINT_TYPE(500000, 400000, NULL), NULL, NULL), 'MASK=ANYINTERACT') = 'TRUE';
    SELECT *
    FROM object1
    WHERE
    SDO_RELATE("GEOM1", SDO_GEOMETRY(2001, 2180, SDO_POINT_TYPE(500000, 400000, NULL), NULL, NULL), 'MASK=ANYINTERACT') = 'TRUE' OR
    SDO_RELATE("GEOM2", SDO_GEOMETRY(2001, 2180, SDO_POINT_TYPE(500000, 400000, NULL), NULL, NULL), 'MASK=ANYINTERACT') = 'TRUE';
    DELETE FROM user_sdo_geom_metadata WHERE table_name = 'OBJECT1';
    DROP INDEX object1_geom1_sidx;
    DROP INDEX object1_geom2_sidx;
    DROP TABLE object1;
    Thanks for help.

    This error appears in GeoServer and SQLPLUS.
    I have set up a completly new database installation to test this error and everything works fine. I tried it again on the previous database but I still get the same error. I also tried to restart the database, but with no luck, the error is still there. I geuss something is wrong with the database installation.
    Anyone knows what could cause an error like this "End of TNS data channel"?

  • MapViewer geometry theme 'mouse_click' doesn't always work in FF3

    I have code that works with IE7 but not FireFox 3 (I'm using MapViewer Ver1033p5_B080908 and an 11.1.0.6 db). I've been able to duplicate it by only slightly modifying Oracle Maps demo #5, "Theme Based FOI layer visibility". Code is shown below.
    I'm displaying two geometry themes. I need to know when the user clicks on either theme or the background. I add the themes and call setEventListener('mouse_click') for both themes and the mapview. In IE7 I get the expected result - one of the three handlers gets called depending on where I click. In FF3 (specifically 3.0.3) only the "top" theme's mouse handler is active. Cicking on the bottom theme - even when there is no overlap at all - only calls the mapview's handler. Same is true with info tooltips - they display for both themes in IE7, but only for the top theme in FF3. (http://www.navsys.com/BruceB/mapviewer.gif shows the two themes - one green, the other pink. On FF3 I never get a "hand" cursor or a tooltip over any of the pink areas, and clicking calls the mapview handler, not the theme handler.)
    Incidently if I hide the "top" theme, then the mouse clicks/tooltip work again on the other theme.
    Is this expected?
    Thanks!
    -Bruce
    <html>
    <head>
    <META http-equiv="Content-Type" content="text/html" charset=UTF-8">
    <TITLE>Map Cache Server/Map Client</TITLE>
    <link rel="stylesheet" type="text/css" href="../t.css" />
    <script language="Javascript" src="/mapviewer/fsmc/jslib/oraclemaps.js"></script>
    <script language=javascript>
    var mapview;
    function showMap()
    var baseURL = "http://"+document.location.host+"/mapviewer";
    var mapCenterLon = -83.498
    var mapCenterLat = 31.453;
    var mapZoom = 4;
    var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
    mapview = new MVMapView(document.getElementById("map"), baseURL);
    mapview.addMapTileLayer(new MVMapTileLayer("mapdata.demo_map"));
    mapview.setCenter(mpoint);
    mapview.setZoomLevel(mapZoom);
    mapview.setEventListener('mouse_click',backgroundClick);
    addThemeBasedFOI();
    mapview.addNavigationPanel() ;
    mapview.display();
    function addThemeBasedFOI()
    var themebasedfoi1 = new MVThemeBasedFOI('themebasedfoi1','grim.T_121_GBOTEST_70265_F');
    themebasedfoi1.enableAutoWholeImage(true) ;
         themebasedfoi1.setEventListener('mouse_click',theme1clicked);
    mapview.addThemeBasedFOI(themebasedfoi1);
    var themebasedfoi2 = new MVThemeBasedFOI('themebasedfoi2','grim.TR_GBOTEST_86094_F');
    themebasedfoi2.setEventListener('mouse_click',theme2clicked);
    mapview.addThemeBasedFOI(themebasedfoi2);
    function setVisible(item)
    var themebasedfoi = mapview.getThemeBasedFOI(item.value);               
    themebasedfoi.setVisible(!themebasedfoi.isVisible());
    function theme1clicked(pt,foidata,me)
         alert('Tour clicked');
    function theme2clicked(pt,foidata,me)
         alert('Best clicked');
    function backgroundClick()
    alert('background click');
    </script>
    </head>
    <body onload="javascript:showMap();">
    <h3>Oracle Maps example - show/hide Theme Based FOI layers </h3>
    <ul>
    <LI ><INPUT TYPE="checkbox" value="themebasedfoi1" onclick="setVisible(this)" checked/>Show County population layer
    <LI ><INPUT TYPE="checkbox" value="themebasedfoi2" onclick="setVisible(this)" checked/>Show Customer layer
    </ul>
    <div id="map" style="left:0px;top:10px;width:100%; height:60%"></div>
    <HR/>
    </body>
    </html>

    Alan McClean has alluded to the cause of this behaviour but I think others would benefit from a full explanation because it doesn't appear to be documented. I might add that Business Objects support were no help at all on this (they suggested I had a problem with my mouse, PC or network which I don't).
    Normal response to a mouse double-click on a document name in InfoView XI3:
    The double-click action performs the default action on the right-click list. This is the option you see in bold when you right-click on a document name. The default action is 'View' document. So when you double-click on the document it opens for viewing.
    In CMC, under Applications>InfoView if you set 'Default viewing action on listing page:' to 'View the latest successful instance of the object' then the double-click behaviour changes:
    The double-click action now tries to open the latest successful instance of a document. I found that any document in my Inbox or any document with instances (e.g. scheduled report) will still open for viewing using the double-click. For any other document the double-click fails silently. I assume this is because there simply isn't a latest instance to open.
    Conclusions:
    1. Don't use the 'View the latest successful instance of the object'. I have reset my CMC setting back to 'View the object'.
    2. I think Business Objects should change the double-click behaviour so that rather than fail silently it opens the document.

  • Get all vertices from a geometry of multiple polygons

    I tried to use sdo_util.GetVertices to retrieve all the vertices from a geometry column. Some of the geometries of gType 2007 that contains more than one element. The getVertices function seems to give back the vertices of the first element only. How can I get all the vertices then?
    Edited by: 937152 on May 29, 2012 11:56 AM

    Why do you have all the NULLs in your sdo_elem_info_array and sdo_ordinate_array? This is very very wrong - see http://docs.oracle.com/cd/E11882_01/server.112/e17766/e12700.htm#sthref3897
    Despite that I am able to get all the "vertices" back from your sample geometry - note that I changed your SELECT statement a little.
    jot_test@JOHNOT> create table assessment_parcel_merged (
      2  id number,
      3  geometry sdo_geometry);
    Table created.
    jot_test@JOHNOT>
    jot_test@JOHNOT> insert into assessment_parcel_merged
      2  (id, geometry)
      3  values
      4  (506833,
      5  mdsys.sdo_geometry(2007,82232,null,
      6  mdsys.sdo_elem_info_array(1,1003,1,13,1003,1,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null),
      7  mdsys.sdo_ordinate_array(632941.3695,5536245.0144,632939.95209944,5536241.97593627,633251.020958124,5536096.38289373,633369.443364573,5536040.95632826,633371.0274,5536043.9168,632941.3695,5536245.0144,631892.0616,5536736.1337,631892.8842984,5536702.62493823,632873.47478553,5536243.66593412,632884.740084103,5536267.81696815,632886.1576,5536270.8559,631892.0616,5536736.1337,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null)));
    1 row created.
    jot_test@JOHNOT>
    jot_test@JOHNOT> select sdo_geom.validate_geometry_with_context(geometry, 0.0005) as geom_validate
      2  from assessment_parcel_merged;
    GEOM_VALIDATE
    13033
    1 row selected.
    jot_test@JOHNOT>
    jot_test@JOHNOT> set null null
    jot_test@JOHNOT> select o.x, o.y
      2  from assessment_parcel_merged a, table(sdo_util.getvertices(a.geometry)) o
      3  where a.id = 506833;
             X          Y
    632941.37 5536245.01
    632939.952 5536241.98
    633251.021 5536096.38
    633369.443 5536040.96
    633371.027 5536043.92
    632941.37 5536245.01
    631892.062 5536736.13
    631892.884 5536702.62
    632873.475 5536243.67
    632884.74 5536267.82
    632886.158 5536270.86
    631892.062 5536736.13
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    null       null
    50 rows selected.John

  • 2 apple ID's to 1.   With so many people having the same issue of 2 legitimate accounts by accident or whatever, why would Apple not let us merge them into one?  It would  simplify our lives and I don't see why Apple won't allow this.

    2 accounts to 1. I was so anxious to set up my new iPad at the store that I accidentally set up a new Account.  With so many people requesting to merge 2 legitimate accounts that they own, I can't understand why Apple is refusng to allow us to do so!  This would simplify our lives so much.  I have just switched over to Apple products and if I could at least set up both accounts on my iPad it would help -without signing in and out.  I could do this on my android.

    http://www.apple.com/feedback

  • I have two Apple ID Accounts. How can I combine them so I can simplify updates and purchases?

    I have two Apple ID's (accounts). How can I combine these accounts into one so I can simplify updates and purchases?

    Sorry, but Apple IDs/iTunes Store accounts cannot be merged.
    Regards.

  • [b]Tutorial:[/b] Simplify Developing OLE Automation Code Using VBA

    INTRODUCTION
    Automating Office applications from Oracle Forms can be a tedious, frustrating, and time-consuming process. Because the OLE2 and CLIENT_OLE2 built-ins do not validate the automation commands that they relay, code that compiles without errors often dies at runtime with a not-so-helpful error code. This tutorial will demonstrate how to simplify the development of automation code using a tool that ships with all Microsoft Office editions -- the Visual Basic for Applications (VBA) IDE.
    The VBA IDE, a core Office component, is a full-fledged development environment featuring code completion, basic syntax highlighting, context-driven help and a runtime debugger. Its Object Browser provides a convenient means of browsing the Word object model, as well as searching by keyword.
    For those who may not interested in following this tutorial in detail, I would like to stress the usefulness of the Object Browser as a tool for inspecting the functions supported by OLE server applications and, perhaps more importantly, valid values for function arguments. Whether/not anyone buys the assertion that starting with VBA prototypes is far more productive than pounding out OLE2 code from the very start, they will find the Object Browser invaluable as a reference -- I rely on it exclusively for this sort of documentation.
    A BRIEF INTRODUCTION TO THE VBA IDE & THE OBJECT BROWSER UTILITY
    Try this:
    1. Open Word
    2. Launch the VBA IDE by pressing <Alt><F11>
    3. Open the Object Browser by pressing <F2>
    The Object Browser allows you to visually navigate Word's class hierarchy. Its user interface is a bit crowded, so controls are unlabeled. Hovering the mouse cursor above a control will display a tooltip explaining that control's purpose. The browser's scope can be narrowed by using the Project/Library combo. Typing a keyword or substring in the Search Text combo and clicking on the Search button will cause all classes/members whose name contains the specified search text to be listed in the Search Results pane. Selecting an item from this list will update the two panes below it, showing the selected class, and its members. Beneath the Classes and Members panes is an untitled pane, gray in color, which displays details for the selected class/member, including hyperlinks to relevant information such as arguments, their types and allowable values. If Visual Basic Help is installed, pressing <F1> will display help on a selected class/member. (This feature can be installed from your Office install CD, if necessary.)
    NOTE: While it is possible to cut-and-paste the code examples that follow, I highly recommend that they be typed in by hand. Doing so will provide a better understanding of how the IDE's code completion behaves. Use code completion most efficiently by not using the mouse or <Enter> key when selecting from completion lists. Instead, just type enough letters to select the desired list element, then continue along as if you had typed the entire element, typing the next operator in your statement. It really is slick!
    HELLO WORLD - VBA-STYLE
    1. Open Word
    2. Launch the VBA IDE by pressing <Alt><F11>
    3. Select Module from the Insert menu.
    4. In the blank area that appears, enter the following code:
      Public Sub HelloWorld()
          Documents.Add
          Selection.TypeText ("Hello, world!")
      End Sub5. Press <F5> to run the code.
    If you switch back to Word by pressing <Alt><F11>, there should appear a newly-created document containing the text Hello, world!.
    A MORE AMBITIOUS EXAMPLE
    In this example, we will launch Word, type some text, and alter its formatting. For the purposes of this tutorial, consider it the process we wish to automate from within Forms.
    1. If Word is running, close it.
    2. Open any Office application except Word, such as Excel, Outlook or PowerPoint
    3. Launch the VBA IDE by pressing <Alt><F11>.
    4. Select References from the Tools menu -- a dialog should pop up.
    5. From within this dialog, locate and select Microsoft Word <version> Object Library, then click OK.
    6. Select Module from the Insert menu.
    7. In the blank area that appears, enter the following code:
    Public Sub LaunchWord()
        Dim app As Word.Application
        Set app = CreateObject("Word.Application")
        app.Visible = True                          '!!! IMPORTANT !!!
        app.Documents.Add
        With app.Selection
            .TypeText "This is paragraph 1."
            .TypeParagraph
            .TypeText "This is paragraph 2."
            .TypeParagraph
            .TypeText "This is paragraph 3."
        End With
        With ActiveDocument
            .Paragraphs(1).Range.Words(3).Bold = True
            .Paragraphs(2).Range.Words(3).Italic = True
            .Paragraphs(3).Range.Words(3).Underline = True
        End With
    End Sub8. Press <F5> to run the code.
    A new Word session should have been launched. Switch to it, to view the results of our handiwork!
    TAILORING VBA CODE INTENDED FOR OLE2 CONVERSION
    Now, things get a bit uglier. The code listed above gives a good idea of how concise VBA code can be, but With blocks and chained object references do not translate readily into OLE2 code. Here's the same process, rewritten in a more OLE2-friendly style. Note the numerous intermediate object references that have been declared.
    Public Sub LaunchWord()
        Dim app As Word.Application
        Dim doc As Word.Document
        Dim docs As Word.Documents
        Dim pars As Word.Paragraphs
        Dim par As Word.Paragraph
        Dim wrds As Word.Words
        Dim sel As Word.Selection
        Dim rng As Word.Range
        Set app = CreateObject("Word.Application")
        app.Visible = True                          '!!! IMPORTANT !!!
        Set doc = app.Documents.Add
        Set sel = app.Selection
        sel.TypeText "This is paragraph 1."
        sel.TypeParagraph
        sel.TypeText "This is paragraph 2."
        sel.TypeParagraph
        sel.TypeText "This is paragraph 3."
        Set pars = doc.Paragraphs
        'select third word of first paragraph and make it bold
        Set par = pars.Item(1)
        Set rng = par.Range
        Set wrds = rng.Words
        Set rng = wrds.Item(3)
        rng.Bold = True
        'select third word of second paragraph and italicize it
        Set par = pars.Item(2)
        Set rng = par.Range
        Set wrds = rng.Words
        Set rng = wrds.Item(3)
        rng.Italic = True
        'select third word of second paragraph and underline it
        Set par = pars.Item(3)
        Set rng = par.Range
        Set wrds = rng.Words
        Set rng = wrds.Item(3)
        rng.Underline = True
    End Sub
    TRANSFORMATION: CONVERTING VBA CODE INTO PL/SQL
    Here is the PL/SQL counterpart to our previous VBA routine. Compare printouts of the two and note their similarities. Notice the need for argument lists -- this causes the code to fluff up quite a bit, and really interferes with readability.
    PROCEDURE LAUNCH_WORD IS
      v_app OLE2.OBJ_TYPE;     -- Application
      v_doc OLE2.OBJ_TYPE;     -- Document
      v_docs OLE2.OBJ_TYPE;    -- Documents collection
      v_pars OLE2.OBJ_TYPE;    -- Paragraphs collection
      v_par OLE2.OBJ_TYPE;     -- Paragraph
      v_wrds OLE2.OBJ_TYPE;    -- Words collection
      v_sel OLE2.OBJ_TYPE;     -- Selection
      v_rng OLE2.OBJ_TYPE;     -- Range
      v_args OLE2.LIST_TYPE;   -- OLE2 argument list
    BEGIN
      /* launch Word and MAKE IT VISIBLE!!! */ 
        v_app := OLE2.CREATE_OBJ('Word.Application');
        OLE2.SET_PROPERTY(v_app, 'Visible', TRUE);
      /* initialize key object references */ 
        v_docs := OLE2.GET_OBJ_PROPERTY(v_app, 'Documents');
        v_doc := OLE2.INVOKE_OBJ(v_docs, 'Add');
        v_sel := OLE2.GET_OBJ_PROPERTY(v_app, 'Selection');
      /* type first paragraph */
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 'This is paragraph 1.');
        OLE2.INVOKE(v_sel, 'TypeText', v_args);
        OLE2.DESTROY_ARGLIST(v_args);
        OLE2.INVOKE(v_sel, 'TypeParagraph');
      /* type second paragraph */
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 'This is paragraph 2.');
        OLE2.INVOKE(v_sel, 'TypeText', v_args);
        OLE2.DESTROY_ARGLIST(v_args);
        OLE2.INVOKE(v_sel, 'TypeParagraph');
      /* type third paragraph */
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 'This is paragraph 3.');
        OLE2.INVOKE(v_sel, 'TypeText', v_args);
        OLE2.DESTROY_ARGLIST(v_args);
      /* set reference to Paragraphs collection */
        v_pars := OLE2.GET_OBJ_PROPERTY(v_doc, 'Paragraphs');
      /* select third word of first paragraph and make it bold */
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 1);
        v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
        OLE2.DESTROY_ARGLIST(v_args);
        v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
        v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 3);
        v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
        OLE2.SET_PROPERTY(v_rng, 'Bold', TRUE);
      /* select third word of second paragraph and italicize it */
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 2);
        v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
        OLE2.DESTROY_ARGLIST(v_args);
        v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
        v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 3);
        v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
        OLE2.SET_PROPERTY(v_rng, 'Italic', TRUE);
      /* select third word of second paragraph and underline it */
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 3);
        v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
        OLE2.DESTROY_ARGLIST(v_args);
        v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
        v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, 3);
        v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
        OLE2.SET_PROPERTY(v_rng, 'Underline', TRUE);
    END;
    REFACTORING FOR REUSABILITY AND READABILITY
    While the previous procedure runs without errors, it suffers from poor readability which, in turn, makes it difficult to maintain. Here, we address those issues by moving repetetive low-level operations into separate procedures.
      PROCEDURE LAUNCH_WORD IS
        v_app OLE2.OBJ_TYPE;    -- Application
        v_doc OLE2.OBJ_TYPE;    -- Document
        v_docs OLE2.OBJ_TYPE;   -- Documents collection
        v_sel OLE2.OBJ_TYPE;    -- Selection
        v_args OLE2.LIST_TYPE;  -- OLE2 argument list
      BEGIN
        /* launch Word and MAKE IT VISIBLE!!! */ 
          v_app := OLE2.CREATE_OBJ('Word.Application');
          OLE2.SET_PROPERTY(v_app, 'Visible', TRUE);
        /* create a new Word document */ 
          v_docs := OLE2.GET_OBJ_PROPERTY(v_app, 'Documents');
          v_doc := OLE2.INVOKE_OBJ(v_docs, 'Add');
          v_sel := OLE2.GET_OBJ_PROPERTY(v_app, 'Selection');
        /* add a few paragraphs */
          PRINT_PARAGRAPH(v_sel, 'This is paragraph 1.');
          PRINT_PARAGRAPH(v_sel, 'This is paragraph 2.');
          PRINT_PARAGRAPH(v_sel, 'This is paragraph 3.');
        /* apply formatting */
          APPLY_FORMATTING(v_doc, 1, 3, 'Bold', TRUE);
          APPLY_FORMATTING(v_doc, 2, 3, 'Italic', TRUE);
          APPLY_FORMATTING(v_doc, 3, 3, 'Underline', TRUE);
      END;
      PROCEDURE APPLY_FORMATTING(
        v_doc OLE2.OBJ_TYPE,
        v_paragraph_num NUMBER,
        v_word_num NUMBER,
        v_attribute VARCHAR2,
        v_value BOOLEAN) IS
        v_pars OLE2.OBJ_TYPE;   -- Paragraphs collection
        v_par OLE2.OBJ_TYPE;    -- Paragraph
        v_wrds OLE2.OBJ_TYPE;   -- Words collection
        v_rng OLE2.OBJ_TYPE;    -- Range
        v_args OLE2.LIST_TYPE;  -- OLE2 argument list
      BEGIN
        /* set reference to Paragraphs collection */
          v_pars := OLE2.GET_OBJ_PROPERTY(v_doc, 'Paragraphs');
        /* get specified paragraph */   
          v_args := OLE2.CREATE_ARGLIST;
          OLE2.ADD_ARG(v_args, v_paragraph_num);
          v_par := OLE2.INVOKE_OBJ(v_pars, 'Item', v_args);
          OLE2.DESTROY_ARGLIST(v_args);
        /* get words for specified paragraph */
          v_rng := OLE2.GET_OBJ_PROPERTY(v_par, 'Range');
          v_wrds := OLE2.GET_OBJ_PROPERTY(v_rng, 'Words');
        /* apply formatting to word found at specified index */
          v_args := OLE2.CREATE_ARGLIST;
          OLE2.ADD_ARG(v_args, v_word_num);
          v_rng := OLE2.INVOKE_OBJ(v_wrds, 'Item', v_args);
          OLE2.SET_PROPERTY(v_rng, v_attribute, v_value);
      END;
      PROCEDURE PRINT_PARAGRAPH(v_sel OLE2.OBJ_TYPE, v_text VARCHAR2) IS
        v_args OLE2.LIST_TYPE;
      BEGIN
        v_args := OLE2.CREATE_ARGLIST;
        OLE2.ADD_ARG(v_args, v_text);
        OLE2.INVOKE(v_sel, 'TypeText', v_args);
        OLE2.DESTROY_ARGLIST(v_args);
        OLE2.INVOKE(v_sel, 'TypeParagraph');
      END;
    CONCLUSION
    It is my hope that this tutorial, despite it's introductory nature, has demonstrated the value of the VBA IDE, the ease with which automation processes can be prototyped using VBA, the noticeable similarity between VBA automation routines and their Forms PL/SQL counterparts, and the advantages of testing automation processes within the VBA IDE. Please feel free to follow up with any specific questions or concerns you may have.
    Thanks,
    Eric Adamson
    Lansing, Michigan
    FINAL NOTE: These examples use the OLE2 built-in, and will operate correctly when called from forms running in the Form Builder OC4J. Deploying them to an Oracle Application Server will launch Word on the server itself (if available), which is usually not the developer's intent! Automating Word client-side via web forms requires adding WebUtil support. Adapting the code for WebUtil is trivial -- just replace all instances of OLE2 with CLIENT_OLE2. Adapting forms for WebUtil and configuring OLE support into your Oracle Application Server, however, are beyond the scope of this tutorial.
    REVISION HISTORY
    This promises to be something of a 'living document'. I've snuck changes through without comment in the past, but in the future, I'll try to document significant changes here.
    2006-08-21
      * Prefaced boring subject line with text: 'Tutorial:' to clarify purpose
      * Added emphasis on value of Object Browser as a reference

    Thanks James, for your kind words. I do hope this information will help folks out. I honestly believe that tinkering around in the VBA IDE will prove highly gratifying for automation developers. It can be assured that learning to make Word jump through hoops is much more straight-forward in this environment. I'm not one for mottos, but if I were pressed for a cheesy motto, I would say: First, make it work. Then, make it work in Oracle!
    Once the idea has sunk in, that Visual Basic routines for automating Word are exact analogs to their OLE2 counterparts, we can remove keywords like Oracle and PL/SQL from our Google searches on Word automation which, at least in this context, are the proverbial kiss of death. Suddenly we find ourselves liberated by the possibility of steal-, ahem... borrowing ideas from the Visual Basic* community!
    As for links, my link of choice is invariably http://groups.google.com -- if you don't already use it at least ten times a day, you must try it. This is the venerable USENET archive, including the holdings of now-extinct DejaNews. Another possible site of interest is http://word.mvps.org/FAQs/MacrosVBA, which may serve as a good starting point for those who wish to learn how to do fancy tricks with Word using VBA.
    If these links don't prove immediately helpful, please feel free to give specifics on the sort of operations you are interested in automating, and I'll see if I can post an example that addresses it.
    Regards,
    Eric Adamson
    Lansing, Michigan
    PS: I do hope, as people read my posts, with every other acronym being VBA, that they are not mistakenly hearing a call to learn Visual Basic. I say this, not because I believe learning VB would be a Bad Thing, but because I assume that few of us feel we have the time to learn a new programming language. Despite having come to the Oracle camp already knowing VB/VBA, and having acquired a fair bit of experience with automating Office applications as an Access developer, I remain confident that what I am suggesting people attempt does not rise to the level of learning a language. What I am suggesting is that they learn enough of the language to get by.
    *VB vs. VBA
    Just a quick word on this, as readers may wonder why I seem to use these terms interchangeably. Visual Basic (VB) can refer to either a development platform or a programming language. Visual Basic for Applications (VBA) is a language -- more precisely, it is a subset of the Visual Basic language. One purchases VB, usually quite intentionally. VBA is included with Microsoft Office, as is VBA's development environment, the VBA IDE. The key distinction between VB and VBA is that VBA cannot be used to create self-contained executables. Rather, VBA relies on VBA-enabled applications, such as Microsoft Office applications, to serve as a container for VBA code, and to provide a runtime environment for that code. For the purposes of discussing OLE Automation, VB and VBA are quite interchangeable.

  • Trying to get multiple cell values within a geometry

    I am provided with 3 tables:
    1 - The GeoRaster
    2 - The geoRasterData table
    3 - A VAT table who's PK is the cell value from the above tables
    Currently the user can select a point in our application and by using the getCellValue we get the cell value which is the PK on the 3rd table and this gives us the details to return to the user.
    We now want to give the worst scenario within a given geometry or distance. So if I get back all the cell values within a given geometry/distance I can then call my other functions against the 3rd table to get the worst scores.
    I had a conversation open for this before where JeffreyXie had some brilliant input, but it got archived while I was waiting on Oracle to resolve a bug (about 7 months)
    See:
    Trying to get multiple cell values within a geometry
    If I am looking to get a list of cell values that interact with my geometry/distance and then loop through them, is there a better way?
    BTW, if anybody wants to play with this functionality, it only seems to work in 11.2.0.4.
    Below is the code I was using last, I think it is trying to get the cell values but the numbers coming back are not correct, I think I am converting the binary to integer wrong.
    Any ideas?
    CREATE OR REPLACE FUNCTION GEOSUK.getCellValuesInGeom_FNC RETURN VARCHAR2 AS
    gr sdo_georaster;
    lb blob;
    win1 sdo_geometry;
    win2 sdo_number_array;
    status VARCHAR2(1000) := NULL;
    CDP varchar2(80);
    FLT number := 0;
    cdl number;
    vals varchar2(32000) := null;
    VAL number;
    amt0 integer;
    amt integer;
    off integer;
    len integer;
    buf raw(32767);
    MAXV number := null;
    r1 raw(1);
    r2 raw(2);
    r4 raw(200);
    r8 raw(8);
    MATCH varchar2(10) := '';
    ROW_COUNT integer := 0;
    COL_COUNT integer := 0;
    ROW_CUR integer := 0;
    COL_CUR integer := 0;
    CUR_XOFFSET integer := 0;
    CUR_YOFFSET integer := 0;
    ORIGINY integer := 0;
    ORIGINX integer := 0;
    XOFF number(38,0) := 0;
    YOFF number(38,0) := 0;
    BEGIN
    status := '1';
    SELECT a.georaster INTO gr FROM JBA_MEGARASTER_1012 a WHERE id=1;
    -- first figure out the celldepth from the metadata
    cdp := gr.metadata.extract('/georasterMetadata/rasterInfo/cellDepth/text()',
    'xmlns=http://xmlns.oracle.com/spatial/georaster').getStringVal();
    if cdp = '32BIT_REAL' then
    flt := 1;
    end if;
    cdl := sdo_geor.getCellDepth(gr);
    if cdl < 8 then
    -- if celldepth<8bit, get the cell values as 8bit integers
    cdl := 8;
    end if;
    dbms_lob.createTemporary(lb, TRUE);
    status := '2';
    -- querying/clipping polygon
    win1 := SDO_GEOM.SDO_BUFFER(SDO_GEOMETRY(2001,27700,MDSYS.SDO_POINT_TYPE(473517,173650.3, NULL),NULL,NULL), 10, .005);
    status := '1.2';
    sdo_geor.getRasterSubset(gr, 0, win1, '1',
    lb, win2, NULL, NULL, 'TRUE');
    -- Then work on the resulting subset stored in lb.
    status := '2.3';
    DBMS_OUTPUT.PUT_LINE ( 'cdl: '||cdl );
    len := dbms_lob.getlength(lb);
    cdl := cdl / 8;
    -- make sure to read all the bytes of a cell value at one run
    amt := floor(32767 / cdl) * cdl;
    amt0 := amt;
    status := '3';
    ROW_COUNT := (WIN2(3) - WIN2(1))+1;
    COL_COUNT := (WIN2(4) - WIN2(2))+1;
    --NEED TO FETCH FROM RASTER
    ORIGINY := 979405;
    ORIGINX := 91685;
    --CALCUALATE BLOB AREA
    YOFF := ORIGINY - (WIN2(1) * 5); --177005;
    XOFF := ORIGINX + (WIN2(2) * 5); --530505;
    status := '4';
    --LOOP CELLS
    off := 1;
    WHILE off <= LEN LOOP
    dbms_lob.read(lb, amt, off, buf);
    for I in 1..AMT/CDL LOOP
    if cdl = 1 then
    r1 := utl_raw.substr(buf, (i-1)*cdl+1, cdl);
    VAL := UTL_RAW.CAST_TO_BINARY_INTEGER(R1);
    elsif cdl = 2 then
    r2 := utl_raw.substr(buf, (i-1)*cdl+1, cdl);
    val := utl_raw.cast_to_binary_integer(r2);
    ELSIF CDL = 4 then
    IF (((i-1)*cdl+1) + cdl) > len THEN
    r4 := utl_raw.substr(buf, (i-1)*cdl+1, (len - ((i-1)*cdl+1)));
    ELSE
    r4 := utl_raw.substr(buf, (i-1)*cdl+1, cdl+1);
    END IF;
    if flt = 0 then
    val := utl_raw.cast_to_binary_integer(r4);
    else
    val := utl_raw.cast_to_binary_float(r4);
    end if;
    elsif cdl = 8 then
    r8 := utl_raw.substr(buf, (i-1)*cdl+1, cdl);
    val := utl_raw.cast_to_binary_double(r8);
    end if;
    if MAXV is null or MAXV < VAL then
    MAXV := VAL;
    end if;
    IF i = 1 THEN
    VALS := VALS || VAL;
    ELSE
    VALS := VALS ||'|'|| VAL;
    END IF;
    end loop;
    off := off+amt;
    amt := amt0;
    end loop;
    dbms_lob.freeTemporary(lb);
    status := '5';
    RETURN VALS;
    EXCEPTION
        WHEN OTHERS THEN
            RAISE_APPLICATION_ERROR(-20001, 'GENERAL ERROR IN MY PROC, Status: '||status||', SQL ERROR: '||SQLERRM);
    END;

    Hey guys,
    Zzhang,
    That's a good spot and as it happens I spotted that and that is why I am sure I am querying that lob wrong. I always get the a logic going past the total length of the lob.
    I think I am ok using 11.2.0.4, if I can get this working it is really important to us, so saying to roll up to 11.2.0.4 for this would be no problem.
    The error in 11.2.0.3 was an internal error: [kghstack_underflow_internal_3].
    Something that I think I need to find out more about, but am struggling to get more information on is, I am assuming that the lob that is returned is all cell values or at lest an array of 4 byte (32 bit) chunks, although, I don't know this.
    Is that a correct assumption or is there more to it?
    Have either of you seen any documentation on how to query this lob?
    Thanks

  • How can I get Firefox 3.6 to startup and load at a particular screen position - using cmd-line or other, in a Solaris SPARC/UNIX env? The xterm program uses the -geometry args as a manner of specifying position on the screen.

    I am running Firefox 3.6 - on Solaris 10 SPARC env.
    I am using the X11 - TWM(X-windows Manager). I have tried to alter the .twmrc files for the WM, but I need firefox to declare the position in the client program, else the TWM will force me to place it every time. When I use the xterm with the "-geometry" I can specify the position the xterm is opened and positioned there automatically. I have tried using the Xresource configuration settings(maybe I am doing something wrong here), but the X-server ignores it... so I believe that only firefox app can manage the positioning?
    I am out of ideas, I suppose the next step is to question the source... Any ideas of how I can achieve this auto positioning in TWM. (I have been looking into X-events to manage the placement, but this is messy)

    The version of Apache that comes default with Solaris might not be compiled for that I am not positive though. I downloaded and compiled Apach 2 and compiled mod_ssl and got it working with no problems you might want to try that.

  • How to create geofence at the start of a geometry segment?

    I want to create a geofence at the start (and end) of each of our road sections.
    The geofence would extend exactly x(specified) metres at right angles to the segment direction at the start point.
    Is there any Oracle functionality to construct a line (or 2 points) at right angles to a point on a line?
    I can find the start point using this construction
    SELECT SDO_LRS.GEOM_SEGMENT_START_PT(geom)
    FROM ROAD_CENTRELINE_SDO WHERE id = 82;
    The only way I have found of creating the geometry is by using some trigonometry to calculate the angle subtended and create two equidistant points. This is rather clumsy and I wondered if anyone knew how to do this more efficiently using Oracle Spatial functionality.
    Philip

    Phil,
    I can understand that you found the packages complex. There is quite a bit of work gone into them over the years. Once you are over the install, and grow in your understanding of Spatial, you might find one or two of the functions quite useful. I am working on documentation... not enough hours in the day!
    Wrt you immediate question.
    Assuming that these two queries return the points you need:
    SELECT SDO_LRS.LOCATE_PT(a.geom, 0, -7) FROM ROAD_CENTRELINE_SDO a
    SELECT SDO_LRS.LOCATE_PT(a.geom, 0, 7) FROM ROAD_CENTRELINE_SDO a
    Then, because these functions return a point in the sdo_ordinate_array and not in SDO_POINT, you should be able to construct a line as follows:
    SELECT sdo_geometry(2002,l.SRID,NULL,sdo_elem_info_array(1,2,1),
           sdo_ordinate_array(l.column_value.x,l.column_value.y,
                              r.column_value.x,r.column_value.y))
      FROM ( SELECT a.ID, a.geom.sdo_srid as srid, b.*
               FROM ROAD_CENTRELINE_SDO a,
                    TABLE( SDO_UTIL.GET_VERTICES( SDO_LRS.LOCATE_PT(a.geom,0,-7) ) )
           ) l,
           ( SELECT c.ID, c.geom.sdo_srid as srid, d.*
               FROM ROAD_CENTRELINE_SDO c,
                    TABLE( SDO_UTIL.GET_VERTICES( SDO_LRS.LOCATE_PT(c.geom,0, 7) ) )
           ) r
    WHERE r.id = l.id;I have not tested this as I do not have an operational LRS in place but it should work. Of course, if the SDO_LRS.LOCATE_PT returned the data in an sdo_point structure all this complexity could be avoided. But this approach does not require the construction of a function that returns an sdo_point from an sdo_geometry with a point coded in sdo_ordinate_array (which would be result in nicer SQL). If you coded a function that did this:
      create or replace Function ToSdoPoint( p_geometry IN MDSYS.SDO_GEOMETRY )
        RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC
        IS
         v_element         number;
         v_elements        number;
         v_geometry        MDSYS.SDO_Geometry;
         v_SdoPoint        MDSYS.SDO_Point_Type := MDSYS.SDO_Point_Type(0,0,NULL);
         v_Ordinates       MDSYS.SDO_Ordinate_Array;
      Begin
        IF ( MOD(p_geometry.sdo_gtype,10) not in (1,5) ) Then
          v_geometry := NULL;
        ELSIF p_geometry.sdo_point is not null THEN
          v_geometry := mdsys.sdo_geometry(p_geometry.sdo_gtype,p_geometry.sdo_srid,p_geometry.sdo_point,NULL,NULL);
        ELSE
          v_ordinates  := p_geometry.sdo_ordinates;
          v_SdoPoint.X := v_ordinates(1);
          v_SdoPoint.Y := v_ordinates(2);
          IF ( FLOOR(p_geometry.sdo_gtype/1000) = 3 ) THEN
            v_SdoPoint.Z := v_ordinates(3);
          END IF;
          v_geometry := mdsys.sdo_geometry(p_geometry.sdo_gtype,p_geometry.sdo_srid,v_SdoPoint,NULL,NULL);
        END IF;
        RETURN v_geometry;
      END ToSdoPoint;
    show errors
    select toSdoPoint(mdsys.sdo_geometry(2001,null,null,
                       sdo_elem_info_array(1,2,1),sdo_ordinate_array(1,2)))
      from dual;Then the SQL becomes:
    SELECT sdo_geometry(2002,SRID,NULL,sdo_elem_info(1,2,1),
           sdo_ordinate_array(left.x,left.y, right.x,right.y)) as geom
      FROM ( SELECT a.geom.sdo_srid as srid,
                   ToSdoPoint(SDO_LRS.LOCATE_PT(a.geom, 0, -7)) as left,
                   ToSdoPoint(SDO_LRS.LOCATE_PT(a.geom, 0,  7)) as right
               FROM ROAD_CENTRELINE_SDO a )Hope this helps.
    regards
    Simon

Maybe you are looking for