Assigning Name to Each Points












1














My python code :



import arcpy

arcpy.FeatureToLine_management("Closestroute", "Featureline", "0.0001 Meters", "ATTRIBUTES")

#Generate points along lines for every 1 km

arcpy.GeneratePointsAlongLines_management("Featureline", "splitPoints", "DISTANCE", "1000 Meters", "", "NO_END_POINTS")

#Split line at point for every 1 km roads,search radius = 20 meters

arcpy.SplitLineAtPoint_management("Featureline", "splitPoints", "split1kpoints", "20 Meters")

#I added SS field into splitPoints, then I assigned name for each rows.(s1, s2, s3, ...)

cursor=arcpy.da.UpdateCursor("splitPoints","SS")

i = 0

for row in cursor:

row[0] = 's' + str(i)

i += 1

cursor.updateRow(row)

del row

del cursor


My problem is:



I am trying to assign one name for each points. However, when one route are used by more than one start points like blue arrow in the picture below, I obtained more than one segments name for this route. I am trying to get just one segments name for each points for this route. (showed with blue arrow) for both start points.



How I can deal with this problem ?



enter image description here










share|improve this question




















  • 1




    Please format your code legibly by using the original code and the {} format button.
    – Vince
    3 hours ago












  • With the DA cursor, can you check if the Name is blank, then populate?
    – klewis
    3 hours ago
















1














My python code :



import arcpy

arcpy.FeatureToLine_management("Closestroute", "Featureline", "0.0001 Meters", "ATTRIBUTES")

#Generate points along lines for every 1 km

arcpy.GeneratePointsAlongLines_management("Featureline", "splitPoints", "DISTANCE", "1000 Meters", "", "NO_END_POINTS")

#Split line at point for every 1 km roads,search radius = 20 meters

arcpy.SplitLineAtPoint_management("Featureline", "splitPoints", "split1kpoints", "20 Meters")

#I added SS field into splitPoints, then I assigned name for each rows.(s1, s2, s3, ...)

cursor=arcpy.da.UpdateCursor("splitPoints","SS")

i = 0

for row in cursor:

row[0] = 's' + str(i)

i += 1

cursor.updateRow(row)

del row

del cursor


My problem is:



I am trying to assign one name for each points. However, when one route are used by more than one start points like blue arrow in the picture below, I obtained more than one segments name for this route. I am trying to get just one segments name for each points for this route. (showed with blue arrow) for both start points.



How I can deal with this problem ?



enter image description here










share|improve this question




















  • 1




    Please format your code legibly by using the original code and the {} format button.
    – Vince
    3 hours ago












  • With the DA cursor, can you check if the Name is blank, then populate?
    – klewis
    3 hours ago














1












1








1







My python code :



import arcpy

arcpy.FeatureToLine_management("Closestroute", "Featureline", "0.0001 Meters", "ATTRIBUTES")

#Generate points along lines for every 1 km

arcpy.GeneratePointsAlongLines_management("Featureline", "splitPoints", "DISTANCE", "1000 Meters", "", "NO_END_POINTS")

#Split line at point for every 1 km roads,search radius = 20 meters

arcpy.SplitLineAtPoint_management("Featureline", "splitPoints", "split1kpoints", "20 Meters")

#I added SS field into splitPoints, then I assigned name for each rows.(s1, s2, s3, ...)

cursor=arcpy.da.UpdateCursor("splitPoints","SS")

i = 0

for row in cursor:

row[0] = 's' + str(i)

i += 1

cursor.updateRow(row)

del row

del cursor


My problem is:



I am trying to assign one name for each points. However, when one route are used by more than one start points like blue arrow in the picture below, I obtained more than one segments name for this route. I am trying to get just one segments name for each points for this route. (showed with blue arrow) for both start points.



How I can deal with this problem ?



enter image description here










share|improve this question















My python code :



import arcpy

arcpy.FeatureToLine_management("Closestroute", "Featureline", "0.0001 Meters", "ATTRIBUTES")

#Generate points along lines for every 1 km

arcpy.GeneratePointsAlongLines_management("Featureline", "splitPoints", "DISTANCE", "1000 Meters", "", "NO_END_POINTS")

#Split line at point for every 1 km roads,search radius = 20 meters

arcpy.SplitLineAtPoint_management("Featureline", "splitPoints", "split1kpoints", "20 Meters")

#I added SS field into splitPoints, then I assigned name for each rows.(s1, s2, s3, ...)

cursor=arcpy.da.UpdateCursor("splitPoints","SS")

i = 0

for row in cursor:

row[0] = 's' + str(i)

i += 1

cursor.updateRow(row)

del row

del cursor


My problem is:



I am trying to assign one name for each points. However, when one route are used by more than one start points like blue arrow in the picture below, I obtained more than one segments name for this route. I am trying to get just one segments name for each points for this route. (showed with blue arrow) for both start points.



