<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ST_INTERSECTS as a query def in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624209#M35287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not too sure which forum to post this question in, so had a stab in here.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have two featureclasses in a 10 geodatabase in Oracle, stored with the defailt SDO_GEOMETRY, lets say they are called "MYSCHEMA.LAYER1" and "MYSCHEMA.LAYER2"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to to put a query def in ArcMap on layer 1 to only show those features that intersect layer 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried a couple things like: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;sde.st_intersects(shape, layer2.shape)
or
sde.st_intersects(layer1.shape, layer2.shape)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;but get invalid syntax. Have had a look around the web help but it is a little light and concentrates on sql statements as if run from a sql client i.e. with all the select from where etc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:35:16 GMT</pubDate>
    <dc:creator>AnthonyFarndon</dc:creator>
    <dc:date>2021-12-12T02:35:16Z</dc:date>
    <item>
      <title>ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624209#M35287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not too sure which forum to post this question in, so had a stab in here.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have two featureclasses in a 10 geodatabase in Oracle, stored with the defailt SDO_GEOMETRY, lets say they are called "MYSCHEMA.LAYER1" and "MYSCHEMA.LAYER2"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to to put a query def in ArcMap on layer 1 to only show those features that intersect layer 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried a couple things like: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;sde.st_intersects(shape, layer2.shape)
or
sde.st_intersects(layer1.shape, layer2.shape)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;but get invalid syntax. Have had a look around the web help but it is a little light and concentrates on sql statements as if run from a sql client i.e. with all the select from where etc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:35:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624209#M35287</guid>
      <dc:creator>AnthonyFarndon</dc:creator>
      <dc:date>2021-12-12T02:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624210#M35288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can't use Esri's ST_GEOMETRY operators on Oracle's SDO_GEOMETRY datatype.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You need to either use SDE.ST_GEOMETRY storage (which is the usual default for &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcSDE 10) or use Oracle's operators.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;While it's possible to use query definition to establish this sort of query, it would be&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;far easier to get the SQL right in a view first, then either register the view or port&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;it to ArcGIS layer definition, or use Query Layers to access the view (or SQL). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any way you cook it, the SQL would have to test the result of the spatial operator&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function, like this SELECT I created for a functionality test at a client site with &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;corrupted permissions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
SELECT objectid 
FROM poly_stg t
WHERE sde.ST_Intersects(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sde.ST_GeomFromText('POLYGON ((0 0,5 0,5 5,0 5,0 0))',2),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.shape) = 1;
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In your case you'd need to refer to both tables in a single statement as in this&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//006z00000059000000.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;documentation&lt;/A&gt;&lt;SPAN&gt; example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 
SELECT sa.id SA_ID, hs.id HS_ID
FROM SENSITIVE_AREAS sa, HAZARDOUS_SITES hs
WHERE sde.st_intersects (sde.st_buffer (hs.location, .1), sa.zone) = 1
ORDER BY sa.id;
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that both tables must share the same SRID, or the comparison operator will&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;always fail silently.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:35:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624210#M35288</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-12-12T02:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624211#M35289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry my bad, the featureclasses have the geom set to default which is ST_GEOMETRY not SDO_(and all are in same SRID)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Had missed out the = 1 in my sql, however as said before am afraid the SELECT, FROM, WHERE examples don't really help much for a layer def query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Trying &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;sde.st_intersects(shape, layer2.shape) = 1&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;throws up a different error now, about an invalid identifier for layer2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;SELECT * FROM MYLAYER1 mla, MYLAYER2 mlb WHERE sde.st_intersects(mla.shape, mlb.shape) = 1&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;throws up invalid operator error&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried other ST operations as a def query which *DO* work e.g. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;sde.st_area(shape) &amp;gt;= 10000&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;so the problem is correct syntax for a def query layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Creating views is not an option so I'll try the query layer approach in the absence of being able to do this via a layer query def.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Tony&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 15:28:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624211#M35289</guid>
      <dc:creator>AnthonyFarndon</dc:creator>
      <dc:date>2011-05-31T15:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624212#M35290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I suggested you get comfortable with the SQL first because you need to *really* understand the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;query before using the ArcGIS GUI, to intuit what needs to be placed where.&amp;nbsp; The ArcSDE API is &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;quite clear on SE_QUERYINFO object components, but the Layer Properties form has three tabs&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;that the components of the query reside -- Joins &amp;amp; Relates, Fields, and Definition Query. The task &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is to place the additional table in Joins, the join constraint in Definition Query, and restrict the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;result to just one spatial column in fields, but it doesn't look like GUI will give you the flexibility&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to use a SQL join constraint (ArcObjects might).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A view is your best bet, but with that off the table, Definition Query is probably next best.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It may be challenging to write your query so that the join will perform well when the spatial&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;constraint is applied for rendering.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Keep in mind that a "*" column list is pure poison when the result can only contain one&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;geometry column -- explicitly referring to the columns with table alias will help document&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;your procedure.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 16:35:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624212#M35290</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2011-05-31T16:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624213#M35291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I think I need to spend a bit more time with sql....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 May 2011 19:03:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624213#M35291</guid>
      <dc:creator>AnthonyFarndon</dc:creator>
      <dc:date>2011-05-31T19:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624214#M35292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I, too, would like to perform a similar operation using a Query Layer against an Oracle SDE instance and ST_Geometry.&amp;nbsp; I want to create a selection set of one feature class that intersects the features of another feature class.&amp;nbsp; The syntax in the documenation has not been helpful.&amp;nbsp; It says:&amp;nbsp; sde.st_intersects (g1 sde.st_geometry, g2 sde.st_geometry).&amp;nbsp; What does g1 and g2 represent?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the statement I have been trying to use with no luck so far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;select * from S_WO_OPS_EGIS.FHP_AERIALSURVEY where sde.st_intersects (S_WO_OPS_EGIS.FHP_AERIALSURVEY, S_WO_OPS_EGIS.ADMINISTRATIVEFOREST) = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm missing something, but I don't know what.&amp;nbsp; I'm not very SQL saavy and could use some hand holding here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2013 16:20:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624214#M35292</guid>
      <dc:creator>ChrisStrobl</dc:creator>
      <dc:date>2013-01-31T16:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624215#M35293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Look at the examples above -- you must specify both tables after the FROM,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the specific columns in the operator function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You must also specify all the returned columns (vice '*'), since only one&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;geometry can be returned in the result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please put all SQL in CODE blocks (the '#' pick in the WYSIWYG editor UI)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jan 2013 21:39:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/624215#M35293</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2013-01-31T21:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/1028085#M43079</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1060"&gt;@VinceAngelo&lt;/a&gt;, can a spatial SQL query be written against a file geodatabase using a definition query within ArcGIS Pro (obviously not in clause mode)? What would the syntax look like?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:55:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/1028085#M43079</guid>
      <dc:creator>feralcatcolonist_old</dc:creator>
      <dc:date>2021-02-18T15:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: ST_INTERSECTS as a query def</title>
      <link>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/1028970#M43090</link>
      <description>&lt;P&gt;There are no spatial operators in the basic SQL supported on file geodatabase, so no, that is not an option. It would be an option in a true database source.&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 00:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/st-intersects-as-a-query-def/m-p/1028970#M43090</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-02-22T00:21:04Z</dc:date>
    </item>
  </channel>
</rss>

