<?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 Re: SQL Geometry Query similar to Select by Centroid in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256528#M14656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can say the query below does what I was looking for, but as mentioned, the performance on a large dataset is poor.&amp;nbsp; When trying to execute on our entire parcel dataset (�??100,000 records) SQL Server (2008 R2) times out.&amp;nbsp; If executed on a smaller dataset, the results are as desired.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the input from everyone!&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;(polygonA.Shape.STCentroid().STIntersects(polygonB.Shape) = 1)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2014 11:50:30 GMT</pubDate>
    <dc:creator>mpboyle</dc:creator>
    <dc:date>2014-05-15T11:50:30Z</dc:date>
    <item>
      <title>SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256523#M14651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know if it's possible to query SQL geometry by something like 'centroid of polygon'...similar to ArcMap's select by location?&amp;nbsp; I'm trying to do this within SQL Server Management Studio, not ArcMap/ArcCatalog in order to produce a SQL view.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have two polygon layers that are not exactly coincident and if I use STIntersects on the target polygon I get two different values where the polygons are not coincident. I was wondering if there is a query that can be used instead of STIntersects that would be similar to selecting the centroid of the polygon...?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 19:16:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256523#M14651</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2014-05-14T19:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256524#M14652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Take a look at the Geoprocessing Select By Location tool.&amp;nbsp; HAVE_THEIR_CENTER_IN should be what you want.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 19:25:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256524#M14652</guid>
      <dc:creator>LanceShipman</dc:creator>
      <dc:date>2014-05-14T19:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256525#M14653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to construct the query/view within SQL Server...not within ArcMap/ArcCatalog...should have mentioned that eariler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My end goal is to have a SQL view comparing the geometries.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 19:28:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256525#M14653</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2014-05-14T19:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256526#M14654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would expect a polygon on polygon comparison of similar polygons to generate a &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;large "combinatorial expansion" issue -- If each shape slightly overlaps its neighbors&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;you could easily see an order of magnitude of expansion.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would also expect this query to be very inefficient, since there could be something on&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the order of N-squared comparisons taking place (where N is the number of polygons).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Casting one layer to point isn't&amp;nbsp; going to change the number of comparisons, but the &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;index will likely be more effective on the comparisons (provided you place the operators &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in the right order to use the index).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A query this ugly is better done once, with the resulting relationships saved in a table,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;than forcing a view to do so much work with every query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A Microsoft site would be a better location to discuss the particulars of the SQL-Server &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;implementation of geometry comparison with respect to this problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 22:26:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256526#M14654</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2014-05-14T22:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256527#M14655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have two polygon layers that are not exactly coincident and if I use STIntersects on the target polygon I get two different values where the polygons are not coincident. I was wondering if there is a query that can be used instead of STIntersects that would be similar to selecting the centroid of the polygon...?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SQL Server has an &lt;/SPAN&gt;&lt;A href="http://technet.microsoft.com/en-us/library/bb933847.aspx"&gt;STCentroid command&lt;/A&gt;&lt;SPAN&gt;. If you dynamically convert one of the two polygon layers to centroids, and than use that new layer as input for the STIntersects command in combination with the other polygon layer in the view definition, I think you are there...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Although I second Vince's remarks about possible performance issues, I think you may be fine if the layers don't exceed some 10000 records or so. I have run some tests with views containing STCentroid and STBuffer, and the performance was acceptable for layers up to about that size (Core I5 3GHz Desktop, locally installed SQL Server Express)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 07:37:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256527#M14655</guid>
      <dc:creator>MarcoBoeringa</dc:creator>
      <dc:date>2014-05-15T07:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256528#M14656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can say the query below does what I was looking for, but as mentioned, the performance on a large dataset is poor.&amp;nbsp; When trying to execute on our entire parcel dataset (�??100,000 records) SQL Server (2008 R2) times out.&amp;nbsp; If executed on a smaller dataset, the results are as desired.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the input from everyone!&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;(polygonA.Shape.STCentroid().STIntersects(polygonB.Shape) = 1)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 11:50:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256528#M14656</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2014-05-15T11:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256529#M14657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This question was &lt;/SPAN&gt;&lt;A href="http://gis.stackexchange.com/questions/96037/sql-geometry-query-similar-to-select-by-centroid"&gt;cross-posted to GSE&lt;/A&gt;&lt;SPAN&gt; -- How does you query run with 100k near-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;duplicate polygons?&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, 15 May 2014 11:54:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256529#M14657</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2014-05-15T11:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256530#M14658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was the one that posted that question in GSE &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As mentioned in above thread, the query performs poorly on large datasets with 2 sets of polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran STIntersects on a similar sized set of features using our address point layer (�??90,000 records) and SQL Server 2008 R2 did not time out and executed the view.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 11:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256530#M14658</guid>
      <dc:creator>mpboyle</dc:creator>
      <dc:date>2014-05-15T11:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Geometry Query similar to Select by Centroid</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256531#M14659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Right.&amp;nbsp; Which is why you really need to be talking to Microsoft experts&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;about Geometry performance, or break the problem into subsets and&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;use a simple join based on a driver table.&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, 15 May 2014 12:10:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-geometry-query-similar-to-select-by-centroid/m-p/256531#M14659</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2014-05-15T12:10:31Z</dc:date>
    </item>
  </channel>
</rss>

