<?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: Rotate/Scale Polylines Based on Field in Attribute Table in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509036#M5433</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a section of your attribute table.&amp;nbsp; You say "every section of your polyline" suggests to me that your polyline consists of parts which are separated out and that each "section" is part of a bigger one.&amp;nbsp; A polyline is usually represented by one record in the table and you would not see its sections unless the part was exploded into its individual parts...essentially making many polylines from the original and they may be "sections" in the sense that they originated from the parent polyline...but now they are all grown up and have move out on their own... &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Dec 2014 22:16:43 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2014-12-03T22:16:43Z</dc:date>
    <item>
      <title>Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509030#M5427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know a way or have a script that allows you to rotate and/or scale a polyline based on a field in the attribute table. I know you can do this with the editor, but I have about 1200 different lines that need to be rotated and scaled and all to different angles and sizes (based on the angle) that will be defined by a field in the attribute table. I am working with 3D polylines and have an advanced license for ArcGIS 10.2.2. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 01:14:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509030#M5427</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-03T01:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509031#M5428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want to use the Spatial Adjustment tools using an 'Affine' transformation.&amp;nbsp; search the help using that keyword and it will link you to the concepts and the tools but there is no field based option so you will have to roll out your own using the Polyline class in arcpy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 01:24:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509031#M5428</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-12-03T01:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509032#M5429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will look in to that and see if I can figure it out. Thanks for the tip!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 02:01:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509032#M5429</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-03T02:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509033#M5430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌, doesn't the Spatial Adjustment tools transform the entire featureclass (all features) the same way? The help&amp;nbsp; (&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//01m80000003q000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//01m80000003q000000"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; ) may assist in programming the formula to apply for each polygon based on the attributes for that specific polygon. I just wonder when using rotation, will you rotate the feature around the center? And with 3D data things get a little more interesting...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe this resource helps you:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/ros/geometry/blob/hydro-devel/tf/src/tf/transformations.py" title="https://github.com/ros/geometry/blob/hydro-devel/tf/src/tf/transformations.py"&gt;geometry/transformations.py at hydro-devel · ros/geometry · GitHub&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 03:37:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509033#M5430</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-12-03T03:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509034#M5431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ I got the impression that the various parameters were set within a table so that translation, rotation and/or scale could be applied to individual features and not the whole featureclass itself.&amp;nbsp; If the affine were to be applied to the whole feature class, then yes, spatial adjustment would be easy. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a side note, affine (translation to...rotation about...and scaling along the axis... of the origin) is what I used to determine the base parameters for a minimum area bounding ellipse (MABR) for feature data (ie point clusters, polylines and/or points).&amp;nbsp;&amp;nbsp; An affine transformation of an ellipse to the origin will yield a circle, hence, if the transformed feature isn't a pure circle, then you can solve for the ellipse parameters there using 3,4 or 5 point solutions to the ellipse...then reverse the transform and the resultant ellipse.&amp;nbsp; A long story, but something &lt;A href="https://community.esri.com/migrated-users/62455"&gt;William Huber&lt;/A&gt;‌ was coaching me on during my last sabbatical when I was working on my 'containers' toolbox and studying algorithms, programming and computational geometry.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 09:54:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509034#M5431</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-12-03T09:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509035#M5432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This got over my head pretty quick! It does seem to me, &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;, looking through the spatial adjustments help it seems that method will change each section of my polyline the same. What I need to be able to do is iterate through basically each line (every section of line in my polyline has its own "span ID" in the attribute table) in my attribute table and rotate each "span ID" by a field labelled "angle" in my attribute table. I feel like this should be a pretty simple script just to rotate and then call in a field in the attribute table to be the value for rotation, but I haven't used code in about 2 years now and have only ever used it minimally. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌, I looked at that code you sent and am trying to decipher it. There are a lot of terms in there that I have never used so I'm not sure yet if that will work for me. In the mean time, maybe the way I re-worded the problem here will help spark up a simple solution! Thanks for helping!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 18:28:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509035#M5432</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-03T18:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509036#M5433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a section of your attribute table.&amp;nbsp; You say "every section of your polyline" suggests to me that your polyline consists of parts which are separated out and that each "section" is part of a bigger one.&amp;nbsp; A polyline is usually represented by one record in the table and you would not see its sections unless the part was exploded into its individual parts...essentially making many polylines from the original and they may be "sections" in the sense that they originated from the parent polyline...but now they are all grown up and have move out on their own... &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 22:16:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509036#M5433</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-12-03T22:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509037#M5434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the feature has attributes about the rotation and translation, I suppose it doesn't really matter if it is a multipart or not, since the affine transformation will be applied to the entire feature. Right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But yeah, it would be nice to post a small part of you data or create some comparable dummy data so we can have a look at it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 22:39:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509037#M5434</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-12-03T22:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509038#M5435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cool! A sabbatical and being coached by &lt;A href="https://community.esri.com/migrated-users/62455"&gt;William Huber&lt;/A&gt;‌. I'm getting a little jealous here. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 22:43:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509038#M5435</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-12-03T22:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509039#M5436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt; and &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌ I attached my "Power_Line_Spans" so that you can take a look. Right now, this is what I have, but it only represents 2d lines because my 3D data is not here yet. The attribute table for the 3D data will be the same though with each "section" of polyline containing a separate "span_ID". Thanks for taking a look! I also don't have the angle field in this data yet because I'm waiting on another part of my team to complete that task.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 23:00:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509039#M5436</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-03T23:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509040#M5437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Visually there are few lines, but each line consist of many features. I guess that is what you were referring to with "section". Angle is not provided yet... in what unit are the angles provided? Degrees? Are the angles geographic or arithmetic?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the field to hold the "scale" value? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm still a little confused, if the sections (features) that make up a line are applied different scaling and rotation, the polyline (combination of the sections) will not make much sense (I think). What is the purpose of this process?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 23:17:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509040#M5437</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-12-03T23:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509041#M5438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The data are indeed segments&amp;nbsp; many points for some bizarre reason since they appear to form straight line segments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I calculated angle relative to the x-axis using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python interpreter&lt;/P&gt;&lt;P&gt;expression box:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;polyline_angle(!Shape!) &lt;/PRE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;''' input shape field: returns angle relative to x-axis using the first and last point
