A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.
23

Script below will output a new feature class of split polygons and the lines used for splitting them. Advanced license is required. The polygons will be split like this: Using Centroid of Minimum Bounding Geometry rectangle as midpoint and split across the rectangle. import arcpy print 'Running' arcpy.env.workspace = r'C:\TEST.gdb' #Change to match ...


14

If you want to split your features per hand: Select your vector layer and click editing (red). Then select the scissors(green) and click two-times from one side of the polygon to the other. You will see a small dotted line. After spliting simply unable the editing and choose "save changes". Look into the attribute table to see the changes.


11

Simple answer: Don't. You shouldn't do it that way. From the OSM road Shapefiles, it is impossible to distinguish between intersections and over/underpasses. You'll create intersections that don't exist in reality if you split all seemingly crossing roads. You'll need to get your hands dirty with the original OSM file, if you don't want to use existing ...


11

from GDAL mailing list using python import os from osgeo import ogr def multipoly2poly(in_lyr, out_lyr): for in_feat in in_lyr: geom = in_feat.GetGeometryRef() if geom.GetGeometryName() == 'MULTIPOLYGON': for geom_part in geom: addPolygon(geom_part.ExportToWkb(), out_lyr) else: addPolygon(...


11

Shapefiles have no type MultiPolygon (type = Polygon), but they support them anyway (all rings are stored in one polygon = list of polygons, look at GDAL: ESRI Shapefile) It is easier with Fiona and Shapely: import fiona from shapely.geometry import shape, mapping # open the original MultiPolygon file with fiona.open('multipolygons.shp') as source: # ...


10

To update Curlew above, as of QGIS 2.18, you would use the built-in Advanced Digitizing Toolbar, which can be accessed via View > Toolbars > Advanced Digitizing Toolbar. The toolbar will look like this and the "Split Features" button is the fifth from the right: With that loaded, and the respective later selected and in Edit mode, select the "Split Features"...


10

In ArcGIS try Multipart To Singlepart: Creates a feature class containing singlepart features generated by separating multipart input features After that the features will be separated (but still in one feature class).


9

Have you tried first making an intersection with the grid layer and then using Vector -> Data managment tools -> Split vector layer? It sounds exactly like what you want.


9

The v.split.length function from GRASS should do exactly what you want by splitting the line into equal segments defined by the user without the need for a point layer. Here's a simple example of a straight line (it also works on non-straight and multiple lines): I added a column to calculate its length using $length in the expression: Using the v.split....


9

If you reproject the polygon data to Asia Lambert Conic (not just On-the-fly, but really reprojecting all vertex coordinates into a new file), you can dissolve the polygons by a common attribute. This should remove the common border line. If it does not work in first run, have a closer look at the border line. There may be a small gap after the reprojection,...


9

You can substract (clip) a polygon from another of the same layer by using the plugin Clipper. You have to choose the polygon you want to clip and then you do Vector->Clipper->Clip and the plugin substracts the polygon from the bigger one. Then you choose the clipped polygon and delete it. If you can't choose the polygon you really want because the QGIS ...


9

QGIS can do the same. On the Advance Digitizing Toolbar is the 'Split Features' button: It appears more simple than MapInfo. 1) Make the layer editable 2) Select the 'Split Features' tool 3) Select the node you wish to split at. This work with polygons also.


9

I would probably do the following: Run the Lines to polygons tool: Vector > Geometry Tools > Lines to polygons Or the Polygonize tool (as suggested by @GaborFarkas): Processing Toolbox > QGIS Geoalgorithms > Vector geometry tools > Polygonize Run the Clip tool using the output from Step 1 as the Input layer and your polygon layer as the ...


8

The Reshape Feature Tool can be helpful for this job. Draw the new common border of the polygons (here in red color):


8

You can use effectively Shapely, and Fiona to read a shapefile for example: import fiona # open a line shapefile file = fiona.open('lines.shp') # first element of the shapefile first = file.next print first {'geometry': {'type': 'LineString', 'coordinates': [(203317.23, 90448.75), (203679.62, 90105.68), (203882.57, 89902.74), (204143.49, 89641.81), (204394....


8

