Use of several spatial operators in one select

I am using Oracle 10g 10.1.0.2.0
I have two tables State and County with spatial attributes. County has foreign kay to corresponding state:
CREATE TYPE STATE_TYPE AS OBJECT (
Geometry mdsys.sdo_geometry,
Name VARCHAR2(25),
Population NUMBER(10),
Area NUMBER,
MainActivity VARCHAR2(50),
Capital VARCHAR2(25) );
create table State of State_Type (
constraint StatePK primary key (Name))
object identifier is system generated;
create type CountySpa_Type as object (
Geometry mdsys.sdo_geometry,
Name varchar2(25),
Area number,
MainActivity varchar2(50),
StateRef REF State_Type);
create table CountySpa of CountySpa_Type (
constraint CountySpaPK primary key (Name),
constraint CountySpaFK foreign key (StateRef) references State);
I want to check that the geometry of State and geometric union of corresponding counties is equal. I already found no very nice solution but cannot understand why in the following Oracle gives me an error of invalid identifier GU
select S1.Name
from State S1, (
Select sdo_aggr_union(sdoaggrtype(C.Geometry, 0.005))
from CountySpa C, State S2
where C.StateRef = ref(S2) and S2.Name = ‘NewState’) GU
where sdo_geom.relate(S1.Geometry, ‘EQUAL’, GU, 0.005)= ‘EQUAL’;

Hi.
If somebody is interested I found the solution. Conntact me if you want an explanation
Select S1.Name
From State S1, (
Select S2.Name as SName, sdo_aggr_union(sdoaggrtype(C.Geometry, 0.005)) as Geometry
from CountySpa C , State S2
where C.StateRef = ref(S2)
group by S2.Name ) GU
Where GU.SName = S1.Name and sdo_geom.relate(S1.Geometry, ‘EQUAL’, GU.Geometry, 0.005)= ‘EQUAL’;

