<?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: best way to deal with sql geometry column with multi geo types? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576326#M45203</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the lack of detail earlier,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the traceback report,&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&lt;A href="https://community.esri.com/"&gt;Path\ExtractDataToCSV.py&lt;/A&gt;", line 37, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; extract = in_connection.execute(sql)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects\arcobjects.py", line 27, in execute&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._arc_object.Execute(*gp_fixargs(args)))&lt;/P&gt;&lt;P&gt;AttributeError: ArcSDESQLExecute: SreamBindOutputColumn ArcSDE Error -65 \uda10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this happens when I include the geometry column that has multiple geometry types. Without it, the table loads fine. I can load the geometry type but I have to do something like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"cast(GeoLocation as varchar(8000)) as GeoLocation"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will load it as string but still I have to work a process to convert them as geometries. Wondering if there is a simpler or better way of reading sql tables like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 06 Dec 2015 22:13:13 GMT</pubDate>
    <dc:creator>ChrisPedrezuela</dc:creator>
    <dc:date>2015-12-06T22:13:13Z</dc:date>
    <item>
      <title>best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576324#M45201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got this sql table im working with, it has a geometry column but contains multiple geometry types,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[u'POLYGON', u'LINESTRING', u'GEOMETRYCOLLECTION', u'POINT', u'MULTILINESTRING', u'MULTIPOLYGON']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Im using arcpy's arcsdesqlexecute and I seem to be hitting an error loading the column as is, I tried converting it to varchar but I don't feel its necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts guys?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chris P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Dec 2015 20:29:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576324#M45201</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2015-12-06T20:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576325#M45202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean this page with all the warnings and no examples relating to geometry? &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/arcsdesqlexecute.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-classes/arcsdesqlexecute.htm"&gt;ArcSDESQLExecute—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Dec 2015 21:53:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576325#M45202</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-06T21:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576326#M45203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the lack of detail earlier,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the traceback report,&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&lt;A href="https://community.esri.com/"&gt;Path\ExtractDataToCSV.py&lt;/A&gt;", line 37, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; extract = in_connection.execute(sql)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects\arcobjects.py", line 27, in execute&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._arc_object.Execute(*gp_fixargs(args)))&lt;/P&gt;&lt;P&gt;AttributeError: ArcSDESQLExecute: SreamBindOutputColumn ArcSDE Error -65 \uda10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this happens when I include the geometry column that has multiple geometry types. Without it, the table loads fine. I can load the geometry type but I have to do something like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"cast(GeoLocation as varchar(8000)) as GeoLocation"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will load it as string but still I have to work a process to convert them as geometries. Wondering if there is a simpler or better way of reading sql tables like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Dec 2015 22:13:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576326#M45203</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2015-12-06T22:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576327#M45204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;from Stack only one with -65 error code using&amp;nbsp; &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;ArcSDESQLExecute as query&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;A href="http://gis.stackexchange.com/questions/138504/arcsdesqlexecute-arcsde-error-65" title="http://gis.stackexchange.com/questions/138504/arcsdesqlexecute-arcsde-error-65"&gt;arcpy - ArcSdeSqlExecute ArcSDE Error -65 - Geographic Information Systems Stack Exchange&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Dec 2015 23:01:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576327#M45204</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-06T23:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576328#M45205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please post the SQL query and DBMS you are using? I found the same error when running STAsText() from SQL Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One option to work around this may be to turn your query into a &lt;A href="http://resources.arcgis.com/EN/HELP/MAIN/10.2/index.html#//00170000006r000000"&gt;Query layer&lt;/A&gt; and utilize the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018w00000011000000"&gt;SearchCursor &lt;/A&gt;to loop through the rows.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Dec 2015 15:48:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576328#M45205</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2015-12-07T15:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576329#M45206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ever since ArcSDE faded away as a standalone product and got integrated into ArcGIS for Server, at least from a marketing and licensing perspective, I have found some of the worthwhile documentation from earlier releases doesn't move forward.&amp;nbsp; I believe the &lt;A href="http://help.arcgis.com/en/geodatabase/10.0/sdk/arcsde/api/capi/returncodes_incl.htm"&gt;ArcSDE 10.0 C API Return codes &lt;/A&gt;are still mostly accurate for ArcGIS 10.2.x and ArcGIS 10.3.x:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;SE_INVALID_POINTER (-65)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Returned by functions that are passed pointers to data that are either NULL or invalid.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If you are trying to export geographic data as geographic data from an enterprise geodatabase, ArcSDESQLExecute is the wrong tool.&amp;nbsp; The tool doesn't work with native spatial data types returned from various DBMSes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 19:53:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576329#M45206</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-12-08T19:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576330#M45207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct. ArcSDESQLExecute is written using the 'old' SDE libraries which requires the spatial table to be registered with SDE (Enterprise GDB) and for the shape field to only contain one geometry type.&amp;nbsp; From what I can tell from the info provided, Query Layers are probably the way to go.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 21:06:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576330#M45207</guid>
      <dc:creator>KenHartling</dc:creator>
      <dc:date>2015-12-08T21:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576331#M45208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks heaps for all the feedback guys. Since I don't want to create query layers in an mxd, I could just probably use &lt;SPAN class="n"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;MakeQueryLayer_management&lt;/SPAN&gt; and do something with the records while in_memory I guess. But I just want to validate if "GeometryCollection" type can be recognized? In my case this type is just composed of multiple polygon so pretty much like a "MultiPolygon".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 22:59:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576331#M45208</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2015-12-08T22:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576332#M45209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, Esri does not supported the GeometryCollection type yet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/desktop/latest/manage-data/gdbs-in-sql-server/data-types-sqlserver.htm" title="https://desktop.arcgis.com/en/desktop/latest/manage-data/gdbs-in-sql-server/data-types-sqlserver.htm"&gt;SQL Server data types supported in ArcGIS—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;ArcGIS does not support the following geometry subtypes:&lt;/EM&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;CircularString&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;CompoundCurve&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;CurvePolygon&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;GeometryCollection&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 23:05:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576332#M45209</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2015-12-08T23:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576333#M45210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to see if the Data Interoperability extension can solve your problem.&lt;/P&gt;&lt;P&gt;It doesn't care about mixed geometry types.&lt;/P&gt;&lt;P&gt;If you can get your data to us we'll take a look.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 19:53:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576333#M45210</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2015-12-09T19:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576334#M45211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have pretty much the same question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a view which includes geometry column and is actually a combination of around 20 layers. Problem is these are mixed spatial types (point, line, polygon).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking to either create thee separate query layers that separate based upon geometry type or create 3 Separate db views from within SQL server management studio.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best approach and anyone familiar with the optimal SQL to filter based on the geometry type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance will be a concern and requirement is to serve this up to server&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 May 2017 11:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576334#M45211</guid>
      <dc:creator>SimonJackson</dc:creator>
      <dc:date>2017-05-04T11:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576335#M45212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would say if you have a view that combines 20 layers and has a mixed geometry column, performance has been mostly written off already.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plenty of thoughts/ideas come to mind.&amp;nbsp; In random order:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I can't speak to SQL Server 2016, but I believe up through SQL Server 2012 that spatial indexes could not be applied to indexed views.&amp;nbsp; Even if the underlying 20 layers have spatial indexes applied, having a mixed geometry view without spatial indexes will make the performance quite poor.&lt;/LI&gt;&lt;LI&gt;Are geometries mixed in each or any of the 20 layers that make up the current view?&amp;nbsp; If not, it might be better to build new views or query layers directly from subsets of those 20 layers rather than combining them simply to filter them.&lt;/LI&gt;&lt;LI&gt;Functionally, since database views can be registered in the geodatabase starting at 10.5, I think that gives a slight edge to data views over query layers, especially since these views seem like they will stick around for a while and possibly support multiple services.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know how to eke performance out of the situation you describe.&amp;nbsp; Functionally, I would lean toward creating database views and registering them with the geodatabase, if you are using 10.5+.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 May 2017 16:03:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576335#M45212</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-05-04T16:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: best way to deal with sql geometry column with multi geo types?</title>
      <link>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576336#M45213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joshua, on phone right now so excuse short response&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"database views can be registered in the geodatabase starting at 10.5"&lt;/P&gt;&lt;P&gt;I need to do some reading on this and the pros and cons of registering a spatial view created at the DBMS level (or with the "create database view tool").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance is definitely going to be an issue and might have to come up with a plan B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 May 2017 22:01:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/best-way-to-deal-with-sql-geometry-column-with/m-p/576336#M45213</guid>
      <dc:creator>SimonJackson</dc:creator>
      <dc:date>2017-05-04T22:01:12Z</dc:date>
    </item>
  </channel>
</rss>

