<?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: calculating polyline length in polygons in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455634#M35822</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I agree 5 hours is &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;far&lt;/SPAN&gt;&lt;SPAN&gt; too long.&amp;nbsp; I have a rule of thumb that states "If a single process takes longer than a cup of coffee, then interrupt it and find a better way". I will not be able to produce benchmarks with times longer that a cup of coffee, life is too short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I now remember my recent 'better way' was to use a Workstation intersect which only took a few minutes, I have to admit that an ArcGIS intersect failed first on the same data and since I have a better way I was quick to take that rather than research the issue. I was already using a file geodatabase that is indexed and cleaned. It was already on a local high speed disk drive. It failed quickly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The idea of looping through the features using a script seems likely to take a very long time because of the overhead of starting an intersect process for each likely polygon/polyline combination. You would have to search to find which combinations to compare and this needs a spatial index to be efficient but even then it would be slow. Python is supposed to be a 'glue' of fast optimised tools, not the tool itself. So, alternative tools seem the best course.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried another intersect in ArcGIS 10.0 SP1 on an Acer laptop with Windows 7, i5 Intel 4 core processor, 4GB of memory&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygons 42,496, polylines 221,896, tolerance 1 metre, time 5min 43sec.&amp;nbsp; Nothing wrong with that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to your data not performing. Clean the layer, maybe generalize a little for the purpose of the overlay. Are they both in a local projection? In a local file geodatabase? Get out of SDE. On a local disk? Output to a local file geodatabase. Strip off unnecessary fields. Is your scratch workspace a file geodatabase (not just a folder)? Do you have any unusually large features? Split them up. Multi-parts are not good for geoprocessing, split into singleparts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Feb 2011 20:12:11 GMT</pubDate>
    <dc:creator>KimOllivier</dc:creator>
    <dc:date>2011-02-23T20:12:11Z</dc:date>
    <item>
      <title>calculating polyline length in polygons</title>
      <link>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455631#M35819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to calculate line length in polygons. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the polygon file is large ~50,000, the polyline file are roads. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with smaller file sizes I used arcgis 'intersect' and then did tabular analysis. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the file size created by doing intersection is going to be too big to handle with this approach. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Feb 2011 19:39:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455631#M35819</guid>
      <dc:creator>davidwelch</dc:creator>
      <dc:date>2011-02-22T19:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: calculating polyline length in polygons</title>
      <link>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455632#M35820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;50K polygons? Surely not too large, I regularly run intersects with much larger numbers, 100 times larger. If it is too large then partition the dataset into smaller sets with a selection or definition first and combine the results. At 10.0 I understood that the partitioning is automatic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Feb 2011 21:22:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455632#M35820</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2011-02-22T21:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: calculating polyline length in polygons</title>
      <link>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455633#M35821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;perhaps the file will be manageable, however, I started the process on the 50,000 k file and it ran for about 5 hours today. .. still not finished. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; I did a test with 34 polygons and the resulting file was 5000 records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;at this rate the file on my 50,000 k file will have more than a million records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;a program that could intersect then tabulate each record would work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unfortunately, I have trouble programming myself out of a box... let alone doing something useful. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Feb 2011 23:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455633#M35821</guid>
      <dc:creator>davidwelch</dc:creator>
      <dc:date>2011-02-22T23:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculating polyline length in polygons</title>
      <link>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455634#M35822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I agree 5 hours is &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;far&lt;/SPAN&gt;&lt;SPAN&gt; too long.&amp;nbsp; I have a rule of thumb that states "If a single process takes longer than a cup of coffee, then interrupt it and find a better way". I will not be able to produce benchmarks with times longer that a cup of coffee, life is too short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I now remember my recent 'better way' was to use a Workstation intersect which only took a few minutes, I have to admit that an ArcGIS intersect failed first on the same data and since I have a better way I was quick to take that rather than research the issue. I was already using a file geodatabase that is indexed and cleaned. It was already on a local high speed disk drive. It failed quickly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The idea of looping through the features using a script seems likely to take a very long time because of the overhead of starting an intersect process for each likely polygon/polyline combination. You would have to search to find which combinations to compare and this needs a spatial index to be efficient but even then it would be slow. Python is supposed to be a 'glue' of fast optimised tools, not the tool itself. So, alternative tools seem the best course.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried another intersect in ArcGIS 10.0 SP1 on an Acer laptop with Windows 7, i5 Intel 4 core processor, 4GB of memory&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygons 42,496, polylines 221,896, tolerance 1 metre, time 5min 43sec.&amp;nbsp; Nothing wrong with that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So to your data not performing. Clean the layer, maybe generalize a little for the purpose of the overlay. Are they both in a local projection? In a local file geodatabase? Get out of SDE. On a local disk? Output to a local file geodatabase. Strip off unnecessary fields. Is your scratch workspace a file geodatabase (not just a folder)? Do you have any unusually large features? Split them up. Multi-parts are not good for geoprocessing, split into singleparts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Feb 2011 20:12:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-polyline-length-in-polygons/m-p/455634#M35822</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2011-02-23T20:12:11Z</dc:date>
    </item>
  </channel>
</rss>