Similar Messages

  • Best practice for use of spatial operators

    Hi All,
    I'm trying to build a .NET toolkit to interact with Oracles spatial operators. The most common use of this toolkit will be to find results which are within a given geometry - for example select parish boundaries within a county.
    Our boundary data is high detail, commonly containing upwards of 50'000 vertices for a county sized polygon.
    I've currently been experimenting with queries such as:
    select
    from
    uk_ward a,
    uk_county b
    where
    UPPER(b.name) = 'DORSET COUNTY' and
    sdo_relate(a.geoloc, b.geoloc, 'mask=coveredby+inside') = 'TRUE';
    However the speed is unacceptable, especially as most of the implementations of the toolkit will be web based. The query above takes around a minute to return.
    Any comments or thoughts on the best practice for use of Oracle spatial in this way will be warmly welcomed. I'm looking for a solution which is as quick and efficient as possible.

    Thanks again for the reply... the query currently takes just under 90 seconds to return. Here are the results from the execution plan ran in sql*:
    Elapsed: 00:01:24.81
    Execution Plan
    Plan hash value: 598052089
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 156 | 46956 | 76 (0)| 00:00:01 |
    | 1 | NESTED LOOPS | | 156 | 46956 | 76 (0)| 00:00:01 |
    |* 2 | TABLE ACCESS FULL | UK_COUNTY | 2 | 262 | 5 (0)| 00:00:01 |
    | 3 | TABLE ACCESS BY INDEX ROWID| UK_WARD | 75 | 12750 | 76 (0)| 00:00:01 |
    |* 4 | DOMAIN INDEX | UK_WARD_SX | | | | |
    Predicate Information (identified by operation id):
    2 - filter(UPPER("B"."NAME")='DORSET COUNTY')
    4 - access("MDSYS"."SDO_INT2_RELATE"("A"."GEOLOC","B"."GEOLOC",'mask=coveredby+i
    nside')='TRUE')
    Statistics
    20431 recursive calls
    60 db block gets
    22432 consistent gets
    1156 physical reads
    0 redo size
    2998369 bytes sent via SQL*Net to client
    1158 bytes received via SQL*Net from client
    17 SQL*Net roundtrips to/from client
    452 sorts (memory)
    0 sorts (disk)
    125 rows processed
    The wards table has 7545 rows, the county table has 207.
    We are currently on release 10.2.0.3.
    All i want to do with this is generate results which fall in a particular geometry. Most of my testing has been successful i just seem to run into issues when querying against a county sized polygon - i guess due to the amount of vertices.
    Also looking through the forums now for tuning topics...

  • I am trying to use photomerge compose.  I open one standard jpeg image and one image that is my business logo in a png format.  When I select the png image, to extract the logo from it, it appears as all white and will not allow me to select the logo from

    I am trying to use photomerge compose.  I open one standard jpeg image and one image that is my business logo in a png format.  When I select the png image, to extract the logo from it, it appears as all white and will not allow me to select the logo from it.  It has worked in the past but I downloaded the update today and photomerge will not work correctly.  Any ideas?

    hedger,
    How do you expect anyone to help when we don't know a darned thing about the file, abut your setup, exact version of Photoshop and your OS, machine specs, etc.?
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • HT201250 Can I include external drives to be backed up using Time Machine.  Not only do I want to back up my IMac, but I have several extenal drives for one iPhoto, one iTunes and one for other files & documents.

    Can I include external drives to be backed up using Time Machine?  Not only do I want to back up my IMac, but I have several extenal drives for one iPhoto, one iTunes and one for other files & documents.  How do I know if they are included in the backup process?

    Yes, if they are not exclude then TM backs them up.
    Allan

  • Can anyone help me figure out how to sync my ipod with my purchased music?  I have used several computer and at one point synced my ipod with a computer that only had about half of my music.  My other computers are no longer working.  Not sure how to get

    Can anyone help me figure out how to sync my ipod with my purchased music?  I have used several computer and at one point synced my ipod with a computer that only had about half of my music.  My other computers are no longer working.  Not sure how to get my purchased music back onto my ipod?

    Hi kimcinma!
    Your previous purchases are saved on iCloud even if you bought them on another computer. If you can't find them on your current computer, you might need to unhide them. Go to iTunes preferences, and click on Store Preferences. Then click the box for "show iTunes in the Cloud purchases". Then click on OK, and everything you've ever bought from iTunes on that Apple ID will show up in your library. You will need to download them from iCloud first before you can synch them to your iPod Classic. To do this, click on the little cloud with the arrow in it next to your song, and it will download to your computer. When you have the music that you want downloaded, plug in your iPod and synch away. Hope this helps!
    Sandygirl

  • I want to change my primary e-mail address that I use with Apple ID - help guide says Select Edit next to "Apple ID and Primary Email Address." But there is no 'edit' on that section there is on every other but not that one. Can anyone help?

    I want to change my primary e-mail address that I use with Apple ID - help guide says Select Edit next to “Apple ID and Primary Email Address.” But there is no 'edit' on that section there is on every other but not that one. Can anyone help?

    You can create an alias @icloud.com email address within your current account that will receive email in your current iCloud inbox (see http://help.apple.com/icloud/#/mm6b1a490a).  (@me.com addresses are no longer available as new addresses.)  Just be aware that you cannot use an alias address later to create a new iCloud account or move it to a different account.
    Also, even if you created a new iCloud account with a new ID, your existing purchases would not be lost.  They are permanently tied to the original ID you used to purchase them.  You can also continue to use the existing ID for the iTunes store; it does not need to be the same as the ID you use for iCloud.

  • How to Use COLUMN NOPRINT - need to exclude one column from Select *

    Dear Friends,
    I need to exclude one column from a SELECT * query. Everytime the column data type is BLOB, I dont' want it to be part of my SELECT. After googling I found some info about NOPRINT but it doesn't seem to be working in my case. May be I am using it incorreclty.
    COLUMN FILE_DESC NOPRINT
    SELECT * FROM FILES;
    Where FILE_DESC is of BLOB datatype.Can I use it in my SELECT or it has to be used in Dynamic SQL? Is there any other option to achieve this?
    Thanks in advance.

    Hi,
    COLUMN FILE_DESC NOPRINT
    affects all queries in the same SQL*Plus session (unless you cancel it with a COLUMN FILE_DESC PRINT command.)  It doesn't matter if those queries are static or dynamic.  As mentioned before, COLUMN is a SQL*Plus command.  If you using a different front end, then it may have a different way to hide specific output columns.
    Did you have a poroblem when you tried it?  Post a complete test script that the people who want to help you can use to re-create the problem and test their ideas.
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Cannot use double tap and move with one finger to select text in Mountain Lion

    I've been using OS X in my Macbook Pro since Snow Leopard, and if I choose "tap with one finger to click", I can use double tap and move with one finger to select text if the cursor is between text.
    It works in Snow Leopard,and Lion However, in Mountain Lion, this doesn't work!! I have to click in the bottom right corner of my trackpad  in order to select the text.
    Can anyone get this fixed ?
    Thanks.

    Caolei,
    I don't know if you'll ever see this, but thank you! I hope this helps somebody else down the line, too.
    re. "I can use double tap and move with one finger to select text if the cursor is between text."
    I've been trying to figure out how to select text with tapping and without clicking.
    This did the trick.
    It's quite finicky to not select a space in between words.
    Zooming in does seem to help (two finger double tapping in a body of text may trigger a SmartZoom and zoom the current frame of text to fill the screen, if anybody doesn't know this.)
    ((There's a smartMagnifyWithEvent Cocoa NSEvent that's not universally supported across all applications for noob OS X developers like me.))
    I haven't been able to find the part about double tapping between text to begin a selection (which seems to work best when double tapping directly next to a letter) anywhere in the help system on or online. I probably just missed it, though.
    Clicking with the built-in trackpad on my MacBook Pro w/ Retina or Magic Mouse just takes too much pressure for an old-time touch typist like me.
    As an aside, I've been trying BetterTouchTool and MagicPrefs to enable one finger tap on the Magic Mouse. BetterTouchTool seems to trigger text selection unwantedly and randomly, though.
    The whole mystique of Mac / Apple being intuitive and user-friendly seems to be one of the greatest marketing coups / unbelievable con jobs of the last century.
    I'm actually somewhat qualified to express an opinion as a software engineer with a degree in Computer Science and programming and user interface design experience in Windows, UNIX, web, Android and other systems, and now OS X and iOS. I could go on and on and on but I won't other to say that I still find Macs buggy and hard to use. I'm now finding that my new iPhone 5 is just as big of a pain (i.e. big thumbs missing landscape keyboard in Contacts.) Of course, I like flexibility and options and custom workflows and more than one way to do things and simply being able to do things at all, so I'm also actually somewhat biased. Sorry for the rant...
    Cheers,
    Hal

  • How to join THREE different tables into internal table using one select statement .

    How to join THREE different tables into internal table using one select statement .
    Hi experts,
    I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
    Scenario:
    Database tables:
    SPFLI
    SFLIGHT
    SBOOK.
    Table Fields:
    SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
    SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
    SEATSOCC_C SEATSMAX_F SEATSOCC_F
    SBOOK - CARRID CONNID CLASS
    MY INTERNAL TABLE IS IT_XX.
    Your help much appreciated.
    Thanks in advance.
    Pawan.

    Hi Pawan,
    please check below codes. hope it can help you.
    TYPES: BEGIN OF ty_xx,
            carrid     TYPE spfli-carrid   ,
            connid     TYPE spfli-connid   ,
            countryfr  TYPE spfli-countryfr,
            cityfrom   TYPE spfli-cityfrom  ,
            countryto  TYPE spfli-countryto,
            cityto     TYPE spfli-cityto   ,
            fldate     TYPE sflight-fldate ,
            seatsmax   TYPE sflight-seatsmax ,
            seatsocc   TYPE sflight-seatsocc ,
            seatsmax_b TYPE sflight-seatsmax_b,
            seatsocc_b TYPE sflight-seatsocc_b,
            seatsmax_f TYPE sflight-seatsmax_f,
            seatsocc_f TYPE sflight-seatsocc_f,
            class      TYPE sbook-class,
          END OF ty_xx,
          t_xx TYPE STANDARD TABLE OF ty_xx.
    DATA: it_xx TYPE t_xx.
    SELECT spfli~carrid
           spfli~connid
           spfli~countryfr
           spfli~cityfrom
           spfli~countryto
           spfli~cityto
           sflight~fldate
           sflight~seatsmax
           sflight~seatsocc
           sflight~seatsmax_b
           sflight~seatsocc_b
           sflight~seatsmax_f
           sflight~seatsocc_f
           sbook~class
      INTO TABLE it_xx
      FROM spfli INNER JOIN sflight
      ON spfli~carrid = sflight~carrid
      AND spfli~connid = sflight~connid
      INNER JOIN sbook
      ON spfli~carrid = sbook~carrid
      AND spfli~connid = sbook~connid.
    Thanks,
    Yawa

  • My iPhone 4 won't connect to our WiFi at home, but will at other WiFi spots.  However, my parent's iPhones work and connect just fine at home using WiFi.  I have called and talked to several people and no one seems to be able to help me.

    my iPhone 4 won't connect to our WiFi at home, but will at other WiFi spots.  However, my parent's iPhones work and connect just fine at home using WiFi.  I have called and talked to several people and no one seems to be able to help me.

    The two things to try first are renewing your network lease, forgetting the network and if that doesn't work to reset all networks. You might have tried one of these but I'll repeat the steps just to make sure.
    Settings > Wi-Fi > tap the blue arrow to the right of your network name > Renew Lease
    If that doesn't work then
    Settings > Wi-Fi > tap the blue arrow to the right of your network name > Forget this Network
    If that doesn't work
    Settings > General > Networks > Reset All Networks > then reset your iPhone by
    Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the device restart.
    I hope one of these will help.

  • Re querying a table using ONE Select

    Hello Experts,
    In one hit i want to query a Table2 2 times using oNE select query
    Lets say, i have 2 database tables  : Table1 & Table2.
    & internal tables say itab1 & itab2.
    Lets say they have fields:  fld1 fld 2 fld3 fld4.
    1) I used select * from Table1 into table itab1.
    2) Now i want to get entries from table2 based on itab-fld1 and itab2-fld4
    select * from Table2 into itab2
    FOR ALL ENTRIES in itab1
    where fld1 = itab1-fld1
      and fld2 = *itab2-fld4*  (entries based on
    itab2)
    Please suggest.,
    Thanks
    Ricky

    Hi Ricky,
    it is almost impossible to explain anything if you do not have an example of what you are going to do. When I say example, I don not mean Lets say, i have 2 database tables or Lets say they have fields but a case that everyone understands.
    If you are talking about SAP tables, give the names and fields. If you are talking about user-defined tables, decribe the process, give table and field names and characteristics (data element, domain, check table, search help...) of each field.
    For the question Now please tell me how can i write aliasing the answer is a clear F1.
    Shortly: If you write <tabname> AS <alias> or <fieldname> AS <alias> this means that <tabname> and <fieldname> identifie table and field in the database and <alias> is used for it in the query clause and for the data transfer from database to INTO data object.
    Note: It is always better to ask a question for a specific task. Getting the answer you can use it in all tasks that are comparable to the one you asked for. Asking a bla-bla question ( Lets say... ) will rarely get a useful answer.
    Regards,
    Clermens

  • Joining two tables having no common fields using one select query

    Hi Experts,
    How to join two tables which are NOT having any field in common using only one select query?
    Your help will be appreciated.
    Thank you.

    Identify a third table (or more tables) with common fields with your two tables, or change your question either removing JOIN or removing NO COMMON FIELDS, else you wont get many responses and will be left alone in outer space, as suggested by Thomas.
    If you acturally require what you written, better execute two select and merge the two internal tables merging every record from first table with every record of second table, til no more memory is available.
    Regards,
    Raymond

  • HT5824 Can I use only one (selected) folder from my documents in iCloud?

    Can I use only one (selected) folder from my documents in iCloud for MAC and PC?

    If the folders were created in the Photos app on the iPad, they don't really contain copies of the photos. They contain pointers to those photos that allow them to appear in the albums that you create. Consequently, they cannot be imported to the computer. Those albums are for local organization on the iPad only And cannot be imported.
    You should be able to select the indicidual phots that you want to import, as far as I know. I can do it on a Mac using iPhoto or Image Capture, so I assume that Windows will allow you to pick and choose which photos you want to import.
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support

  • What happened to the recently purchased icon on the left side of the playlist?  I used to could purchase songs from one of my computers and then put them on the second authorized computer by selecting recently purchased.  Is there another way?

    What happened to the recently purchased icon on the left side of the playlist?  I used to could purchase songs from one of my computers and then put them on the second authorized computer by selecting recently purchased.  Is there another way?

    Well in order to keep all the ratings, playcounts ect ect of songs in iTUnes, place the songs back into there original folders/places on the "Old harddrive" by cutting (Not copying) them from the new Harddrive. Now iTunes should report the songs has being there and have ! marks beside the imported folder from your external Harddrive.
    Now you will delet the dead/broken links (Or missing music from the new drive)in iTUnes. Goto Ottos site for a script that will remove dead links and other things here
    Just download, unzip, and run the program.
    http://ottodestruct.com/iTunes/QuickScripts.zip
    Now with everything in place and the dead links removed you will either consolidate the library or set it to copy to another Folder. If you consolidate it moves ALL your music listed in iTunes to the "iTunes Music" folder and can not be reversed. If you set it to copy, it will just copy music from its current folder to the iTunes music folder. You will have to pick the best option for you but consolidating will work best if your trying to free up space. To consolidate goto "Advanced" and select "Consolidate Library". To copy goto Edit>preferenses>Advanced tab>general sub tab and check "Copy FIles to iTunes music Folder when added to library". THis location is also where you will change the location of iTunes Music folder from your old harddrive to the new one by hitting the "Change" button above the reset button

  • ODCI error with spatial operators

    Hi group,
    I get ODCI errors with spatial operators SDO_RELATE, SDO_FILTER and SDO_WITHIN_DISTANCE (not SDO_NN) called from JDBC (Java 1.2.2).
    For example:
    SELECT A.gid FROM FeatureTable1 A, FeatureTable1 B WHERE B.gid = 3 AND SDO_RELATE(A.Geometry, B.Geometry, 'mask=ANYINTERACT querytype = WINDOW') = 'TRUE';
    Displays the error
    ORA-29902: error in executing ODCIIndexStart() routine
    Other functions such as SDO_AREA, SDO_NN work fine, though.
    Both feature tables where populated with the SDOAPI toolkit and indexed using a fixed index.
    I use a default full install of Oracle 8.1.6 on Linux RedHat 6.2.
    What's wrong? Do I need to install anything else on the server?
    Thanks for any advice.

    Hi Dan,
    There are several errors in the SampleNewToSDO.java sample. The outer polygons should be anti-clockwise, the inner polygons should be clockwise. Now that this is fixed, polygons (with or without inner polygons) do pass the validation test, but multipolygons do not.
    What's wrong with this multipolygon:
    double outerOrdArray1[] = {310, 310, 320, 310, 320, 320, 310, 320, 310, 310};
    LineString outerLineString1 = gF.createLineString(outerOrdArray1);
    double innerOrdArray1[] = {311, 311, 311, 319, 319, 319, 319, 311, 311, 311};
    LineString innerLineStrings1[] = new LineString[1];
    innerLineStrings1[0] = gF.createLineString(innerOrdArray1);
    collection[0] = gF.createPolygon((LineString)outerLineString1,
    (LineString[])innerLineStrings1);
    double outerOrdArray2[] = {410, 410, 420, 410, 420, 420, 410, 420, 410, 410};
    LineString outerLineString2 = gF.createLineString(outerOrdArray2);
    double innerOrdArray2[] = {411, 411, 411, 419, 419, 419, 419, 411, 411, 411};
    LineString innerLineStrings2[] = new LineString[1];
    innerLineStrings2[0] = gF.createLineString(innerOrdArray2);
    collection[1] = gF.createPolygon((LineString)outerLineString2,
    (LineString[])innerLineStrings2);
    geom = gF.createGeometryCollection(collection);
    Note that the sdoapi java library does not detect anything wrong with the geometry (isValid() returns true even when the order of vertices is wrong).
    Heterogenous collections are OK. Only multipolgons are wrong. To check whether the multipolygon was correctly stored in the table, I exported the table to XML using the SampleSDOtoXML.java sample. It looks good:
    <MultiPolygon>
    <Polygon name="0" srsName="0">
    <LineString name="0" srsName="0"> <CList>310.0,310.0 320.0,310.0 320.0,320.0 310.0,320.0 310.0,310.0</CList> </LineString>
    <LineString name="0" srsName="0"> <CList>311.0,311.0 311.0,319.0 319.0,319.0 319.0,311.0 311.0,311.0</CList> </LineString>
    </Polygon>
    <Polygon name="0" srsName="0">
    <LineString name="0" srsName="0"> <CList>410.0,410.0 420.0,410.0 420.0,420.0 410.0,420.0 410.0,410.0</CList> </LineString>
    <LineString name="0" srsName="0"> <CList>411.0,411.0 411.0,419.0 419.0,419.0 419.0,411.0 411.0,411.0</CList> </LineString>
    </Polygon>
    </MultiPolygon>
    So why does SDO_GEOM.VALIDATE_GEOMETRY return 13050? Is there a special vertex ordering rule for multipolygons?
    Thanks,
    Jean-Pierre
    null

Maybe you are looking for