polyline_angle(!Shape!)&amp;nbsp;&amp;nbsp;&amp;nbsp; #enter into the expression box'''
import math
def polyline_angle(shape):
&amp;nbsp; radian = math.atan2((shape.lastPoint.Y - shape.firstPoint.Y),(shape.lastPoint.X - shape.firstPoint.X))
&amp;nbsp; degrees = math.degrees(radian)
&amp;nbsp; return degrees&lt;/PRE&gt;&lt;P&gt;I calculated the number of points using&lt;/P&gt;&lt;P&gt;Python&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;count_pnts(!Shape!)&lt;/PRE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;''' input shape field, return number of points in a feature
count_pnts(!Shape!)&amp;nbsp;&amp;nbsp;&amp;nbsp; #enter into the expression box'''
def count_pnts(shape):
&amp;nbsp; counter = 0
&amp;nbsp; num_parts = shape.partCount
&amp;nbsp; num_pnts = 0
&amp;nbsp; while counter &amp;lt; num_parts:
&amp;nbsp;&amp;nbsp;&amp;nbsp; part = shape.getPart(counter)
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = part.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; while pnt:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num_pnts += 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = part.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not pnt:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = part.next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; counter += 1
&amp;nbsp; return num_pnts&lt;/PRE&gt;&lt;P&gt;For example your feature FID 1, Span 000&amp;nbsp; consists of 13 points ( use the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000003p000000" rel="nofollow noopener noreferrer" target="_blank"&gt;FeatureVerticesToPoints tool &lt;/A&gt;)&amp;nbsp; so this file for some reason has densified points along each segment.&amp;nbsp; No clue how it was generated, but my guess is that the angles that I calculated apply to each of your little tiny segments and under no circumstances should you explode them.&amp;nbsp; You can generalize the data within each segment ... you could try the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Simplify_Line/007000000010000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;Simplify Line tool&lt;/A&gt; to get rid of those excessive fiddly-bits.&amp;nbsp; So in short...I would find out how those lines were generated and why before you get too far on the rotation stuff.&amp;nbsp; If you want to rotate all the shapes by some amount then that is simple...if features have to be rotated by different amounts, then you do realize that they will in all likelihood not be connected any more.&lt;/P&gt;&lt;P&gt;Have fun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:18:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509041#M5438</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T22:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509042#M5439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I forgot to include an image for the first feature&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="PolylineImage.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/37118_PolylineImage.png" style="width: 620px; height: 134px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 00:35:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509042#M5439</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-12-04T00:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509043#M5440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, so I realized after you replied here that I have recently densified the lines every 10 meters for a specific purpose. The "sections" that I am talking about are the sections that are defined by a single "span ID". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are correct that if I scale and rotate these differently that the lines will no longer be connected. My end goal is to create a layer that is defined by the flight angle of birds across each power line span. The picture below is one span that I manually edited. This is what I want to happen for all of the spans in my dataset. The rotation is based on flight direction of birds and scaling occurs so that the new flight path does not exeed the length of the original span. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/37315_Capture.PNG" style="width: 620px; height: 435px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully this helps explain my goals a little more clearly. I feel like it is a pretty unique problem so its hard to explain exactly what I need!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 19:18:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509043#M5440</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-04T19:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509044#M5441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just replied above to &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ with some information that is relevant to your concerns. So you see in the attribute table that there is a span ID that covers that whole section. Those are the 'sections' that I am trying to rotate (the whole section represented by 1 span ID). The multiple points in there are because I had to densify the lines by 10 meters for another process. I have provided here a new dataset that has not been densified if you want to play around with it. But yes, I do realize they won'te be connected anymore and that is ok for what I am trying to do. Refer to my reply to Xander for a picture of my end goal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 19:26:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509044#M5441</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-04T19:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509045#M5442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ahhh Ok, that does clarify the problem...I will revisit in light of the new information.&amp;nbsp; The only question that remains is do you want the rotation to occur about the center point? the start point or the end point? One of the points needs to be fixed during the rotation process....think about it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 19:34:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509045#M5442</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-12-04T19:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509046#M5443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yea, I think it would be best if it rotated around the center point. I wish I had the rotation angles and scale changes that will need to happen to show you too, but unfortunately that is out of my hands! Thanks for taking such an interest in this question!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 19:42:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509046#M5443</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-04T19:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509047#M5444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is what I am thinking... it currently is a demonstration so if Xander, or anyone else wants to make it work with your shapefiles, then the principles might be useful.&amp;nbsp; &lt;/P&gt;&lt;P&gt;For the demo, all it does is take a line, takes the first and last points and ignores the rest(ish).&amp;nbsp; performs a translation to the origin, a rotation by a certain angle, and scales the x axis by a factor of 2x.&amp;nbsp; The only real input parameters needed are provided in the documentation and you can see alternates after the if __name__ section of the script.&amp;nbsp; &lt;BR /&gt;I can't get back to this for a day or 2, but this may keep you or others busy until you get your rotation data.&amp;nbsp; bear in mind, this can be greatly expanded, but I wanted to demonstrate what an affine transformation was.&amp;nbsp; I was as verbose as possible and didn't bury the code in one-liners since I teach and I hate unwrapping those for students so they can understand. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So have fun and give me some feedback via here or if it is more verbose...email etc.&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;affine_line.py&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Author: &lt;A href="mailto:Dan.Patterson@carleton.ca" rel="nofollow noopener noreferrer" target="_blank"&gt;Dan.Patterson@carleton.ca&lt;/A&gt;&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Purpose: a one-off script to rotate a line about its center&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ... aka ... a 2 point polyline&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Requires:&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; import numpy as np&amp;nbsp; either in the script or in 'rotate'&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Namespace:&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; line&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 point line&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; angle&amp;nbsp;&amp;nbsp; rotation angle in degrees&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; x=2,y=1 scaling in the x and/or y directions&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_c, XY_t, XY_r, XY_s&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; namespace representing center, translated, rotated, scaled pnts&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;import numpy as np&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;np.set_printoptions(precision=2,threshold=20,edgeitems=3,suppress=True,linewidth=60)&amp;nbsp; # set default print options&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;def array_check(pnts):&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''check to see if the pnts are expressed as an array'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; bool = type(line).__module__ == np.__name__&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; if not bool: #not an array&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts = np.array(pnts,dtype='float64')&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; return pnts&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;def angle(pnts):&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''angle between first and last points in array format'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; pnts = array_check(pnts)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; dx,dy = pnts[0] - pnts[-1]&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; deg = np.rad2deg(np.arctan2(dx,dy))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; return deg&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;def center(pnts):&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''average x, y coordinate for points'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; pnts = array_check(pnts)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_c = np.mean(pnts,axis=0)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; return XY_c&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;def distance(pnts):&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''returns the length/distance between the first and last points'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; pnts = array_check(pnts)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; dx,dy = pnts[0] - pnts[-1]&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; return np.hypot(dx,dy)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;def translate(pnts, XY_c=None):&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''translate a point(s)'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; if XY_c == None:&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XY_c = center(pnts)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_t = pnts - XY_c&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; return XY_t&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;def rotate(pnts,angle):&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''rotate points about the origin, given an angle in degrees,&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (-ve counterclockwise, +ve for clockwise'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; angle = np.deg2rad(angle)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; s = np.sin(angle)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; c = np.cos(angle)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; aff_matrix = np.array([[c, -s],[s, c]])&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_r = np.dot(pnts, aff_matrix)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; return XY_r&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;def scale(pnts, x=1, y=1):&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''returns the points scaled by x and y for the x and y direction'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_s = np.multiply(pnts, [x,y]) &lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; return XY_s&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;if __name__ == '__main__':&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; '''read the header...a verbose demonstration follows'''&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; line = [[0.0,0.0],[1.0,1.0]]&amp;nbsp; # line as a sequence of points&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; angle = -45.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # angle to rotate in degrees&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; x = 2.0; y = 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # scaling in x and y directions&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_c = center(line)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # center(line)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_t = translate(line, XY_c)&amp;nbsp; # translate(line, center(line))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_r = rotate(XY_t,angle)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # rotate(translate(line, center(line)), angle)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; XY_s = scale(XY_r,x=2, y=1)&amp;nbsp;&amp;nbsp; # scale(rotate(translate(line, center(line)), angle), x=2, y=1)&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print '\n','-'*60&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print __doc__&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print('Input line (pnts):\n {}'.format(line))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print('Center point:\n {}'.format(XY_c))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print('Translate to center:\n {}'.format(XY_t))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print('Rotate about center:\n {}'.format(XY_r))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print('Scaled with x=2,y=1:\n {}'.format(XY_s))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print('Rotate back:\n {}'.format( rotate(XY_s,-angle) ))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print('Translate back:\n {}'.format( translate(rotate(XY_s,-angle),-XY_c) ))&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;&amp;nbsp; print '\n','-'*60&lt;/SPAN&gt;


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:18:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509047#M5444</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T22:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509048#M5445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌, thank you for that script, but unfortunately I have been in the field for a little while and haven't been able to look at this and about to take about a month of leave. When I get back from leave I will play around with your method you posted here. Thanks for posting the demo and I will be sure to take a look!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 19:10:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509048#M5445</guid>
      <dc:creator>MorganHarris</dc:creator>
      <dc:date>2014-12-10T19:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Rotate/Scale Polylines Based on Field in Attribute Table</title>
      <link>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509049#M5446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Morgan... remember it is a demo script, demonstrating the principles, I will try to get something functional once I am done marking term projects.&amp;nbsp; Be safe... Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 19:19:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/rotate-scale-polylines-based-on-field-in-attribute/m-p/509049#M5446</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-12-10T19:19:25Z</dc:date>
    </item>
  </channel>
</rss>

