My question involves handling data types, particularly of strings, points and tuples. I start with a single object (I think I can say feature object as it has geometry on top of other attributes) selected by location in a feature layer. I then try to access a point geometry from that object using the SHAPE@TRUECENTROID token within a arcpy.da.SearchCurser() method and set that Point Geometry equal to a variable. I then call that variable within the queryPointAndDistance() function as my input Point or PointGeometry, but Arcpy gives me the following at the end of the error message error.
File "<expression>", line 1, in <module> File "<string>", line 22, in Strike ValueError: (612744.9906049052, 3417217.9973794315)
It appear that it does not recognize my function as either a Point or PointGeometry. Where does the output from the curser function become something different (a different type perhaps)?
This post python - ArcPy QueryPointAndDistance: Incorrect Lengths? - Stack Overflow suggested to me that by setting a variable equal to a SearchCurser, that variable would equal the geometry object specified. Is there any difference between the logic used there when the he gets the line geometry and what I am doing that I did not catch?
The problematic part of the code is as follows:
If it helps answer the question, this script is within a def in the codeblock of a CalculateField_management() method so 'shape' = the geometry of the record being calculated, and PairedCheck6 is my feature layer with one selected record.
codeblock <SPAN class="operator token">=</SPAN> <SPAN class="string token">""</SPAN>"<SPAN class="keyword token">def</SPAN> Strike<SPAN class="punctuation token">(</SPAN>shape<SPAN class="punctuation token">,</SPAN> seed<SPAN class="punctuation token">,</SPAN> fid<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token"># PairedCheck6 = feature layer with single selection</SPAN>
cursorResult <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'PairedCheck6'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'SHAPE@TRUECENTROID'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>next<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
centroid <SPAN class="operator token">=</SPAN> None
<SPAN class="keyword token">if</SPAN> len<SPAN class="punctuation token">(</SPAN>cursorResult<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">></SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN>
centroid <SPAN class="operator token">=</SPAN> cursorResult
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="string token">'5000'</SPAN>
<SPAN class="punctuation token">(</SPAN>pointGeometry<SPAN class="punctuation token">,</SPAN> distance<SPAN class="punctuation token">,</SPAN> minDistance<SPAN class="punctuation token">,</SPAN> isCentroidRight<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN> shape<SPAN class="punctuation token">.</SPAN>queryPointAndDistance<SPAN class="punctuation token">(</SPAN> centroid<SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">False</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="string token">""</SPAN>"<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I can show more of the code if requested, but I did not want to ask anyone to look through more than is required.