SDO_LRS. OFFSET_GEOM_SEGMENT
Hello people,
EE Oracle 11 GR 2 w / space
So I have this geometry that I work on. I use it as an intersection of basic and I want to be able to compensate for pretty much any direction. Image (a screenshot of geoRaptor) is less to:
As you can see there are the nodes and links representing an intersection of a road typing. The arrows indicate the direction of flow and nodes (pink doughnuts) indicate the points on which to join the other links. These links are defined as the linestrings and knots as 2D points. It's pretty simple forward I think.
So I used offset_geom_segment, making the conversion required for LRS and return. It all works very well. Can I return a new geometry left or right course following the direction (according to the order of the points). So my question is this:
Am I missing something or is there a LRS or the plain SDO to select a point in the linestring and point geometry of the node, or a center of gravity to shift to a new full point and have the lats and long adjusted in a similar way, as does the offset_geom_segment? I understand the concept of projection from a point to an azimuth and inclination to establish a new reference point is simple. So I am being dense or you are looking for simply not enough deep? I can't seem to find one was to "spend" geometry and summits have updated by the call. I have to manually take each point, a new point of her project then adjust? You are looking for a simple way to do it.
FlyingGuy,
I don't know if I followed your condition exactly, but assuming that you are looking for a way to move a whole geometry, then it would be worth looking at SDO_UTIL. AFFINETRANSFORMS().
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e11830/sdo_util.htm#SPATL1220
Its a complete pig to use, then I would say looking wrapper of Simon:
http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/296/affine-wrappers-for-sdo_utilaffine
John
Tags: Database
Similar Questions
-
points using SDO_LRS. LOCATE_PT
Hello
I spatial table of routes (Highway) in UTM coordinates and linear units are in meters. When I use the function SDO_LRS. LOCATE_PT, he's back the geometry in decimal degrees.
SQL > select sdo_lrd.locate_pt (a.geometry, 50, 0) of the highway where feature_id = 12345;
I also tried to convert those decimal degrees to UTM, however, points located after conversion are not top of the road (route) spatial features that are originally in UTM.
Thanks in advance for the help...Hello without a username 908275,
You will probably have to provide more information that I don't know what you mean. I've never seen LOCATE_PT return anything other than the coordinate system of the input geometry. Could you post all or part of the service entered 12345 and, possibly, the geometry of the point you receive service?
See you soon,.
Paul
-
SDO_LRS. LRS_INTERSECTION returns ORA-13331: invalid LRS segment
I was experimenting with the LRS_INTERSECTION function by running
Select SDO_LRS. () LRS_INTERSECTION
sdo_geometry (3302, 8307, null, sdo_elem_info_array (1,2,1), sdo_ordinate_array (- 79, 37, 38, null, 0, - 80 - 79, 39, null,-80, 48, 100));
sdo_geometry (3302, 8307, null, sdo_elem_info_array (1,2,1), sdo_ordinate_array (- 79, 39, 40, null, 0, - 80 - 80, 38, null,-79, 37, 100));
20
)
of the double
I get the following error:
ORA-13331: invalid LRS segment
ORA-06512: at the 'MDSYS. SDO_LRS", line 8496
13331 00000 - 'invalid LRS segment.
Somehow, I don't see what is not valid on either LRS geometries that I spent in the function. Curiously, if I change the last coordinate of the latitude of the first argument of geometry from 48 'to 40', I get no error. The problem is that I really want to calculate the intersection of geometry exactly as shown above. Does anyone have any ideas why SDO_LRS. LRS_INTERSECTION considers either the geometry of the values of parameter not valid?Hello lowlyscrub,
You have discovered a 'feature' of LRS_INTERSECTION which is kind of a bummer in my opinion. The LRS specifying allows only valid geometries LRS consists of a single string, a multiple string, or a point. If happen you by the whims of your intersection receive in return a different set of geometries, then the LRS result is invalid and you get this error message. To see what I mean, the simplest method is to run your query, even using the good old SDO_INTERSECTION instead.
Your intersection returns a collection of a linestring and point. Thus, this collection is not valid LRS and thus the error. Oracle Spatial people have said that this is normal. I think I asked that they better document this "feature" just now. LRS_INTERSECTION is a relatively new feature that came to 10.2.0.3 I think. Its main selling point was that it preserves the line intersected strings management. Before that, I used a wrapper utility SDO_INTERSECTION which then tested the results later and everything fixed at the back of the line channels and removed all the stray points. LRS_INTERSECTION is faster than my former utility. So what I'm doing now is I have a wrapper that submits entries to LRS_INTERSECTION, intercepts all 13331 errors and if he catches that he then submits the same entries in the old utility.
I have indeed encourage you to put in a few comments through Oracle support on the issue. It would be nice to have a switch on LRS_INTERSECTION which could in turn allow these geometries LRS 'bad' for the correction by the user or that the utility itself remove these stray points.
See you soon,.
Paul
-
Hi people,
I was wondering if anyone knows the fix for this problem. The query below is quite simple with a linestring LRS having three measures from 100 to 0 and an analysis of the points located very close to the 0 measure. By operating on 10.2.0.4 (tested on 64-bit Linux and AIX) the measure is expressed in - 0.0000491998690250739. But when run on 11.1.0.7, the measure returns as a reasonable 0.0000983997069425868. As the negative result is not valid for this linestring, it causes errors in my processing steps. Has anyone seen this or know a work-around (next to moving to 11 g)?
Thank you
Paul
SELECT SDO_LRS. () FIND_MEASURE
SDO_GEOMETRY (3302,
8265,
NULL,
SDO_ELEM_INFO_ARRAY (1, 2, 1),
SDO_ORDINATE_ARRAY (-159.71918261,
22.15100988,
100,
-159.71935494,
22.1508723,
78.3676425201574,
-159.72016781,
22.15075725,
(0)),
SDO_GEOMETRY (2001,
8265,
NULL,
SDO_ELEM_INFO_ARRAY (1, 1, 1)
SDO_ORDINATE_ARRAY (-159.7201678, 22.15075719)),
0.00000001
)
OF THE DOUBLEPaul,
bug # is 8491356. FOR INFO.
You can drop backport queries if necessary.
-JackPublished by: Jack Wang, may 5, 2009 13:50
-
Projecting orthogonally a linestring 2D 2D point
Hello
Anyone know if there is a way to project a point 2D to 2D linestring orthogonally and then insert this point in the linestring?
This, together with the preservation of the relative position of all points in the lisnestring (including the one being inserted).
Thanks and greetings
Ah, you're right. I had a similar case in mind where Carrefour gave correct results, be taken and union created a compound that was not desirable. It should be union in this case (did not have my second cup of coffee still ;-))):
SQL> select 'sdo_intersection' as operation, sdo_geom.sdo_intersection(sdo_geometry(2002, null, null, sdo_elem_info_array(1,2,1), sdo_ordinate_array(10,10, 20,20, 30,30)), 2 sdo_geometry(2001, null, sdo_point_type(25, 25, null), null, null), 3 0.5) 4 from dual 5 union all 6 select 'sdo_union' as operation, sdo_geom.sdo_union(sdo_geometry(2002, null, null, sdo_elem_info_array(1,2,1), sdo_ordinate_array(10,10, 20,20, 30,30)), 7 sdo_geometry(2001, null, sdo_point_type(25, 25, null), null, null), 8 0.5) 9 from dual; OPERATION ---------------- SDO_GEOM.SDO_INTERSECTION(SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(25,25,NULL),NULL -------------------------------------------------------------------------------- sdo_intersection SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY( 25, 25)) sdo_union SDO_GEOMETRY(2002, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1), SDO_ORDINATE_ARRAY( 10, 10, 20, 20, 25, 25, 30, 30)) SQL>
Sorry!
BTW, you can add all in a select statement (not very readable, but it will give you your answer at once):
select sdo_geom.sdo_union([line geometry], sdo_lrs.project_pt(sdo_lrs.convert_to_lrs_geom([line geometry]), [point geometry], [tolerance]), [tolerance]) from [tablename] where [where clauses];
Replace everything between [] by your column names, tolerances, etc.
See you soon,.
Stefan
-
Create SDO_GEOMETRY of SRID adding existing
Hello
I have a SDO_GEOMETRY without an SRID in there, and I have to call as in the following statement:
SELECT A.G3E_FID, SDO_UTIL. TO_WKTGEOMETRY (SDO_LRS. CONVERT_TO_STD_GEOM (SDO_CS.transform (a.g3e_geometry, 28992))) g3e_geometry, 28992 srid FROM las_pt;
If the g3e_geometry column has a defined SRID that works, but if it isn't I get the following error:
ORA-13029: not valid SRID in the SDO_GEOMETRY object
What would be the best way to add the SRID in order for this statement to work? It should be 200015.
BTW. This statement is executed in the context of Microsoft SQL-server and the output of g3e_geometry alias is entered for SQL-server
Geometry::STGeomFromText to create geometry of SQL-server. If there is another way to do this, I'd be happy to. @
How about you, replacing the name of the table with a subquery using NVL, something like below (not tested because of no data on sample)?
SELECT A.G3E_FID,
SDO_UTIL. TO_WKTGEOMETRY
(SDO_LRS. CONVERT_TO_STD_GEOM
(SDO_CS.transform
(a.g3e_geometry, 28992))) g3e_geometry,
SRID 28992
OF (SELECT g3e_fid, )
MDSYS. SDO_GEOMETRY
(a.g3e_geometry.sdo_gtype,
NVL (a.g3e_geometry.sdo_srid, 20015),.
a.g3e_geometry. SDO_POINT,
a.g3e_geometry.sdo_elem_info,
g3e_geometry of a.g3e_geometry.sdo_ordinates)
OF las_pt one) one
/
-
Hey Gang,
11 GR 2 all the bells and whistles
OK, so given a linestring is a road that I need to find a point on the linestring.
I have devices that are found with a 2Dpoint and I can use the sdo_nn and the sdo_nn_distance to discover what linestring is closest to.
I use the sdo_lrs_find_measure to know how far down the linestring from its origin (1st vertice) is the point of intersection.
sdo_lrs.locate_pt(Sdo_Lrs.Convert_To_Lrs_Geom(Ldata.Geom,0.0,Sdo_Geom.Sdo_Length(Ldata.Geom,0.05)),0,100) as snap_to
But it does work very well its only him point doesn't seem to follow the geometry of the line.
Any ideas?
Sorry that I did not add any geom data so here it is:
The linestring:
MDSYS.SDO_GEOMETRY(2002,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(-117.89017,34.1201,-117.89006,34.12026,-117.88996,34.12037,-117.88986,34.12044,-117.88978,34.12047,-117.88966,34.12049,-117.88883,34.12056,-117.88793,34.12062,-117.8875,34.12065,-117.88724,34.12071,-117.88694,34.12083))
The point:
MDSYS.SDO_GEOMETRY(2001,8307,MDSYS.SDO_POINT_TYPE(-117.88843,34.120764,NULL),NULL,NULL)
Actually, looking at it again:
Sdo_Lrs.Locate_Pt(Sdo_Lrs.Convert_To_Lrs_Geom(Ldata.Geom,0.0,sdo_geom.Sdo_Length(Ldata.Geom,0.05) ),0,XXX)
Looks like you're calling the second version of Locate_Pt, giving him 0 for the diminfo. I would like to change this line in
Sdo_Lrs.Locate_Pt(Sdo_Lrs.Convert_To_Lrs_Geom(Ldata.Geom,0.0,sdo_geom.Sdo_Length(Ldata.Geom,0.05) ),XXX)
And actually replace the XXX with a call to find_measure. This should do what you want, I think. If I try one (with the diminfo = 0), the point resulting is indeed completely off into nowhere.
HTH,
Stefan
-
Hey people out there...
Yes 11 GR 2, EA, linux server
So what, I have to be able to do is chop up a geometry into small segments, which equal the original geometry. So I start with something like this:
MDSYS.SDO_GEOMETRY(2002,8307,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(-117.97528,34.13969,-117.97534,34.13969,-117.97589,34.13969))
For the sake of argument that this geometry is 100 metres from the floor, it could be right or a curve. I need to divide this into metre n segments representing each geometry with reasonable fidelity. So start at 0 meters and go to 19, then 20 to 39, 40 to 59 etc. Each of them would be a linestring as is it above. I sortof found a way of brute force it by removing the geometry and preforming various functions (point of bearing and distance, etc.), but I thought he just be a better way.
Any ideas?
You can can try linear referencing as SDO_LRS methods. CLIP_GEOM_SEGMENT.
Select
SDO_LRS. () CLIP_GEOM_SEGMENT
SDO_LRS. CONVERT_TO_LRS_GEOM
(
MDSYS. SDO_GEOMETRY (2002,8307, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY(-117.97528,34.13969,-117.97534,34.13969,-117.97589,34.13969)),
0,-start the measurement value
100 - end value of the measurement
)
0.10)
Double;
Select MDSYS. SDO_GEOMETRY (2002, null, NULL, MDSYS.) SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (0,0,0,0,0,100)) twice;
Select
SDO_LRS. CONVERT_TO_LRS_GEOM
(
MDSYS. SDO_GEOMETRY (2002, null, NULL, MDSYS.) SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (0,0,0,0,0,100)),
0,-start the measurement value
100 - end value of the measurement
)
Double;
--100 pi
Select
SDO_LRS. () CLIP_GEOM_SEGMENT
SDO_LRS. CONVERT_TO_LRS_GEOM
(
MDSYS. SDO_GEOMETRY (2002, null, NULL, MDSYS.) SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (0,0,0,0,0,100)),
0,-start the measurement value
100 - end value of the measurement
)
0.10) test_clipping
Double;
-The result is 10 ft
TEST_CLIPPING (SDO_GTYPE, SDO_SRID, SDO_POINT_TYPE (X, Y, Z), ANSDO_ELEM_INFO, SDO_ORDINATES)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SDO_GEOMETRY (3302, NULL, NULL, SDO_ELEM_INFO_ARRAY (1, 2, 1) SDO_ORDINATE_ARRAY (0, 0, 0, 0, 10, 10))
Best
Frédéric
-
Divide a line into several points
I see that I can use SDO_LRS. SPLIT_GEOM_SEGMENT to divide a line into one only point (and get 2 lines resulting).
However, someone at - it an idea how can I split a line, at several points, in several segments? I need to do for the number of lines, so a function or procedure would be nice as appropriate.
Thank you
Published by: ronnie-m on April 22, 2013 04:43Sorry for pasting quick and dirty, was a minimum on time and problems with my dev env.
Perhaps still not the best outline but hoping there more explanaition should be ok.
Concerning
Luke
select l.line_id, -- line line_id ROW_NUMBER() OVER (PARTITION BY l.line_id order by l.rowid ) -- optional sub id, to make submains unique in combination with line_id (guess this will be ordered sdo_lrs.CLIP_GEOM_SEGMENT(SDO_LRS.CONVERT_TO_LRS_GEOM(l.geometry ), branch_measure, branch_next_measure, 0.05) -- actual clipping, needs convert to LRS apparently, start end end branch measure from line l, -- rejoin mainly to get the geometry again ( select line_id, -- line_id branch_measure, -- measure of the branches (from CASE WHEN LEAD(branch_measure, 1, 0) OVER (PARTITION BY line_id order by branch_measure) branch_next_measure -- Analytical function LEAD will get the next branch measure form the following ordered records per line_id from ( select a.line_id, -- line_id CASE when -- CASE (assuming branch will touch only at one point) it will be either the start or the endpoint sdo_lrs.find_offset( -- of the branch that will TOUCH, we are checking this based on the offset which one is closest SDO_LRS.CONVERT_TO_LRS_GEOM(a.geometry), -- requires convert to LRS geom sdo_lrs.geom_segment_start_pt(b.geometry), -- if it is neccessary to deal with multiple possibilities we might better use a temp table to evalute better 0.05 -- TOLERANCE (all tolereance should be seen with respect to resolution of the data ) -- IF feasible, let spatial take care of the snapping < sdo_lrs.find_offset( SDO_LRS.CONVERT_TO_LRS_GEOM(a.geometry), sdo_lrs.geom_segment_end_pt(b.geometry), 0.05 ) THEN sdo_lrs.find_measure( SDO_LRS.CONVERT_TO_LRS_GEOM(a.geometry), sdo_lrs.geom_segment_start_pt(b.geometry), 0.05 ) ELSE sdo_lrs.find_measure( SDO_LRS.CONVERT_TO_LRS_GEOM(a.geometry), sdo_lrs.geom_segment_end_pt(b.geometry), 0.05) END branch_measure from line a, line b -- self join using main and branch that touches WHERE sdo_relate(b.geometry, a.geometry, 'mask=TOUCH') = 'TRUE' -- Should be replaceable with sdo_join + self join optimsation AND a.line_type = 'main' AND b.line_type = 'branch' union all -- union all to get the 0 measure (startpoint) in the subquery as the beginning of the first clipping segment select line_id, 0 as branch_measure from line union all -- union all to get the last measure (endpoint) in the subquery as the beginning of the first clipping segment select line_id, sdo_geom.sdo_length(geometry, 0.05) as branch_measure -- maybe better to use actual get measure form lrs endpoint but is the same if no spaecial measure are used from line ) ) b where branch_measure < branch_next_measure -- avoid duplicates (2 branches at same location on main (but also the last + 1 segment with last measure and default value 0 from LEAD and l.line_id = b.line_id -- join on line-id to reuse the geom (or potential other attributes from original lines ;
-
Creation of spatial data connectivity data
Hello
I have a few spatial data, which I'll try to describe the relevant aspects:
-A LineSegment table, which contains information about cables, including the ID of the area (approximately 4 million lines)
-An array of location, that contains a LineSegmentID (one by one), and a column (space) geometry (approximately 4 million lines).
What I need to do, is to create a new table containing conceptual "nodes", containing the following columns:
-NodeID (number)
-(Number) LineSegmentID
-LineSegmentEnd (1 or 2)
So I need to prepare, for each cable, which other cable it connects, by comparing its ends with the endpoints of other cables in the same sector. A box contains cables up to 464. There are a total of 160 thousand areas.
I'm working on the most effective way to achieve this, ideally by making a batch which will take less than half an hour. Oracle is relatively new to me, but I'm guessing that the right approach would be to use a series of intermediate (intermediate) tables, as I believe nested cursors would be much too slow (I ran a simple test to confirm this).
I guess I'll have to get in a temporary table, the starting point and the end point of each cable using SDO_LRS. GEOM_SEGMENT_START_PT and SDO_LRS. GEOM_SEGMENT_END_PT, as well as the area ID. Join the table to itself, and then use SDO_GEOM. SDO_DISTANCE to work on what points are close together (for example less than one meter). However, I'm fighting to describe a step by step process.
Anyone has any ideas that can help?
(Oracle 11g)
Examples of data to illustrate the problem:
create table line_location (lineid number,
geometry sdo_geometry);
create table (ID, areaid) line;
-a cable in the box 1, 2 in area 4, etc.
insert into a values (1, 1) line;
insert into values of line (2, 4);
insert into values of line (3, 4);
insert into a values (4, 3) line;
insert into values of line (5, 3);
insert into a values (6, 3) line;
insert into values of line (7, 2);
insert into values of line (8: 2);
insert into a values (9, 2) line;
insert into values of line (10, 2);
-in reality, the lines are not necessarily straight and simple as these...
insert into line_location values (1, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (10,1,10,4))); -zone 1
insert into line_location values (2, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (3,9,5,9))); -zone 4
insert into line_location values (3, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,9,5,10))); -zone 4
insert into line_location values (4, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (1,1,2,1))); -zone 3
insert into line_location values (5, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (2,3,2,1))); -zone 3
insert into line_location values (6, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (2,3,3,3))); -zone 3
insert into line_location values (7, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,3,5,4))); -zone 2
insert into line_location values (8, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (4,4,5,4))); -zone 2
insert into line_location values (9, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,9,6,4))); -zone 2
insert into line_location values (10, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,7,5,9))); -zone 2
create table node_line (node_id number,
line_id number,
endpoint_id number,--1 for starting point, 2 for the end point.
area_id number
);
-expected here. If two lines are less than 0.5, whereas they should share a node.
insert into node_line values (1, 1, 1, 1); -insulated cable in zone 1, starting point node
insert into node_line values (2, 1, 2, 1); -insulated cable in zone 1, point endpoint node
insert into node_line values (3, 2, 1, 4); -zone 4: 2, node starting point of cable
insert into node_line values (4, 2, 2, 4); -zone 4, cable 2, point endpoint node
insert into node_line values (4, 3, 1, 4); -point 2 = cable endpoint node cable 3 start knot, etc.
insert into node_line values (5, 3, 2, 4);
insert into node_line values (6, 4, 1, 3); -node at (1,1)
insert into node_line values (7, 4, 2, 3); -node to (2.1)
insert into node_line (8, 5, 1, 3) values; -node to (2,3)
insert into node_line values (7, 5, 2, 3); -node to (2.1)
insert into node_line (8, 6, 1, 3) values; -node to (2,3)
insert into node_line values (9, 6, 2, 3); -(3.3) node
insert into node_line values (10, 7, 1, 2); -node to (5.3)
insert into node_line values (11, 7, 2, 2); -node to (5.4)
insert into node_line (12, 7, 1, 2) values; -node to (4.4)
insert into node_line values (11, 7, 2, 2); -node to (5.4)
insert into node_line (13, 7, 1, 2) values; -node to (5.9)
insert into node_line (14, 7, 2, 2) values; -node (6.4)
insert into node_line values (15, 7, 1, 2); -node to (5,7)
insert into node_line (13, 7, 2, 2) values; -node to (5.9)
Thank youHi Ronnie
Have you had a look at the script on the old NET?
This done in a slightly different result structure, what you're after.
I took the time this morning to see a bit optimized.Below you will find the result.
With clues about a couple and the use of the SDO_JOIN rather the sdo_relate this speeds up considerably.
I had tested on a 600 k line objects (which is not 4 million I know) and is reasonable ok on my test (non optimized) environment.On the "1 metre" close to each other, I would have supported itself by setting the tolerance appropriately, so
There should be no reason to perform within the distance checking. Obviously that permitting the resolution of your data.Have a look at.
Note that the final table is different in their structure, but this needs to be easily adjusted in the script if your node_line table must be exactly like you defined.
Luke
-drop the existing SEQ_TOPO
sequence of fall SEQ_TOPO;
-create sequences with caching
CREATE SEQ_TOPO CACHE 2000 SEQUENCES;
commit;
-drop temporary table
drop table temp_nodes cascade constraints;
-create temporary table and fill it with startponts and a field saying this are implemented, as X, Y, as we use it later to remove duplicates in a nonspatial way
create the table temp_nodes
as
Select a.lineid, a.areaid, sdo_geometry (2001, a.node.sdo_srid, SDO_POINT (t.X, t.Y, null), null, null) as a node, SEQ_TOPO.nextval node_id, the from ' AS STEND, t.x, t.y
Of
(select lineid, areaid, node sdo_lrs.geom_segment_start_pt (geometry) of line_location, where the LINE line_location.lineid = line.line_id), TABLE (SDO_UTIL. GETVERTICES (a.Node)) t;
commit;
-Insert the end points in the temporary table
insert into temp_nodes
Select a.lineid, a.areaid, sdo_geometry (2001, a.node.sdo_srid, SDO_POINT (t.X, t.Y, null), null, null) as a node, SEQ_TOPO.nextval node_id, 'E' AS STEND, t.x, t.y
Of
(select lineid, areaid, node sdo_lrs.geom_segment_end_pt (geometry) of line_location, where the LINE line_location.lineid = line.line_id), TABLE (SDO_UTIL. GETVERTICES (a.Node)) t;
commit;
-insert user_sdo_geom_metadata and have created for temp_nodes index
-adjust with appropriate metadata to srid, high and lowebounds values and the tolerance of your dataset
-Here the tolerance is set at 1 meter, this way there is no need to use a distance, let tolerance help us here
-Obviously this can work if tolerance is smaller, then the distance between the start and end of the link itself.
delete from user_sdo_geom_metadata where table_name = 'TEMP_NODES ';
INSERT INTO user_sdo_geom_metadata VALUES ("TEMP_NODES", "NODE", SDO_DIM_ARRAY (SDO_DIM_ELEMENT ('X', 0, 1000000, 1), SDO_DIM_ELEMENT ('Y', 0, 100000, 1)), 3785);
-create spatial indexes with gtype = POINT to use internal optimization
Drop index node_sx;
CREATE INDEX node_sx ON temp_nodes (node) INDEXTYPE IS MDSYS. SPATIAL_INDEX PARAMETERS ('sdo_indx_dims = 2, layer_gtype = POINT');
-create indexes on X, Y combination to accelerate "eliminating duplicates" (in the group by) is actually a "select unique" rather that remove duplicates
CREATE INDEX INDEX1 ON TEMP_NODES (X, Y);
CREATE the INDEX INDEX2 ON TEMP_NODES (node_id);
-create the final node table with unique nodes of the temporary table, x, to y could be omitted
create the table node_topo
as
Select a.nodeid, t.node, t.x, t.y
Of
(
Select min (node_id) as nodeid
Of
temp_nodes
Group x, Y
) an inner join
temp_nodes t
on (a.nodeid = t.node_id)
;
commit;
-insertion of metadata information
delete from user_sdo_geom_metadata where table_name = 'NODE_TOPO ';
INSERT INTO user_sdo_geom_metadata VALUES ("NODE_TOPO", "NODE", SDO_DIM_ARRAY (SDO_DIM_ELEMENT ('X', 0, 1000000, 1), SDO_DIM_ELEMENT ('Y', 0, 100000, 1)), 3785);
-create spatial indexes on the table to end node with gtype = POINT (internal optimization)
Drop index node_topo_sx;
CREATE INDEX node_topo_sx ON NODE_TOPO (node) INDEXTYPE IS MDSYS. SPATIAL_INDEX PARAMETERS ('sdo_indx_dims = 2, layer_gtype = POINT');
-create table node_link using SDO_JOIN between end node final tables and temp
-the NAYINTERACT should take care of the "alignment" as the tolerance will be applied
create the table node_line
as
Select lineid, max (st_ID) START_NODE_ID, max (en_ID) END_NODE_ID, max (areaid) AREAID
Of
(
SELECT b.lineid, case when b.stend = s ' THEN a.nodeid 0 otherwise end st_ID,.
cases where b.stend = 'E' THEN a.nodeid 0 otherwise end en_ID, areaid
TABLE (SDO_JOIN ('NODE_TOPO', 'NODE',
"TEMP_NODES", "NODE",
"(masque = ANYINTERACT')) c,"
node_topo has,
temp_nodes b
WHERE c.rowid1 = a.rowid AND c.rowid2 = b.rowid
)
Lineid group;
commit;
-items temp
drop table temp_nodes cascade constraints;
delete from user_sdo_geom_metadata where table_name = 'TEMP_NODES ';
commit;
seq_topo sequence of fall;
commit;
-
Regd: SDO_UTIL. Bearing_Tilt_For_Points
Hello
I tried to get a bearing by using the SDO_UTIL. Function Bearing_Tilt_For_Points. But when I execute this query, it gives me an error.
Declare
With the serial number;
Tilt the number;
_Get the first point demanded by wearing the function
* The cursor C1 is *.
Select Sdo_Lrs.Locate_Pt)
(* (Select Sdo_Lrs.Convert_To_Lrs_Geom (R.Geometry, 26,61, 29.61) in Digit.Lrs_Current_Segments R where R.Lrs_Current_Segment_Id = 10283273), 26,72) *.
A1 double;
_Get the second point required by wearing the function
Cursor C2 is
Select Sdo_Lrs.Locate_Pt)
(* (Select Sdo_Lrs.Convert_To_Lrs_Geom (R.Geometry, 26,61, 29.61) in Digit.Lrs_Current_Segments R where R.Lrs_Current_Segment_Id = 10283273), 26.74). *
Double B1;
Start
For X in C1 loop
for y in c2 loop
Sdo_Util.Bearing_Tilt_For_Points
*(*
X.a1, - point of departure
y.b1, - final
* 0.05 *-tolerance
Wearing it,
Tilt
*);*
End loop;
end loop;
Dbms_Output.Put_Line (' related = ' |) Downwind);
Dbms_Output.Put_Line ('Tilt =' |) Tilt).
End;
Error report:
ORA-13364: dimensionality layer does not match the size of the geometry
ORA-06512: at the 'MDSYS. SDO_3GL '; line 2511
ORA-06512: at the 'MDSYS. SDO_UTIL; line 1218
ORA-06512: at line 15 level
13364 00000 - 'dimensionality layer does not dimensions of geometry.
* Cause: Spatial layer has a geometry with a different size than the
dimensions prescribed for the layer.
* Action: Make sure that all geometries in a layer have the same dimensions
and they correspond to the dimensions of the object SDO_DIM_ARRAY
for the layer in the USER_SDO_GEOM_METADATA view.
Don't know what is the error?
Any help is appreciated.
Thank you
L.L.,.
The problem is that the LOCATE_PT returns a point 3301 and not a 2D point.
You must convert the point generated for a 2D for the power point in the bearing_tilt_for_points.
Try something like that.
Declare Bearing Number; Tilt Number; v1 mdsys.vertex_type; v2 mdsys.vertex_type; --_Get the first point required by bearing function Cursor C1 Is SELECT SDO_LRS.LOCATE_PT(a.route_geometry, 26.72) a1 FROM lrs_routes a WHERE a.route_name = 'Route1'; --_Get the second point required by bearing function Cursor C2 Is SELECT SDO_LRS.LOCATE_PT(a.route_geometry, 26.74) b1 FROM lrs_routes a WHERE a.route_name = 'Route1'; Begin For X In C1 Loop for y in c2 loop -- Extract single point from sdo_ordinate_array for each located points v1 := sdo_util.getVertices(X.a1)(1); v2 := sdo_util.getVertices(y.b1)(1); Sdo_Util.Bearing_Tilt_For_Points ( sdo_geometry(2001,8307/*X.a1.sdo_srid*/,sdo_point_type(v1.x, v1.y, null),null,null), -- start point sdo_geometry(2001,8307/*Y.b1.sdo_srid*/,sdo_point_type(v2.x, v2.y, null),null,null), -- end point 0.05, -- Tolerance Bearing, Tilt ); End Loop; end loop; Dbms_Output.Put_Line('Bearing = ' || Bearing); Dbms_Output.Put_Line('Tilt = ' || Tilt); End; / -- Results -- Bearing = 0 Tilt =
Notice that I use a different data source that has NULL srid, so I hard-8307-code as bearing_tilt only works for geodetic data. Replace the data source with your own and remove the 8307 and comments around the references sdo_srid return on your own data.
If it is correct, please give points.
concerning
Simon -
How to get the points of contact between the points and polygons
Hi ~
I am
work based on Oracle 11 g and
looking for a way to get points of contact between the points and polygons.
For example, I have two data STORE (point) "and"(polygon) ROAD"and each store must have a contact point or points of contact for the nearest road.
I know what the closest route is using SDO_NN, but I don't know hot to get the point of contact.
Please let me know hot to do ~
Thank you.If you have the point and its nearest road, you can find the contact point (ie the store point nearest the road linestring) using SDO_LRS function Project_Pt as follows:
With route As ( select SDO_GEOMETRY(3302,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(2.0,2.0,0.0, 2.0,4.0,3.218, 8.0,4.0,12.872, 12.0,4.0,19.308, 12.0,10.0,28.962, 8.0,10.0,35.398, 5.0,14.0,43.443)) as route, SDO_GEOMETRY(2001,NULL,sdo_point_type(9,3,NULL),null,null) as store from dual ) SELECT SDO_LRS.PROJECT_PT(route, store) as store_on_route FROM route ; -- Result -- STORE_ON_ROUTE -------------------------------------------------------------------------------------------------------- MDSYS.SDO_GEOMETRY(3301,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),MDSYS.SDO_ORDINATE_ARRAY(9,4,14.481))
If you don't have a space licence, try using my LRS for users of Locator at: http://www.spatialdbadvisor.com/source_code/214/linear-package-sdo_lrs-replacement
If this is correct, please give points. (I work for love IE Points not money!)
concerning
Simon -
Hello
I'm to rust
I would like to have the length of a form of framework (EARTH. RIVER)
I know the coordinates:
I try to make this statement, but do not work
SELECT
SDO_GEOM. SDO_LENGTH
(
SDO_GEOMETRY
(
3301,
NULL,
NULL,
SDO_ELEM_INFO_ARRAY (1, 1, 1)
SDO_ORDINATE_ARRAY (576057.49, 5001639.89, NULL)
),
A.GEOMETRY,
SDO_GEOMETRY
(
3301,
NULL,
NULL,
SDO_ELEM_INFO_ARRAY (1, 1, 1)
SDO_ORDINATE_ARRAY (581289.44, 5003609.23, NULL)
),
B.GEOMETRY,
0.005
) as LENGTHSEGMENT
OF THE EARTH. RIVER, LAND. RIVER b
where A.CODE = 36 and B.ZONE = 1
Someone, how is this done?
Thanks in advanceIf the values in the column of GEOMETRY of the table of RIVER line SDO_GEOMETRY standard channels, you need to:
1. Add an extra step at the beginning that uses SDO_LRS. CONVERT_TO_LRS_GEOM to convert the GEOMETRY, the LRS geometric segment.
2. use the LRS geometric segment instead of the GEOMETRY in the later stages.
I hope this helps.
-
SDO_LENGTH/SDO_AREA on 3d data work well on 11 GR 2, but is there a way to make them work on gr 10, 2? I ask since SDO_LRS. DEFINE_GEOM_SEGMENTS_3D assigned action 3D both 11 g and 10 g 2, so the logic obviously exists in the database.
BTW, it's a bug that SDO_LENGTH works fine (gives length 3d) geometry 3002, but when I add measures to the geometry and turn to 4402 it calculates the length 2d only?3D calculations support length/area (sdo_length/sdo_area) is in force since 11 GR 2 and not available in 10g.
By default, the length (sdo_length) for the LRS geometry is length 2D.
As LRS supports 3D Cartesian/projected linestring, you use a method of
sdo_lrs.geom_segment_length_3d (Geom)
for your 3D lrs geometry (4402).
However a GEODESIC length 3D is not supported in the above function.Jack
-
I have a large table of links (road network) and I'm trying to generate a new one for the matching nodes. In addition, I need to present existing links, the start_node and the end_node. I create new nodes by taking SDO_LRS. GEOM_SEGMENT_START_PT and SDO_LRS. GEOM_SEGMENT_END_PT of links.
However, at the crossroads (where 4 links meet) are a 4 generated distinct nodes, instead of a single, which would be shared between all 4 links. To solve it, I could use the function of the distance to each node a to find and remove other nodes with the same geometry, leaving only one, but it's too expensive.
Are there other ways to generate the nodes more quickly?
see you soonHello
Suppose you have a table node with node_id, geometry (sdo_geometry)
You can create a spatial index on node_geometry.Create a table of node mapping: node_id, target_node_id.
Then, to find all nodes that are a given distance WRT a given node. (using operator sdo_within_cost)
select a.node_id node_id, min(b.node_id) target_node_id from node_table a, node_table b where sdo_within_distance (b.geometry,a.geometry,'distance = 0.001') = 'TRUE' group by a.node_id;
For the Group of the intersection of 4 knots (1,2,3,4)
you get:target_node_id node_id
1 1
6 5
1 of 3
4 1To the node table, remove those whose node_id is greater than his target_node_id. This command removes the redundant nodes.
For the table of links: link_id, start_node_id, end_node_id...
You can update the start_node_id and end_node_id with their target_node_id in the node_mapping table.It is more efficient that you use the spatial operator.
I hope that helps!
Jack
Maybe you are looking for
-
I want to merge an old account to a new account
Hello I had iTunes for a long time, if long indeed that the e-mail address linked to my old account hosting servers declined. I want to know if it is possible, and if a member of the staff of Apple would be able to help me to merge my old account alb
-
I erased my new iphone to use go to iOS feature. Later when you set the phone, prompt action came to put the apple id credentials associated with the phone. My own credentials do not work. Do not know how to proceed now
-
Hello. Last week, I had to do a full system restore to remove a virus. Because I didn't have any disk boot of Windows 7 at the time, I decided to boot linux (ubuntu) on the computer to make sure that my system works ok. Today, I received my discs of
-
Lenovo IdeaCentre 700 suddenly stops
I've only had the AIO for about 3 weeks and about half a dozen times during this period, he just switched off and then restarted in the middle of using it. It's happened just browsing, playing a game online and even work in offline mode on a workshee
-
Original title: how to format drive C? I have Windows XP installed on my C drive, but due to the lack of hard drive space, I installed another Windows XP on drive D. Now when I try to format the C drive of the new installed Windows, I get this error: