<?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: Arcpy Intersect_analysis - cannot use layers as input in a script in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644073#M21519</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two million is a lot of features. Yes, the new behind the scenes tiling is awesome because before they were doing that it was impossible do to an overlay of that size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Merge is going to be a dramatically faster than deleting fields, but you're right, messing with field maps in Python can be a lot of work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 May 2015 05:44:33 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2015-05-06T05:44:33Z</dc:date>
    <item>
      <title>Arcpy Intersect_analysis - cannot use layers as input in a script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644068#M21514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I prototyped a tool in ArcMap using a multiple intersect of a point featureclass with several polygon layers. Basically a multiple point-in-polygon operation.&amp;nbsp; It is much faster now that partitioning is automatically invoked at 10.3 (or some earlier version).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To avoid all the extra polygon fields I turn off all the additional fields in the layer properties. I do get extra FID_&amp;lt;fc&amp;gt; fields that I did not ask for but these are easy enough to delete with a list = [f.name for f in arcpy.Listfields(fc,'FID_*')] in the delete tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now I want to put this in a script... I take the tool as a snippet and put it in a stand-alone script.&amp;nbsp; I need to define the layers, which I do using arcpy.management.MakeFeatureLayer() adding a Fieldinfo() object with all the fields hidden or visible. (the opposite of visible is..?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;the overlay produces a point layer BUT last polygon layer is repeated n times, the other (n-1) layers are missing, the process takes far too short a time and the result is nonsense, but with no error messages. I was hoping to use the rename facility in fieldinfo (it does not rename the alias so It needs an extra step) but since nothing works that was too much of a stretch. ie why got to the trouble of using fieldInfo anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Intersect will properly populate FID_&amp;lt;fc_name&amp;gt; fields if I use the option 'ONLY_FID' on featureclasses, but then I have the tedious task of adding the fields and populating them myself. JoinField is not suitable for 2 million records. Maye MakeSQLQuery would be better if I had to go down that route, add indexes, build a complex sql expression. Oh, that won't work, because all the tables have to be in the same database, unlike spatialite.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only workaround I can think of is to leave ALL the fields on with a list of featureclasses, not layers,&amp;nbsp; and then run a humongous delete function afterwards instead of a tidy fieldinfo beforehand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 22:51:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644068#M21514</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2015-05-05T22:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Intersect_analysis - cannot use layers as input in a script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644069#M21515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kim&lt;/P&gt;&lt;P&gt;I am having trouble understanding this step&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"Now the last layer is repeated n times, the process takes far too short a time and the result is nonsense, but with no error messages. I was hoping to use the rename facility in fieldinfo (it does not rename the alias so It needs an extra step) but since nothing works that was too much of a stretch."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;can you elaborate a bit or show an example...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 23:09:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644069#M21515</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-05-05T23:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Intersect_analysis - cannot use layers as input in a script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644070#M21516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the concern. I am certain that its a bug, and I am just grumpy and want to alert others when they hit the same thing.&lt;/P&gt;&lt;P&gt;Suppose I have an address point layer and I want to assign a suburb and postcode from some polygon layers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D:/data/NZFireService/nzsuburb.gdb/nz_localities Keep fields: ['suburb_4th', 'major_name']&lt;/P&gt;&lt;P&gt;Fieldinfo: nz_localities SUBURB_4TH SUBURB_4TH VISIBLE #;MAJOR_NAME MAJOR_NAME VISIBLE #&lt;/P&gt;&lt;P&gt;List fields: [u'OBJECTID', u'Shape', u'POSTCODE', u'ROUND_NAME', u'MAIL_TOWN', u'Shape_Length', u'Shape_Area']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D:/data/NZPost/PostCode/PNF.gdb/PostCode Keep fields: ['postcode']&lt;/P&gt;&lt;P&gt;Fieldinfo: PostCode POSTCODE POSTCODE VISIBLE #&lt;/P&gt;&lt;P&gt;List fields: [u'OBJECTID', u'Shape', u'POSTCODE', u'ROUND_NAME', u'MAIL_TOWN', u'Shape_Length', u'Shape_Area']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Processing overlays ... ['e:/crs/presentgdb/roadadd.gdb/addhist', 'lay_nz_localities', 'lay_PostCode']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0:00:51.979000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[u'OBJECTID', u'SHAPE', u'FID_addhist', u'sad_id', u'house_number', u'rna_id', u'range_high', u'rcl_id', u'et_created', u'sufi', u'unofficial_flag', u'range_low', u'et_edited', u'status', u'roadtype', u'location', u'status_name', u'road_name', u'road_type', u'road_suffix', u'full_road_name', u'FID_PostCode', u'POSTCODE', u'ROUND_NAME', u'MAIL_TOWN', u'FID_PostCode_1', u'POSTCODE_1', u'ROUND_NAME_1', u'MAIL_TOWN_1']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is - No suburbs! Just the postcode fields twice. If I have three polygon layers they are added 3 times and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My workaround was to use full featureclass paths with ALL and run a couple of list comprehensions afterwards to generate a large list of fields to delete. The time ballooned out to 2 hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then ran the new AlterField command that lets me rename a field and the alias. The fieldInfo object appears to set a new alias but does not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 03:31:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644070#M21516</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2015-05-06T03:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Intersect_analysis - cannot use layers as input in a script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644071#M21517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;It will properly populate FID_&amp;lt;fc_name&amp;gt; fields if I use the option 'ONLY_FID' on featureclasses, but then I have the tedious task of adding the fields and populating them myself.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I don't think it's that tedious if you use ONLY_FID, then add joins, then run Merge with a field map to get just the fields you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 05:15:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644071#M21517</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-06T05:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Intersect_analysis - cannot use layers as input in a script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644072#M21518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add Joins? You must be only using a sample. That would fail for 2 million records in my experience. The reason I went back to the overlay operations is because partitioning has been implemented. Before that it wasn't an option.&lt;/P&gt;&lt;P&gt;Since merge is not part of the partition function I wonder how long it might take.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My complaint is why do I have to go to all this trouble since the help clearly says that layers are a valid input. This thread is to warn that they are not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Making a fieldmap is very tricky if I want to automate it because I would need to automate building the field maps.&lt;/P&gt;&lt;P&gt;My script is already complicated. It has gone from a single line Intersect tool to 140 odd lines and its not a general tool even then.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 05:38:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644072#M21518</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2015-05-06T05:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Intersect_analysis - cannot use layers as input in a script</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644073#M21519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two million is a lot of features. Yes, the new behind the scenes tiling is awesome because before they were doing that it was impossible do to an overlay of that size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Merge is going to be a dramatically faster than deleting fields, but you're right, messing with field maps in Python can be a lot of work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 05:44:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-intersect-analysis-cannot-use-layers-as/m-p/644073#M21519</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-06T05:44:33Z</dc:date>
    </item>
  </channel>
</rss>

