<?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: Query Layer on PostGRES database using Intersection on local shapefile? in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/query-layer-on-postgres-database-using/m-p/92023#M5443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No, you can't use SQL to query a data object which isn't in the database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Desktop could of course execute such a query, but it would be done in the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS execution space (iterating the shapefile rows), and the shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;access wouldn't be done with SQL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your PG database was enabled as enterprise geodatabase (had ArcSDE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the SDE.ST_GEOMETRY type installed), then it would be trivial to use&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS to load the shapefile into PostgreSQL, but without that you'll need&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to rely on non-Esri tools like gdal or 'shp2pgsql'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the temp table is small enough, you could union the geometries, generate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;well-known text from the result, and use that as a WHERE clause constraint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(that would be more efficient than a compound query anyway).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Sep 2013 10:04:03 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2013-09-06T10:04:03Z</dc:date>
    <item>
      <title>Query Layer on PostGRES database using Intersection on local shapefile?</title>
      <link>https://community.esri.com/t5/data-management-questions/query-layer-on-postgres-database-using/m-p/92022#M5442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a large amount of data stored in a PostGRES database, that I have been able to access using a Query Layer through ArcMap.&amp;nbsp; My first question is &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;a) Can the database be spatially queried using a local shapefile - e.g. SELECT FROM &amp;lt;PostGRES Table&amp;gt; WHERE &amp;lt;PostGRES geometry&amp;gt; INTERSECTS &amp;lt;localshapefile located in my C:\Temp&amp;gt;.&amp;nbsp; I know that's not the actual syntax, but the main point is whether I can use a local file to do the querying or if it needs to be loaded into the PostGRES database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and if this is possible - what would the proper syntax look like? Probably involving ST_INTERSECTS()...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2013 23:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/query-layer-on-postgres-database-using/m-p/92022#M5442</guid>
      <dc:creator>JohnathanKool</dc:creator>
      <dc:date>2013-09-05T23:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Query Layer on PostGRES database using Intersection on local shapefile?</title>
      <link>https://community.esri.com/t5/data-management-questions/query-layer-on-postgres-database-using/m-p/92023#M5443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No, you can't use SQL to query a data object which isn't in the database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Desktop could of course execute such a query, but it would be done in the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS execution space (iterating the shapefile rows), and the shapefile&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;access wouldn't be done with SQL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your PG database was enabled as enterprise geodatabase (had ArcSDE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the SDE.ST_GEOMETRY type installed), then it would be trivial to use&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS to load the shapefile into PostgreSQL, but without that you'll need&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to rely on non-Esri tools like gdal or 'shp2pgsql'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the temp table is small enough, you could union the geometries, generate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;well-known text from the result, and use that as a WHERE clause constraint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(that would be more efficient than a compound query anyway).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Sep 2013 10:04:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/query-layer-on-postgres-database-using/m-p/92023#M5443</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2013-09-06T10:04:03Z</dc:date>
    </item>
  </channel>
</rss>

