Assigning Name to Each Points





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















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
    Dec 28 '18 at 18:09













  • With the DA cursor, can you check if the Name is blank, then populate?

    – klewis
    Dec 28 '18 at 18:29


















0















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
    Dec 28 '18 at 18:09













  • With the DA cursor, can you check if the Name is blank, then populate?

    – klewis
    Dec 28 '18 at 18:29














0












0








0








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 Dec 28 '18 at 19:13









PolyGeo

54k1782246




54k1782246










asked Dec 28 '18 at 17:59









AeraAera

1145




1145








  • 1





    Please format your code legibly by using the original code and the {} format button.

    – Vince
    Dec 28 '18 at 18:09













  • With the DA cursor, can you check if the Name is blank, then populate?

    – klewis
    Dec 28 '18 at 18:29














  • 1





    Please format your code legibly by using the original code and the {} format button.

    – Vince
    Dec 28 '18 at 18:09













  • With the DA cursor, can you check if the Name is blank, then populate?

    – klewis
    Dec 28 '18 at 18:29








1




1





Please format your code legibly by using the original code and the {} format button.

– Vince
Dec 28 '18 at 18:09







Please format your code legibly by using the original code and the {} format button.

– Vince
Dec 28 '18 at 18:09















With the DA cursor, can you check if the Name is blank, then populate?

– klewis
Dec 28 '18 at 18:29





With the DA cursor, can you check if the Name is blank, then populate?

– klewis
Dec 28 '18 at 18:29










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
    Dec 28 '18 at 21:00














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
    Dec 28 '18 at 21:00


















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
    Dec 28 '18 at 21:00
















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 Dec 28 '18 at 18:34









Emil BrundageEmil Brundage

9,74311645




9,74311645













  • 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
    Dec 28 '18 at 21:00





















  • 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
    Dec 28 '18 at 21:00



















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
Dec 28 '18 at 21:00







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
Dec 28 '18 at 21:00




















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.




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

Bundesstraße 106

Verónica Boquete

Ida-Boy-Ed-Garten