<?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 How to use where clause with NumPyArray to Feature? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-use-where-clause-with-numpyarray-to-feature/m-p/293338#M22704</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a NumPyArray that I would like to use a where clause .&amp;nbsp; My workflow is if my first NumPyArray to feature fails then run another one with a where clause of data that has come into a json web-service in the past 10 minutes.&amp;nbsp;&amp;nbsp;&amp;nbsp; I would ideally like to implement a where clause in both scenarios.&amp;nbsp; Here is what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arr = np.array(items,dtype=dt)
sr = arcpy.SpatialReference(4326)
NumPyArray = arcpy.da.NumPyArrayToFeatureClass(arr, fc, ['longitudeshape', 'latitudeshape'], sr)
#I would like to use a five minute whereclause here for my Date field.

cursor = arcpy.SearchCursor(fc,"""Date BETWEEN '2014-02-16 16:53:25' AND&amp;nbsp; '2015-02-17 16:53:25'""" )
for row in cursor:
 print(row.getValue("Date"))




if row.getValue("Date") &amp;lt; datetime.datetime.now():
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "true"
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "excecute numpy array for a 10 minute window."&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:06:42 GMT</pubDate>
    <dc:creator>GeoffreyWest1</dc:creator>
    <dc:date>2021-12-11T14:06:42Z</dc:date>
    <item>
      <title>How to use where clause with NumPyArray to Feature?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-where-clause-with-numpyarray-to-feature/m-p/293338#M22704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a NumPyArray that I would like to use a where clause .&amp;nbsp; My workflow is if my first NumPyArray to feature fails then run another one with a where clause of data that has come into a json web-service in the past 10 minutes.&amp;nbsp;&amp;nbsp;&amp;nbsp; I would ideally like to implement a where clause in both scenarios.&amp;nbsp; Here is what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arr = np.array(items,dtype=dt)
sr = arcpy.SpatialReference(4326)
NumPyArray = arcpy.da.NumPyArrayToFeatureClass(arr, fc, ['longitudeshape', 'latitudeshape'], sr)
#I would like to use a five minute whereclause here for my Date field.

cursor = arcpy.SearchCursor(fc,"""Date BETWEEN '2014-02-16 16:53:25' AND&amp;nbsp; '2015-02-17 16:53:25'""" )
for row in cursor:
 print(row.getValue("Date"))




if row.getValue("Date") &amp;lt; datetime.datetime.now():
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "true"
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "excecute numpy array for a 10 minute window."&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:06:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-where-clause-with-numpyarray-to-feature/m-p/293338#M22704</guid>
      <dc:creator>GeoffreyWest1</dc:creator>
      <dc:date>2021-12-11T14:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use where clause with NumPyArray to Feature?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-use-where-clause-with-numpyarray-to-feature/m-p/293339#M22705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For starters, I encourage you to read up on and use cursors from the &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-data-access/what-is-the-data-access-module-.htm"&gt;data access module&lt;/A&gt;.&amp;nbsp; The data access cursors are much more robust and efficient than the older style cursors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Querying dates and times is highly specific to the storage format.&amp;nbsp; Have you read the&lt;A href="http://desktop.arcgis.com/en/desktop/latest/map/working-with-layers/sql-reference-for-query-expressions-used-in-arcgis.htm"&gt; SQL reference for query expressions used in ArcGIS&lt;/A&gt;, particularly the section on &lt;A href="http://desktop.arcgis.com/en/desktop/latest/map/working-with-layers/sql-reference-for-query-expressions-used-in-arcgis.htm#GUID-85C03D85-F4A5-48FC-8E8C-3F79919430DB"&gt;Dates and time&lt;/A&gt;?&amp;nbsp; What storage format are you working with?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 18:16:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-use-where-clause-with-numpyarray-to-feature/m-p/293339#M22705</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-04-07T18:16:21Z</dc:date>
    </item>
  </channel>
</rss>

