<?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: VBA Script for calculating a polyline's X,Y coordinate of centroid in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113136#M3853</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It used to be really east to find sample VBA code for this by searching the desktop help, but I was just looking for this and couldn't find it anywhere...until I clicked on the "Help" button right in the Field Calculator tool (at least in 9.3).&amp;nbsp; This is from that help document.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim Output As Double&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pPoint As IPoint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pPoint = [Shape]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Output = pPoint.X&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Oct 2010 16:18:27 GMT</pubDate>
    <dc:creator>CynthiaGaines</dc:creator>
    <dc:date>2010-10-07T16:18:27Z</dc:date>
    <item>
      <title>VBA Script for calculating a polyline's X,Y coordinate of centroid</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113133#M3850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To: The ESRI Community at Large&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From: Darren Murphy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Date: 7/2/2010&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Subject:VB Script for calculating a polyline's X,Y coordinate of centroid&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for all of the help. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm creating a model using ESRI's ModelBuilder, and I'm trying to calculate the X,Y coordinate of Centroid for a polyline feature class within the "Calculate Field" systems tool environment. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I realize that you can do it by right-clicking the field of interest and selecting the X,Y Coordinate of Centroid. However, I would like to able to automate this process when I run the model.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would prefer to use VBA but I'm open to VBScript or Python. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Darren Murphy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GIS Analyst&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;District of Columbia Government&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Office of the Chief Technology Officer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jefferson Middle School&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;801 7th Street, SW&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Washington, DC&amp;nbsp; 20024&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Phone: 202-727-6421&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;eFax: 202-727-7922&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Email: &lt;/SPAN&gt;&lt;A href="mailto:darren.murphy@dc.gov"&gt;darren.murphy@dc.gov&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Website: &lt;/SPAN&gt;&lt;A href="http://dcgis.dc.gov"&gt;http://dcgis.dc.gov&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jul 2010 15:20:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113133#M3850</guid>
      <dc:creator>DarrenMurphy1</dc:creator>
      <dc:date>2010-07-02T15:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Script for calculating a polyline's X,Y coordinate of centroid</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113134#M3851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Darren&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Read the help topics for your version on "Calculate Field", there are Python examples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;9.3.x&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1812&amp;amp;pid=1808&amp;amp;topicname=Calculate_Field_(Data_Management"&gt;http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?id=1812&amp;amp;pid=1808&amp;amp;topicname=Calculate_Field_(Data_Management&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;10&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000004m000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000004m000000.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Jul 2010 18:57:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113134#M3851</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2010-07-03T18:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Script for calculating a polyline's X,Y coordinate of centroid</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113135#M3852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also use the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Feature_To_Point/00170000003m000000/"&gt;Feature to Point&lt;/A&gt;&lt;SPAN&gt; tool.&amp;nbsp; This will create a point feature class of the line centroids.&amp;nbsp; If you need access to the centroid coordinates, you can use the Add XY Coordinates tool and then use Join Field to join the centroid coordinates back to the original line features.&amp;nbsp; When using the Feature To Point tool, be sure to check the "Inside" option!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Jul 2010 13:15:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113135#M3852</guid>
      <dc:creator>DaleHoneycutt</dc:creator>
      <dc:date>2010-07-04T13:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Script for calculating a polyline's X,Y coordinate of centroid</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113136#M3853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It used to be really east to find sample VBA code for this by searching the desktop help, but I was just looking for this and couldn't find it anywhere...until I clicked on the "Help" button right in the Field Calculator tool (at least in 9.3).&amp;nbsp; This is from that help document.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim Output As Double&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pPoint As IPoint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pPoint = [Shape]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Output = pPoint.X&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 16:18:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113136#M3853</guid>
      <dc:creator>CynthiaGaines</dc:creator>
      <dc:date>2010-10-07T16:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Script for calculating a polyline's X,Y coordinate of centroid</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113137#M3854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Calida Calida!!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 22:22:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113137#M3854</guid>
      <dc:creator>FabianHeredia</dc:creator>
      <dc:date>2010-10-07T22:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Script for calculating a polyline's X,Y coordinate of centroid</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113138#M3855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Mr. Honeycutt, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, the "Feature to Point" tool doesn't give me the exact midpoint (polyline, with geometry).&amp;nbsp; Like I said in my previous email, I'm looking for a script (preferably VBA) that I can use in ModelBuilder's "Calculate Field" System Tool under the Data Management toolbox.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to able to perform a spatial join on another point feature class (city block) to make any appropriate updates. Therefore, utmost precision is needed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Therefore, I need to the same functionality of the ArcInfo's (Ver. 9.3.1) Calculate Geometry, X,Y Coordinate of Centroid function. I need this script for my Geoprocessing model. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Darren Murphy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GIS Analyst&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;District of Columbia Government&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Office of the Chief Technology Officer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jefferson Middle School&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;801 7th Street, SW&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Washington, DC 20024&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Phone: 202-727-6421&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;eFax: 202-727-7922&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Email: &lt;/SPAN&gt;&lt;A href="mailto:darren.murphy@dc.gov"&gt;darren.murphy@dc.gov&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Website: &lt;/SPAN&gt;&lt;A href="http://dcgis.dc.gov"&gt;http://dcgis.dc.gov&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Oct 2010 18:13:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113138#M3855</guid>
      <dc:creator>DarrenMurphy1</dc:creator>
      <dc:date>2010-10-21T18:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: VBA Script for calculating a polyline's X,Y coordinate of centroid</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113139#M3856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are relying on the field calculator in ModelBuilder you should not use VBA, since there is no support for VBA in the field calculator once you upgrade to ArcGIS 10 (or beyond) and VB Script at ArcGIS 10 cannot do geometry calculations.&amp;nbsp; You should use Python (ModelBuilder supports Python in the Field Calculator, at least by 9.3).&amp;nbsp; That way you can not only use the code in ModelBuilder, but also in a python script (which can then be run in task scheduler) and it should port to future versions of ArcGIS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The two expressions below should get you the Centroid X and Y coordinates in Python with the Field Calculator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;float(!SHAPE.CENTROID!.split()[0])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;float(!SHAPE.CENTROID!.split()[1])&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Oct 2010 23:22:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/vba-script-for-calculating-a-polyline-s-x-y/m-p/113139#M3856</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2010-10-21T23:22:58Z</dc:date>
    </item>
  </channel>
</rss>