How I can deal with this problem ?



enter image description here







arcgis-desktop arcpy arcmap network-analyst






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago









PolyGeo

53.2k1779238




53.2k1779238










asked 3 hours ago









Aera

1175




1175








  • 1




    Please format your code legibly by using the original code and the {} format button.
    – Vince
    3 hours ago












  • With the DA cursor, can you check if the Name is blank, then populate?
    – klewis
    3 hours ago














  • 1




    Please format your code legibly by using the original code and the {} format button.
    – Vince
    3 hours ago












  • With the DA cursor, can you check if the Name is blank, then populate?
    – klewis
    3 hours ago








1




1




Please format your code legibly by using the original code and the {} format button.
– Vince
3 hours ago






Please format your code legibly by using the original code and the {} format button.
– Vince
3 hours ago














With the DA cursor, can you check if the Name is blank, then populate?
– klewis
3 hours ago




With the DA cursor, can you check if the Name is blank, then populate?
– klewis
3 hours ago










1 Answer
1






active

oldest

votes


















3














It looks like points are stacking up due to duplicate line features or line feature segments. I'd perform a delete identical on your output point feature class, either before or after your cursor.



shpFld = arcpy.Describe ("splitPoints").shapeFieldName
arcpy.DeleteIdentical_management ("splitPoints", shpFld)





share|improve this answer





















  • Thank you so much ! This helps a lot !! Since I am assigning name in order, although one segment is used by two shortest paths, in attribute table, shows for just one start-end point shortest path. I have posted my guestion. If you can take a look, I will be appreciated for that. @Emil Brundage
    – Aera
    37 mins ago













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f307174%2fassigning-name-to-each-points%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














It looks like points are stacking up due to duplicate line features or line feature segments. I'd perform a delete identical on your output point feature class, either before or after your cursor.



shpFld = arcpy.Describe ("splitPoints").shapeFieldName
arcpy.DeleteIdentical_management ("splitPoints", shpFld)





share|improve this answer





















  • Thank you so much ! This helps a lot !! Since I am assigning name in order, although one segment is used by two shortest paths, in attribute table, shows for just one start-end point shortest path. I have posted my guestion. If you can take a look, I will be appreciated for that. @Emil Brundage
    – Aera
    37 mins ago


















3














It looks like points are stacking up due to duplicate line features or line feature segments. I'd perform a delete identical on your output point feature class, either before or after your cursor.



shpFld = arcpy.Describe ("splitPoints").shapeFieldName
arcpy.DeleteIdentical_management ("splitPoints", shpFld)





share|improve this answer





















  • Thank you so much ! This helps a lot !! Since I am assigning name in order, although one segment is used by two shortest paths, in attribute table, shows for just one start-end point shortest path. I have posted my guestion. If you can take a look, I will be appreciated for that. @Emil Brundage
    – Aera
    37 mins ago
















3












3








3






It looks like points are stacking up due to duplicate line features or line feature segments. I'd perform a delete identical on your output point feature class, either before or after your cursor.



shpFld = arcpy.Describe ("splitPoints").shapeFieldName
arcpy.DeleteIdentical_management ("splitPoints", shpFld)





share|improve this answer












It looks like points are stacking up due to duplicate line features or line feature segments. I'd perform a delete identical on your output point feature class, either before or after your cursor.



shpFld = arcpy.Describe ("splitPoints").shapeFieldName
arcpy.DeleteIdentical_management ("splitPoints", shpFld)






share|improve this answer












share|improve this answer



share|improve this answer










answered 3 hours ago









Emil Brundage

9,17511441




9,17511441












  • Thank you so much ! This helps a lot !! Since I am assigning name in order, although one segment is used by two shortest paths, in attribute table, shows for just one start-end point shortest path. I have posted my guestion. If you can take a look, I will be appreciated for that. @Emil Brundage
    – Aera
    37 mins ago




















  • Thank you so much ! This helps a lot !! Since I am assigning name in order, although one segment is used by two shortest paths, in attribute table, shows for just one start-end point shortest path. I have posted my guestion. If you can take a look, I will be appreciated for that. @Emil Brundage
    – Aera
    37 mins ago


















Thank you so much ! This helps a lot !! Since I am assigning name in order, although one segment is used by two shortest paths, in attribute table, shows for just one start-end point shortest path. I have posted my guestion. If you can take a look, I will be appreciated for that. @Emil Brundage
– Aera
37 mins ago






Thank you so much ! This helps a lot !! Since I am assigning name in order, although one segment is used by two shortest paths, in attribute table, shows for just one start-end point shortest path. I have posted my guestion. If you can take a look, I will be appreciated for that. @Emil Brundage
– Aera
37 mins ago




















draft saved

draft discarded




















































Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f307174%2fassigning-name-to-each-points%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

サソリ

広島県道265号伴広島線

Accessing regular linux commands in Huawei's Dopra Linux