Assigning Name to Each Points
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 ?
arcgis-desktop arcpy arcmap network-analyst
add a comment |
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 ?
arcgis-desktop arcpy arcmap network-analyst
1
Please format your code legibly by using the original code and the{}
format button.
– Vince
4 hours ago
With the DA cursor, can you check if the Name is blank, then populate?
– klewis
4 hours ago
add a comment |
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 ?
arcgis-desktop arcpy arcmap network-analyst
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 ?
arcgis-desktop arcpy arcmap network-analyst
arcgis-desktop arcpy arcmap network-analyst
edited 3 hours ago
PolyGeo♦
53.2k1779238
53.2k1779238
asked 4 hours ago
Aera
1195
1195
1
Please format your code legibly by using the original code and the{}
format button.
– Vince
4 hours ago
With the DA cursor, can you check if the Name is blank, then populate?
– klewis
4 hours ago
add a comment |
1
Please format your code legibly by using the original code and the{}
format button.
– Vince
4 hours ago
With the DA cursor, can you check if the Name is blank, then populate?
– klewis
4 hours ago
1
1
Please format your code legibly by using the original code and the
{}
format button.– Vince
4 hours ago
Please format your code legibly by using the original code and the
{}
format button.– Vince
4 hours ago
With the DA cursor, can you check if the Name is blank, then populate?
– klewis
4 hours ago
With the DA cursor, can you check if the Name is blank, then populate?
– klewis
4 hours ago
add a comment |
1 Answer
1
active
oldest
votes
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)
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
1 hour ago
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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)
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
1 hour ago
add a comment |
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)
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
1 hour ago
add a comment |
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)
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)
answered 4 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
1 hour ago
add a comment |
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
1 hour 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
1 hour 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
1 hour ago
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
Please format your code legibly by using the original code and the
{}
format button.– Vince
4 hours ago
With the DA cursor, can you check if the Name is blank, then populate?
– klewis
4 hours ago