I've put together some code below which seems to create single segment lines from polyline (which can be multipart) feature classes while retaining their attributes. I recommend that you run it against a small test dataset or two first, and if it seems to do what you want, then comment out or remove the print statements to gain some performance. If you add ...


8

Here's a script that might do it for you. The native arcpy.Geometry class has a method called "cut" that will cut any feature using another polyline. Unfortunately, since you're using "points", we have to make "fake" lines out of these points. I essentially made a scratch polyline with the points [(Point.X+10, Point.Y+10), (Point.X-10, Point.Y-10)] - e.g. a ...


8

Given a polygon pol, like this: then: > library(sf) > sdist = -0.055168 > ppol = splitnarrow(pol, sdist, 1e-3) > plot(ppol, col=1:2) produces this: Here's the source code for splitnarrow. There's a zillion places where this can go wrong, and first you have to determine sdist and eps for your polygons. splitnarrow <- function(pol, sdist, ...


7

Using ArcGIS, one way to go about this is to create a 1 X 1 KM Fishnet grid followed by using the Split tool. The general workflow/model looks like this:


7

You can use the reshapeGeometry function of the QgsGeometry object for this, which cuts a polygon along its intersection with a line. The following will intersect the buffer polygons with the lines, and add the split polygon features to a memory layer (QGIS 2.0 syntax): # Get the dataProvider objects for the layers called 'line' and 'buffer' linepr = ...


7

The ST_Split PostGIS function is probably what you want. PostGIS 2.2+ now supports Multi* geometries in ST_Split. For older versions of PostGIS, read on: To get a single line split by multiple points, you could use something like this multipoint wrapper plpgsql function. I've simplified it just to the "split (multi)lines with (multi)points" case below: ...


7

May be an alternative to the suggestion AndreaJ gave- Have look at Station Lines N.B. This tool expects projected coordinate systems for the feature to be splitted by planar length unit.


7

I found the tool I was looking for! It can be done using the plugin called "Clipper".


7

You will need: 1) A table with LineString geometries: CREATE TABLE lin ( id serial PRIMARY KEY, geom geometry(LineString, 31370) ); CREATE INDEX ON lin (id); CREATE INDEX ON lin USING gist (geom); 2) A table with Point geometries where you want to split your overlapping lines. They can represent train/metro stations, intersections, bifurcations etc. (...


7

You have many solutions and I use here a simple example 1) the easiest way from shapely.geometry import Point, LineString line = LineString([(1,2),(2,4),(4,5)]) point = Point(2,4) First, you must determine if the point is within the line (Determine if shapely point is within a linestring/multilinestring) line.distance(point) < 1e-8 True print ...


7

Ok, I had a go at this using existing tools for QGIS... Download/enable the Buffer by percentage plugin from: Plugins > Manage and Install Plugins... This creates buffers for each of your features. Run this plugin on your layer and use the Buffer area percentage option. Enter 20 (for 20%), save the output and run it again for 40, 60, and 80. Here is ...


7

I would probably do the following: Merge all polygon layers: Vector > Data Management Tools > Merge vector layers Dissolve your merged layer: Vector > Geoprocessing Tools > Dissolve Clip your line layer with the merged polygon layer: Vector > Geoprocessing Tools > Clip Find the symmetrical difference of your clipped line layer: ...


7

Here is an answer that applies sf package functions to the reproducible data kindly provided by rcs. library(sf) A <- st_as_sfc("LINESTRING(458.1 768.23, 455.3 413.29, 522.3 325.77, 664.8 282.01, 726.3 121.56)") B <- st_as_sfc("MULTIPOLYGON(((402.2 893.03, 664.8 800.65, 611.7 666.13, 368.7 623.99, 215.1 692.06, 402.2 893.03)), ((703.9 366.29, 821.2 ...


7

First, run MakefeatureLayer to enable the Ratio Policy on a specific field. Then, run the FeatureLayer though Intersect, it will honor the split policy rule. The field specified must be Numeric.


7

Yes, you can just loop through the individual features and save them like so: library (sf) dat <- read_sf ("~/data.shp") for (i in seq_len (nrow (dat))) { fname <- paste0 ("~/split_", i, ".shp") write_sf (dat [i, ], fname) }


Only top voted, non community-wiki answers of a minimum length are eligible