By fahadjahangirAugust 8, in Analysis and Geoprocessing. I want to split a line shapefile into segments of equal length, let say into length of x meters each.
Is there a way to do that in python without using QGIS? You can import shapefiles using Fiona and do all sorts of modifications with Shapely. For more information, look here:.
You can post now and register later. If you have an account, sign in now to post with your account. Paste as plain text instead. Only 75 emoji are allowed. Display as a link instead. Clear editor. Upload or insert images from URL.
Reply to this topic Start new topic. Recommended Posts. Report post.
Posted August 8, Share this post Link to post Share on other sites. Posted August 8, edited. Join the conversation You can post now and register later. Reply to this topicThe Split command on the Editor menu can split a selected line from either the start point or end point of the line by using a specified distance value, a percentage of total length, or an m-value. Split updates the shape of the existing feature and creates one or more new features using the default attribute values for the feature class.
The Split dialog box displays the length of the original feature in current map units to help you split it accurately. Arrows are shown on the feature to indicate the line's direction, so you can choose whether you want to split the line from the start or end point of the line.
These arrows will help ensure that the line is split from the proper orientation.
Subscribe to RSS
The line is split, where Split updates the shape of the existing feature and creates one or more new features using the default attribute values for the feature class. Arc GIS for Desktop. Click the Edit tool on the Editor toolbar and click the feature. Click the Editor menu and click Split. Choose the split method you want to use: Split the feature at a certain distance. Split the feature at a certain percentage of the whole.
It only takes a minute to sign up. Like this:. But, I was looking for something similar that keeps everything in the same layer while editing it and does it only for the selected feature s not all elements. I am thinking in a simple command that takes the selected featured s and produces the desired output like the Split Patrs or Split Features in the Advanced Digitizing Toolbar.
The tool therefore is called "Explode lines" and can be found in the processing toolbox at "Qgis Geoalgorhitms" - "Vector geometry tools". It takes all lines and breaks them into its segments into a new layer. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Exploding line into segments using QGIS? Asked 2 years, 1 month ago. Active 3 days ago. Viewed 2k times. Is there a command to explode a line feature with many segments into its segments?
Marco Marco 2, 8 8 silver badges 30 30 bronze badges. Active Oldest Votes. Marco 2, 8 8 silver badges 30 30 bronze badges. Matte Matte 5, 8 8 silver badges 16 16 bronze badges. The Overflow Blog. Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap.
The problem is how to split segments or in other words how to insert new points into a polygon so that the segment where I created the new point is now two segments connected by said point.
Every time I create a new point within a segment, the segment stays the same length as before and is not being split by the new point.
I don't know why the following snapshots have double columns on the left side but just ignore that. First I have the segment I want to split:. I then go to pointlayer, activate the edit mode, click on "add new element" and create a new point near the segment:. After I activate the snap-function and define the radius, I place the point on the "x" with the knot-tool:.
Now if I go on the info-pointer and click on the segment, the segment is still as one piece and is not split by the new point:. It seems like you just added new vertices. Adding vertices to lines does not split lines and it shouldn't.
That's a different use case. I didn't not understand your reason for the point layer. You might want to elaborate on that if it's important. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. How can I split a segment into two segments? Ask Question.
Asked 7 years, 2 months ago. Active 7 years, 2 months ago. Viewed 2k times. Then I go to edit mode for the segment layer, click on the knot tool and select the segment:. I double-click on the segment where i want a new point. The "new place for the point" appears:. Chad Cooper Tudor Tudor 89 5 5 bronze badges. Active Oldest Votes. Use the Split Features tool in Advanced Digitizing toolbar.
Thank you. A vertices if it is the red cross on a segment is not selectable and does not have an ID. That is why i need a point layer. Tudor: Does the Split features tool solve your problem? Sorry for the late answer. It does only partially solve my problem.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I have a polyline shapefile, which represents part of an urban road network.
By using R-cran, I would like to further divide the polyline segments into smaller parts having equal length e. The idea is to obtain a much denser polyline shapefile, which I can use for spatial analyses as a "sort of grid" to associate geo-referenced data points collected along the roads to each segment.
It uses the vector notation of a segment, creating a vector u of unit length and direction of the line to be split that can be multiplied to create a longer line composed of many segments here and here the references I have used. I am sure that this function can be written in a more concise and efficient way. I have created a package in a git repositoryin case anyone would like to contribute. The solution presented by Duccio resets the spacing on every new segment.
I adapted the script to a version that does a running spacing. The difference is visualized in the images below. The desired spacing represented by length of green bar always begins at each segment. Residual distances from the previous segments are not transferred to the next segment.
Thus, the resulting spacing is not constant over the full line. The desired spacing is transferred arround corners. This approach garantuees that the points have always the desired spacing with regard to the original line. However, neither here is the spacing of the resulting points to each other constant.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I have a map that I have digitised and converted to a vector layer the rivers only. The problem is that the vectorisation has produced a large number of segments for each river, that show up as different features each may have multiple straight line segments, but they do not cover whole rivers.
What I am looking for is a tool to merge into one feature a polyline, I guess all the segments whose extremes are within a given distance. I have tried v. Any help would be very appreciated! You can do it using GEOS library in your programming language and maybe also commandline. In my case, I was doing it in R, using rgeos library:. Be careful: from the note in the documentation "specifically it joins line segments with intersecting end points" it seems that the line features must be consecutive - however it is not clear whether this applies also to case when you merge by IDs.
I'd suggest selecting the line parts manually and then using the "merge" tool located in advanced editing toolbar. Choose points at either end or in the case of Points2Route add extra points to specify from multiple paths and then export to it's own layer. As far as the maps goes.
Splitting a line into an equal number of parts
I've modified the PointsToRoute script for a similar heavy-duty situation to automatically step through a layer of lines and find routes between their endpoints. I'll clean it up and see if I can publish it on github soon. It automatically merges multiple connected lines i.
The output layer type is Line, not PolyLine. Merging can be based on one of these two criteria:. Work is still in progress, don't hesitate to suggest new functionalities. Then you can split the dissolved line feature with the nodes.
This will at least provide you with a vector feature split at only the intersecting points. Learn more. Asked 8 years, 1 month ago.Setting the Snapping Tolerance and Search Radius. Enable snapping on intersections. Enable topological editing.
Avoid overlap of new polygons. Digitizing an existing layer. The Vertex Editor Panel. Cutting, Copying and Pasting Features. Deleting Selected Features. Saving multiple layers at once. Merge selected features. Merge attributes of selected features. The Advanced Digitizing panel.
Absolute reference digitizing. Relative reference digitizing. Parallel and perpendicular lines. The Processing in-place layer modifier. This version of QGIS does not track if somebody else is editing the same feature at the same time as you are.
The last person to save the edits wins. For optimal and accurate editing of vector layer geometries, we need to set an appropriate value of snapping tolerance and search radius for features vertices. When you add a new vertex or move an existing one, the snapping tolerance is the distance QGIS uses to search for the closest vertex or segment you are trying to connect to.
If you are not within the snapping tolerance, QGIS will leave the vertex where you release the mouse button, instead of snapping it to an existing vertex or segment. The snapping mode, tolerance value, and units can also be configured in this toolbar. In most cases, it is sufficient to use this snapping mode, but beware when using it for projects with many vector layers, as it may affect performance. Current layer : only the active layer is used, a convenient way to ensure topological consistency within the layer being edited.
If you need to edit a layer and snap its vertices to another, make sure that the target layer is checked and increase the snapping tolerance to a higher value.