<?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: help with a python code in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136301#M50422</link>
    <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;still dont work for me:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matu89_0-1643014888864.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32079iECBCA41490AE8BA8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matu89_0-1643014888864.png" alt="matu89_0-1643014888864.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the data from Arcgis Pro:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matu89_1-1643014958342.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32080iD00A42A76101E654/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matu89_1-1643014958342.png" alt="matu89_1-1643014958342.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i did wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jan 2022 09:02:53 GMT</pubDate>
    <dc:creator>matu89</dc:creator>
    <dc:date>2022-01-24T09:02:53Z</dc:date>
    <item>
      <title>help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136130#M50379</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;hey , i have the basic licence therere for i cant use&lt;/FONT&gt;&amp;nbsp;&lt;FONT face="arial,helvetica,sans-serif"&gt;Feature Vertices to Points tool.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;i've found a code over the internet from this&amp;nbsp; blog:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;A href="http://emilsarcpython.blogspot.com/2016/02/arcgis-polygon-to-lines-and-feature.html" target="_blank" rel="noopener"&gt;Emil's Arc/GIS/Python: ArcGIS polygon to lines and feature vertices to points without an ArcGIS advanced license (emilsarcpython.blogspot.com)&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;this is the code:&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;#feature vertices to points&lt;BR /&gt;import arcpy
def VerticesToPoints (inFc, workspace, fcName):

    outFc = UniqueFileName(workspace, fcName)
    try:
        #let esri do it (advanced license)
        arcpy.FeatureVerticesToPoints_management (inFc, outFc)
        return outFc
    except:
        pass
    #no advanced license
    sr = arcpy.Describe (inFc).spatialReference
    outPath, outName = os.path.split (outFc)
    arcpy.CreateFeatureclass_management (outPath,
                                         outName,
                                         "POINT",
                                         spatial_reference = sr)
    with arcpy.da.InsertCursor (outFc, "SHAPE@") as iCurs:
        with arcpy.da.SearchCursor (inFc, "SHAPE@") as sCurs:
            for geom, in sCurs:
                for i in range (geom.partCount):
                    part = geom.getPart (i)
                    for pnt in part:
                        if not pnt:
                            continue
                        row = (pnt,)
                        iCurs.insertRow (row)
    del iCurs
    del sCurs
    return outFc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;now, i tried to put my inputs in this code but it wont run..&lt;BR /&gt;&lt;BR /&gt;my inputs are:&lt;BR /&gt;the existing polyine is called :'zpoints.shp'&lt;BR /&gt;and my output directory is :'c:/gis/project'&lt;BR /&gt;the new point layer to be created is called: 'test.shp'&lt;BR /&gt;&lt;BR /&gt;where i need to write my inputs in the code?&lt;BR /&gt;&lt;BR /&gt;thanks for the help!&lt;BR /&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 09:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136130#M50379</guid>
      <dc:creator>matu89</dc:creator>
      <dc:date>2022-01-22T09:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136133#M50380</link>
      <description>&lt;P&gt;It's a function. You need to call it:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;VerticesToPoints ("C:/path/to/zpoints.shp", "c:/gis/project", "test.shp")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;You could also research &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/basics/create-a-python-script-tool.htm" target="_blank" rel="noopener"&gt;how to create a python script tool.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 10:13:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136133#M50380</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-01-22T10:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136238#M50412</link>
      <description>&lt;P&gt;As Luke said, you need to call the function AND you need to define the function &lt;STRONG&gt;UniqueFileName()&lt;/STRONG&gt; - as this code calls it.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The code below adds a small function to do what I guess&amp;nbsp;&lt;STRONG&gt;UniqueFileName()&lt;/STRONG&gt; was trying to do, and shows you how to call&amp;nbsp;&lt;STRONG&gt;VerticesToPoints()&lt;/STRONG&gt; without having to create a script tool.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#feature vertices to points
import arcpy

def UniqueFileName(workspace, fcName):
    return workspace + "\\" + fcName


def VerticesToPoints(inFc, workspace, fcName):

    outFc = UniqueFileName(workspace, fcName)
    try:
        #let esri do it (advanced license)
        arcpy.FeatureVerticesToPoints_management (inFc, outFc)
        return outFc
    except:
        pass
    #no advanced license
    sr = arcpy.Describe (inFc).spatialReference
    outPath, outName = os.path.split (outFc)
    arcpy.CreateFeatureclass_management (outPath,
                                         outName,
                                         "POINT",
                                         spatial_reference = sr)
    with arcpy.da.InsertCursor (outFc, "SHAPE@") as iCurs:
        with arcpy.da.SearchCursor (inFc, "SHAPE@") as sCurs:
            for geom, in sCurs:
                for i in range (geom.partCount):
                    part = geom.getPart (i)
                    for pnt in part:
                        if not pnt:
                            continue
                        row = (pnt,)
                        iCurs.insertRow (row)
    del iCurs
    del sCurs
    return outFc

inFc = "tmp_ln" # input line feature class
workspace = r"C:\temp\Scratch.gdb"  # GDB
fcName = "tmp_pt" # output point FC

VerticesToPoints(inFc, workspace, fcName)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jan 2022 22:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136238#M50412</guid>
      <dc:creator>MicZatorsky_AEC</dc:creator>
      <dc:date>2022-01-23T22:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136301#M50422</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;still dont work for me:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matu89_0-1643014888864.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32079iECBCA41490AE8BA8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matu89_0-1643014888864.png" alt="matu89_0-1643014888864.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the data from Arcgis Pro:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matu89_1-1643014958342.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32080iD00A42A76101E654/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matu89_1-1643014958342.png" alt="matu89_1-1643014958342.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i did wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 09:02:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136301#M50422</guid>
      <dc:creator>matu89</dc:creator>
      <dc:date>2022-01-24T09:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136604#M50459</link>
      <description>&lt;P&gt;The describe function fails because the path to 'zzpoints' does not exist. Note it takes it path relative to the&amp;nbsp;&lt;STRONG&gt;currently active workspace&lt;/STRONG&gt;: you could set the active workspace in your script before you access the feature class:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.env.workspace = r"C:\Users\sasim\Documents\ArcGIS\Projects\MyProjects\MyProject.gdb"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 21:19:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136604#M50459</guid>
      <dc:creator>HuubZwart</dc:creator>
      <dc:date>2022-01-24T21:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136610#M50460</link>
      <description>&lt;P&gt;Exactly.&amp;nbsp; Or&amp;nbsp;provide a fully qualified path to the feature class:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;inFc = r"C:\Users\sasim\Documents\ArcGIS\Projects\MyProject\MyProject.gdb\zpointss" # input line feature class&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 21:21:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136610#M50460</guid>
      <dc:creator>MicZatorsky_AEC</dc:creator>
      <dc:date>2022-01-24T21:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136988#M50522</link>
      <description>&lt;P&gt;thank you very much! it works !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 18:13:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1136988#M50522</guid>
      <dc:creator>matu89</dc:creator>
      <dc:date>2022-01-25T18:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: help with a python code</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1137400#M50582</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/484527"&gt;@matu89&lt;/a&gt;, please mark some responses as accepted solution to close out this thread.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 15:15:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/help-with-a-python-code/m-p/1137400#M50582</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2022-01-26T15:15:10Z</dc:date>
    </item>
  </channel>
</rss>

