Minimum bounding rectangle of a single geometric feature

Is there a function in ORACLE Spatial 8.1.7 that returns the
minimum bounding rectangle (MBR) of a single geometric feature?
SDO_TUNE.EXTENT_OF returns a MBR but for the whole layer but not
for a single geometry.

Hi,
This is much slower than the built-in function for 9i, but might
be helpful in any event. This function only works for 2d
geometries. It doesn't do error checking for points and such.
It assumes a NULL SDO_SRID. Etc. It isn't supported. In 9i, I'd
immediately suggest going to sdo_geom.sdo_mbr.
Call it like this:
select xmbr(geom) from geod_states where state_abrv='NH';
create or replace function xmbr (geom mdsys.sdo_geometry)
return mdsys.sdo_geometry is
vmbr mdsys.sdo_geometry;
ogg mdsys.sdo_geometry := geom;
ii number;
xlow number;
xhigh number;
ylow number;
yhigh number;
begin
-- initialize it
xlow := 999999999999;
ylow := 999999999999;
xhigh := -999999999999;
yhigh := -999999999999;
-- assumes 2d geometry
for ii in 1..ogg.sdo_ordinates.count
loop
if mod(ii, 2) = 0 then
-- y
if ogg.sdo_ordinates(ii) > yhigh then
yhigh := ogg.sdo_ordinates(ii);
else
if ogg.sdo_ordinates(ii) < ylow then
ylow := ogg.sdo_ordinates(ii);
end if;
end if;
else
-- x
if ogg.sdo_ordinates(ii) > xhigh then
xhigh := ogg.sdo_ordinates(ii);
else
if ogg.sdo_ordinates(ii) < xlow then
xlow := ogg.sdo_ordinates(ii);
end if;
end if;
end if;
end loop;
-- build the object (MBR rectangle)
vmbr := mdsys.sdo_geometry(2003, null, null,
mdsys.sdo_elem_info_array(1,1003,3),
mdsys.sdo_ordinate_array(xlow, ylow,xhigh, yhigh));
return vmbr;
end;

