Hi,
I have a python script where I am executing SELECT SQL statement, using Spatial filter.
The geometry I am using in Spatial filter is being passed as parameter to the python Script.
Now the Issue IS::
Query is running fine. But:
- for some of the Geometries,SQL is not giving correct output, as compared to the same SpatialFilter applied in ArcMap. E.g. SQL Return 3 where as ArcMap Returns 4. and I can clearly visualize in ArcMap, that feature is overlaping.
- So to overcome above issue, I commented out the Code of SimplifyPolygon in my Python, and I used original Geom. Now the Result is coming Correct, same as What I am getting in ArcMap.
- Now this leads to another issue.:: For some of the geometries. It gives me below error while executing SQL Query:
ArcSDESQLExecute: StreamPrepareSQL ArcSDE Extended error 1704 ORA-01704: string literal too long |
scratch = arcpy.env.scratchGDB
polyLayer = os.path.join(scratch,"inputPoly")
simplePolyLayer = os.path.join(scratch,"simplePoly")
arcpy.MakeFeatureLayer_management(parameters[0].valueAsText, polyLayer)
arcpy.cartography.SimplifyPolygon(polyLayer, simplePolyLayer,"POINT_REMOVE", 5)
count = int(arcpy.GetCount_management(simplePolyLayer).getOutput(0))
arcpy.AddMessage("count: " + str(count))
if count > 1:
#need to merge into a multipolygon then get the WKT
merged = os.path.join(scratch,"mergedPoly")
arcpy.Dissolve_management(simplePolyLayer, merged)
for row in arcpy.da.SearchCursor(merged, ["SHAPE@WKT"]):
WKT = row[0]
else:
for row in arcpy.da.SearchCursor(simplePolyLayer, ["SHAPE@WKT"]):
WKT = row[0]SQL Query code.
"SELECT count(*) FROM " +<My_FeatureClass> +" a WHERE served_id = 0 and (sdo_anyinteract(a.shape,sdo_geometry('" + WKT + "',4326)) = 'TRUE')"Let me know any solutions.
Thanks
Message was edited by: Ravindra Singh