Similar Messages

  • Determine Minimum Bounding Rectangle of objects

    I need sql/plsql to determine the minimum bounding rectangle of a group of one or more polygons. The result can be returned as an optimised polygon.

    If you are using Oracle9i, how about sdo_geom.sdo_mbr for one geometry, or sdo_aggr_mbr for multiple
    geometries. Note they do not work on geodetic data.

  • FOR Minimum bounding rectangle

    Hi,
    Is there a function available in sap hana spiatial for finding minmum bounding rectangle on geometries.
    Currently, I am using below query to find it
    SELECT new ST_Polygon('POLYGON (('   || Min("GEOM".st_xmin()) || ' ' || Min("GEOM".st_ymin()) || ','
       || Min("GEOM".st_xmin()) || ' ' || Max("GEOM".st_ymax()) ||
       ','   || Max("GEOM".st_xmax()) || ' ' || Max("GEOM".st_ymax()) || ','   || Max("GEOM".st_xmax()) || ' ' || Min("GEOM".st_ymin()) || ','   || Min("GEOM".st_xmin()) || ' ' || Min("GEOM".st_ymin())   || '))') FROM "table" GROUP BY  ID
    But this is failing for point geometries in table because (xmin, ymin ) and (xmax,ymax) are same for point and it is not able to create polygon for it.
    I have also tried ST_UNIONAggr(thinking of getting envelope of the aggregated geometry) but this gives error with - invalid function or procedure name.
    Please suggest.
    Thanks in Advance.
    Nishtha

    Hello Nishtha, thanks for contacting us. Please refer to the SAP HANA and In-Memory Computing group: http://scn.sap.com/community/hana-in-memory You can post the same question there. I hope you will find this helpful. Kind regards, Federica

  • Incorrect bounding rectangle height after styling

    I am experiencing with incorrect bounding rectangle height when I set the background color for text in RichEditableText field. I have actually custom styled the RET field with following:
    lineHeight: 49;
    baselineShift: 11;
    firstBaselineOffset: lineHeight;
    verticalAlign: top;
    When I try to change the background color for certain range of text it doesn't cover the entire line height, although the selection covers the entire line height. Is there any way to increase the height of bounding rectangle or any other workaround to this please?

    1. I am able to return the TextFlowLine for each line in para but I have seen that some TextLine are marked as INVALID due to which I am unable to get their atom locations. I have tried to force the validity of TextLine to recreate the line but that doesn't work for some lines. Is there any work around to this?
    When the contents of the TextBlock are modified, the Flash runtime marks affected text lines, the previous line, and all following lines as INVALID. So I think you may want to get the lines
    [When you try to override TLF source code] after ContainerController.updateCompositionShapes 
    [When you just take advantage of offical TLF library] in the event handler of UpdateCompleteEvent.UPDATE_COMPLETE.
    2. The highlighter rectangle which I have created, have tried to placed it as a child element of TextLine. Due to this, the highlighter rectangle appear infront of the TextLine. I have tried to positioned it at 0 location using addChildAt but that doesn't seems to work. Is there any work around to this also please?
    In TLF code, we creat Shape as the child of the container to draw the selection, because TextLine is transparent.

  • Cisco support for Single Inbox Feature in Exchange 2003 for Unity Connection 8.5

    Hi There,
    Does Cisco support a Unity Connection 8.5 solution/design with the Single Inbox Feature (for Unified Messaging) configured with Exchange 2003, or does it support the Single Inbox feature on Exchange 2010 only?
    Thanks

    Thanks Anthony - I just found an updated doco that confirms that.

  • OCR labview code-character bounding rectangle

    NI didn't leak the codes and examples fully for Vision Assistant so I have to use the assistant whenever I train some characters.
    I want to add the simple training routine to my main program.
    As a start point, I would like to detect the character bounding rectangle of OCR object (like a red box of attachment) before reading a character set.
    Is there any related vi for this work?
    labmaster.
    *)NI Read LCD/LED.vi didn't operate for my purpose. gave up after investing time and various camera.
    Solved!
    Go to Solution.
    Attachments:
    yahoo.png ‏9 KB

    NI labview provided the code in OCR panel.

  • Why is Rectangle Tool's matching dimension feature not working?

    With the Rectangle Tool's cursor is clicked in the document.
    The Rectangle Panel appears.
    A height dimension is entered.
    With the pointer, the Width field is clicked.
    Usually, the Height Value gets automatically entered in the Width field.
    In this case it does not.
    This same behavior is occuring in the Ellipse Tool.
    What has changed?
    Thanks
    iMac 3.4Ghz 32 GB
    OSX 10.8.2
    Illustrator CS6

    I may not have been clear on what is not working... the feature I am trying to create has been in Illustrator for several versions... another discusion on this site deals with the same problem...
    see http://forums.adobe.com/message/4910715... it is explained...
    'There has always been a one click solution, just like the help file says. Try it in CS5, click once with the tool, enter your width value, click on the word height, ill copies the width value into the height field, hit enter and you are done.'
    it is this function that I have used for years.

  • Fingerprint software, Window 7 and single logon feature

    I have a T400s, when I got my machine and had Win7 rc installed on it, it was somehow setup so that when the machine was down, I could swipe my finger, and the machine would boot up and login directly into my account. The fingerprint reader seem to be active even when the machine was powered down.
    I did a fingerprint data reset from bios so that I could do a  clean install for Win7 (released version).  But now the fingerprint reader does not seem to be active until I press on the power button.  Does anybody know if it is possible to restore the previous behaviour ? 
    It look strange that the fingerprint reader was active before power up but it was so convenient.
    Solved!
    Go to Solution.

    Make sure you have the Lenovo UPEK (beta) drivers/utility installed. Go to the ThinkVantage Fingerprint Software utility, under Settings make sure "Use fingerprint scan instead of power-on button" is checked. If you don't have such an option, try uninstalling and reinstalling the "TouchChip Fingerprint Coprocessor" driver.

  • How to get shape's bounding box

    Hi!
    Like the topic says, I'm wondering if there is a way to get a shape's bounding box? Either through a query or some method in JGeometry. I suppose I could just get the coordinates and loop over them to get the min/max values, but is there some more efficient way?
    Thanks!

    Yup. That worked.
    I looked at the JGeometry documentation, but I would never have guessed that MBR stood for Minimum Bounding Rectangle if you hadn't pointed me in the right direction.
    Thanks again!

  • Get length and width of a rectangle

    I am using sdo_sam.tiiled_bins to breakup rectangles into different sections. I need to divide the rectangle along the x or y axis depending on if is longer or wider. I checked the documentation and I could not find a way to get the length and width of a minimum bounding rectangle. Is there any built in functionality to get the length and width of a rectangle or do i have to create my own? Database is 11gr2.
    Thanks
    Rob

    Rob,
    You can use SDO_GEOM.SDO_MIN_MBR_ORDINATE and SDO_GEOM.SDO_MAX_MBR_ORDINATE to compute the length and width of an mbr.
    References:
    [ SDO_GEOM.SDO_MIN_MBR_ORDINATE | http://docs.oracle.com/cd/E11882_01/appdev.112/e11830/sdo_objgeom.htm#i866250 ]
    [ SDO_GEOM.SDO_MAX_MBR_ORDINATE | http://docs.oracle.com/cd/E11882_01/appdev.112/e11830/sdo_objgeom.htm#i866249 ]
    Regards,
    Noel

  • Spatial overlay queries involving tables with different spatial extents

    We are using GeoMedia Professional 6.1 with an Oracle 10g database. For validating geometry, we use a standard minimum bounding rectangle (MBR) that is fairly tight to our city boundary. Some city departments are requesting that we extend the spatial limits to create a larger MBR for some new features. This will involve using a new SDO_DIMINFO array in the MDSYS.SDO_GEOM_METADATA_TABLE and creating new spatial indexes. It is our intention to leave the existing features "as-is" with the original MBR and spatial indexes. I have done some preliminary testing in GeoMedia and have not run into any issues when doing spatial queries involving features with different MBRs. Spatial intersections, spatial differences and spatial filters seem to complete in a reasonable amount of time, even with large data sets. Does anyone have any experience using different MBRs with Oracle spatial overlay queries? Are there any other potential issues we should be aware of when working with tables that are created with different spatial extents such as performance?

    Luc ... Thank you for supplying the URL for Simon Greener’s website. This article supports information we already received from our GIS software provider.
    With regards to your questions: One of the checks carried out in our “ValidateGeometry” procedure is to ensure that a new or modified geometry is within the bounding rectangle defined by the SDO_DIMINFO. An error is raised if the user tries to add a polygon that is well beyond the city boundary rather than within the prescribed city area. Currently, we do not use different MBR’s as layer extents (there are only a couple of exceptions). We are in the process of conducting system and performance testing to identify potential issues that may be encountered when tables created with expanded upper and lower bounds are used in downstream applications such as intranet/internet web maps. We are still trying to identify any potential “hotspots”.

  • Spatial Queries Not Always Producing Accurate Results

    Hi,
    Spatial queries are not always producing accurate results. Here are the issues. We would appreciate any clarification you could provide to resolve these issues.
    1. When querying for points inside a polygon that is not an MBR (minimum bounded rectangle), some of the coordinates returned are not inside the polygon. It is as though the primary filter is working, but not the secondary filter when using sdo_relate. How can we validate that the spatial query using sdo_relate is using the secondary filter?
    2. SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT returns true when validating geometries even though we find results that are invalid.
    3. Illegal geodetic coordinates can be inserted into a table: latitude > 90.0, latitude < -90.0, longitude > 180.0 or longitude < -180.0.
    4. Querying for coordinates outside the MBR for the world where illegal coordinates existed did NOT return any rows, yet there were coordinates of long, lat: 181,91.
    The following are examples and information relating to the above-referenced points.
    select * from USER_SDO_GEOM_METADATA
    TABLE_NAME      COLUMN_NAME      DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)      SRID
    LASTKNOWNPOSITIONS      THE_GEOM SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .05), SDO_DIM_ELEMENT('Y', -90, 90, .05))      8307
    POSITIONS     THE_GEOM SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .05), SDO_DIM_ELEMENT('Y', -90, 90, .05))      8307
    Example 1: Query for coordinates inside NON-rectangular polygon includes points outside of polygon.
    SELECT l.vesselid, l.latitude, l.longitude, TO_CHAR(l.observationtime,
    'YYYY-MM-DD HH24:MI:SS') as obstime FROM lastknownpositions l where
    SDO_RELATE(l.the_geom,SDO_GEOMETRY(2003, 8307, NULL,
    SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    SDO_ORDINATE_ARRAY(-98.20268,18.05079,-57.30101,18.00705,-57.08229,
    54.66061,-98.59638,32.87842,-98.20268,18.05079)),'mask=inside')='TRUE'
    This query returns the following coordinates that are outside of the polygon:
    vesselid : 1152 obstime : 2005-08-24 06:00:00 long : -82.1 lat : 45.3
    vesselid : 3140 obstime : 2005-08-28 12:00:00 long : -80.6 lat : 44.6
    vesselid : 1253 obstime : 2005-08-22 09:00:00 long : -80.0 lat : 45.3
    Example 2a: Using SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT
    Select areaid, the_geom,
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(the_geom, 0.005) from area where
    areaid=24
    ResultSet:
    AREAID THE_GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO,
    SDO_ORDINATES) SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(THE_GEOM,0.005)
    24 SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-98.20268, 18.05079, -57.30101, 18.00705, -57.08229, 54.66061, -98.59638, 32.87842, -98.20268, 18.05079)) TRUE
    Example 2b: Using SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT
    Select positionid, vesselid, the_geom,
    SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(the_geom, 0.005) from positions where vesselid=1152
    ResultSet:
    POSITIONID VESSELID THE_GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z),
    SDO_ELEM_INFO, SDO_ORDINATES) DO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(THE_GEOM,0.005)
    743811 1152 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-82.1, 45.3, NULL), NULL, NULL) TRUE
    743812 1152 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-82.1, 45.3, NULL), NULL, NULL) TRUE
    743813 1152 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-80.2, 42.5, NULL), NULL, NULL) TRUE
    743814 1152 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-80.2, 42.5, NULL), NULL, NULL) TRUE
    Example 3: Invalid Coordinate values found in POSITIONS table.
    SELECT p.positionid, p.latitude, p.longitude, p.the_geom FROM positions p
    WHERE p.latitude < -180.0
    2 lines from ResultSet:
    POSITIONID LATITUDE LONGITUDE THE_GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    714915 -210.85408 -79.74449 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-79.74449, -210.85408, NULL), NULL, NULL)
    714938 -211.13632 -79.951256 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-79.951256, -211.13632, NULL), NULL, NULL)
    SELECT p.positionid, p.latitude, p.longitude, p.the_geom FROM positions p
    WHERE p.longitude > 180.0
    3 lines from ResultSet:
    POSITIONID LATITUDE LONGITUDE THE_GEOM(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    588434 91 181 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(181, 91, NULL), NULL, NULL)
    589493 91 181 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(181, 91, NULL), NULL, NULL)
    589494 91 181 SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(181, 91, NULL), NULL, NULL)
    Example 4: Failure to locate illegal coordinates by querying for disjoint coordinates outside of MBR for the world:
    SELECT p.vesselid, p.latitude, p.longitude, p.the_geom,
    TO_CHAR(p.observationtime, 'YYYY-MM-DD HH24:MI:SS') as obstime,
    SDO_GEOM.RELATE(p.the_geom, 'determine',
    SDO_GEOMETRY(2003, 8307, NULL,SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    SDO_ORDINATE_ARRAY(-180.0,-90.0,180.0,-90.0,180.0,90.0,
    -180.0,90.0,-180.0,-90.0)), .005) relationship FROM positions p where
    SDO_GEOM.RELATE(p.the_geom, 'disjoint', SDO_GEOMETRY(2003, 8307,
    NULL,SDO_ELEM_INFO_ARRAY(1, 1003, 1),
    SDO_ORDINATE_ARRAY(-180.0,-90.0,180.0,-90.0,180.0,90.0,-80.0,90.0,
    -180.0,-90.0)),.005)='TRUE'
    no rows selected
    Carol Saah

    Hi Carol,
    1) I think the results are correct. Note in a geodetic coordinate system adjacent points in a linestring or polygon are connected via geodesics. You are probably applying planar thinking to an ellipsoidal problem! I don't have time to do the full analysis right now, but a first guess is that is what is happening.
    2) The query window seems to be valid. I don't think this is a problem.
    3) Oracle will let you insert most anything into a table. In the index, it probably wraps. If you validate, I think the validation routines will tell you is is illegal if you use the signature with diminfo, where the coordinate system bounds are included in the validation.
    4) Your query window is not valid. Your data is not valid. As the previous reply stated, you need to have valid data. If you think in terms of a geodetic coordinate system, you will realize that -180.0,-90.0 and 180.0,-90.0 are really the same point. Also, Oracle has a rule that polygon geometries cannot be greater than half the surface of the Earth.
    Hope this helps.

  • Zoom to content of dynamic themes

    hello,
    i added some geometries using the .addJDBCTheme() method of mapviewer bean (select ...)
    how can i get the minimum bounding rectangle only of this selected geometies?

    You can define this JDBCTheme as a bounding theme on your request. In this case your map window will cover the extent of the geometries for this JDBCTheme. See the bounding_themes element description on the Users Guide (I guess section 3.2.2).

  • Sdo_tune.extent_of slow

    I'm currently using Oracle Spatial 8.1.5. I find that the procedure sdo_tune.extent_of is slow. I found (using OCI and profiling) that the time taken for this procedure is about the same as the time taken to retrieve all the geometry records.
    I would like to ask if the newer version like 8.1.6 and 8.1.7 has made any improvements to this procedure?
    Regards

    Hi,
    SDO_TUNE.EXTENT_OF reads all the geometries and returns the minimum bounding rectangle as an optimized rectangle. Oracle spatial is looking at each record. It may have gotten faster to the extent that OCI and objects have gotten a bit faster with newer releases, but the spatial work done is the same in all three (8.1.5, 8.1.6, and 8.1.7) releases.
    Hope this helps, and regards,
    Dan

  • Connection between 2 points in a geodetic coordinate system

    In a geodetic coordinate system the connection between two points is a geodetic line or "great circle" (the shortest connection between two points on the surface of the earth).
    Since Oracle 9i distances and queries like "Is a point outside or inside the polygon" are computed correctly for a geodetic coordinate system.
    Even though a circle or arc is not allowed in a geodetic coordinate system (like WGS84 - SRID 8307)
    arcs and circles are used in geographic applications like aeronautical maps.
    Frequently a special area is defined like this "10 nautical miles around airport XXXX"
    and this area is shown as a circle in aeronautical maps (in the projection).
    The function SDO_UTIL.CIRCLE_POLYGON (in Oracle 10g) is very useful to construct such kind of areas and for queries like
    "Does the area belonging to airport XXXX overlap with the area belonging to airport YYYY?".
    For Oracle 8i we had to write special PL/SQL code.
    Another type of connection between two points that is frequently used is a line of equal latitude (parallel).
    Many boundaries are defined like "from meridian (longitude) 30°E to meridian 31°E along parallel 47.5°N".
    If this line is a border of a polygon and if we use a direct connection (geodetic line) and we ask if a point is
    inside or outside the polygon, we will not get the correct answer if the point is close north to this line.
    We have to approximate the line and add points e.g. every 0.1° longitude (30.1,30.2,30.3...), then the answer will be correct.
    My question:
    Are there plans to support circles of equal latitude or generally rhumb lines as a type of connection between two points?
    Karl Mann

    There are no plans to support rhumb lines, also know as loxodromes, and including the special case of parallels of latitude, at this time. Note that it is easy to simulate such rhumb lines with a sufficiently dense set of sampled points. Such a densification is implemented implicitly for parallels in the VIEWPORT_TRANSFORM function so that the concept of the "geodetic minimum bounding rectangle" can be supported, primarily for visualization applications.

Maybe you are looking for