ST_Union would work, but your line work is almost assuredly not clean. So the boundaries of your little thingies don't all perfectly like up. You can gently snap them to a grid to try and increase the odds that vertexes line up, but I bet that you'll still have a few cases that don't work. Either they will be beyond tolerance or, more likely, there will be ...
I believe the tool you are looking for is the Dissolve tool.
You can specify which field you want to dissolve your feature on, so in your case you would specify "district" and it will dissolve all of your polygons based on the value in that field.
You can do this with the Summary Statistics (Analysis) tool. The case field parameter is what you use to "dissolve". From the above link:
case_field [case_field,...] (Optional)
The fields in the Input Table used to calculate statistics separately for each unique attribute value (or combination of attribute values when multiple fields are specified).
If you simply want to dissolve the edges and are happy with having one large multipolygon feature of all buildings, you can simply use the fTools "Dissolve" tool ("Vector/Geoprocessing/Dissolve").
If you want to keep the attributes (in the case of OS Vector that would only be the ID, which seems to be rather arbitrary), you can split the dissolved vector ...
When I have a layer with errors , I normally run it through the GRASS function v.clean in the Processing Toolbox. Though I never really figured out which tool is best in which case, I normally choose the bpol function there.
Maybe even more important it is to set the advanced parameters for snap tolerance and min area.
Depending on the layer, I usually ...
The source data seems to be rather hard to handle as vectors as you have noticed. However, this workaroung that goes through an intermediate raster file works well and it is very fast.
1) Use gdal_rasterize http://www.gdal.org/gdal_rasterize.html and for making a black/white raster from the layer
gdal_rasterize -burn 100 -ts 1000 1000 -ot byte ...
In this case, it looks like you need to help the dissolve tool along by fixing the topology first. Here's how you can do this in GRASS.
When you load the shapefile, this is how GRASS sees it:
Each cross marks an area. You can see that there are some crosses on the boundary lines: These are the sliver polygons caused by the slight offset between the ...
Your problem is likely because of what you have included in the group by field.
ST_UNION is an aggregate function, meaning that it is dissolving based on what you specify as the GROUP parameter.
Here is what you entered:
SELECT c.fid, ST_Union(c.boundaryshape) FROM c Group by c.fid,c.boundaryshape;
According to this, you are grouping by your fid, which ...
You just need to split it into 2 steps:
Dissolve on the NET_ID
Spatial Join the dissolved layer to the original layer. Use the match type of CONTAINS and set the Merge Rule of the Geology field to Join and set the delimiter to a comma. Right click on the field in the field mapping list and select properties to get to the merge rule and delimiter settings
There are a few reasons why this isn't working for you:
Dissolve only works with a single input. You need to use a tool like Merge in order to dissolve two polygons.
ArcGIS geoprocessing tools like Dissolve can run using arcpy geometries as inputs. However, your code does not pass arcpy geometry objects to the dissolve tool, it is entire layers/shapefiles. ...
You can use ST_MakeValid directly in QGIS adding lwgeom plugin that add lwgeom provider to processing toolbox => you can apply MakeValid directly on your loaded layer without converting in postigs/spatialite.
Postgis/spatialite use the same liblwgeom to do ST_MakeValid
you have to install liblwgeom and configure processing provider to point to it
Simple dissolve by GeoDataFrame field (Aggregation with dissolve)
import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
continents = world.dissolve('continent')
But if we use as_index=False from Pandas DataFrame.groupby
continents2 = world.dissolve('continent', as_index=False)
Try the Dissolve tool. From the help:
Use the Dissolve tool when you want to aggregate features based on a specified attribute or attributes. For example, you could take a feature class containing sales data collected on a county-by-county basis and use Dissolve to create a feature class containing contiguous sales regions based on the name of the ...
A Dissolve operation will usually reduce the number of features, arcs and nodes within a layer, particularly for layers with significant lengths of shared boundaries. Since the time spent during a Buffering operation is highly dependent on the number of nodes, pre-processing with Dissolve may significantly reduce the running time (and memory requirements). ...
If memory use is your prime concern, then lots of little (low vertex count) features is probably going to be more to your liking than a few very large (high vertex count) features. But you may find that "too many features" may eventually overwhelm even "too many vertices" for processing speed.
If you think about how the algorithms must be structured to ...
I've devised a way of doing it with little bits from all of the other answers.
The scripts that @GeoJohn and @FelixIP have created may well work (if you have access to ArcGIS 10.1 and the database access functions), so if someone else had this problem please check those options out as well.
I did the following in the end:
Created a very small buffer ...
This sounds like you need to look at the Summary Statistics tool which I find to be a bit of a Swiss Army Knife in that it comes with a Basic (formerly called) ArcView level license and can often be used in place of Frequency (that needs Advanced/ArcInfo) and PULLITEMS (that needs ArcInfo Workstation:-) to reorder fields.
The Dissolve tool can create a Godzilla by combining smaller (but still fairly large) features into one feature. This is known as the combinatorial problem. The Dissolve tool has logic that prevents it from creating a Godzilla (you’ll receive the warning code 000059) but this logic is based on the machine’s available memory at the time Dissolve is run. So, ...
Yes, I still get that sometimes. Very annoying! Try using the v.clean function from the GRASS plugin (you can also access this from the Processing plugin if installed). This tends to remove errors (if any) from your layer then try running Dissolve again.
You can also use the Check Geometry Validity via Vector > Geometry Tools > Check Geometry Validity to ...
I tested your shapefile and used GRASS algorithm v.clean from the Processing Toolbox. I applied snap as the cleaning tool and used a threshold of 5 which seemed to have cleaned up your shapefile a fair bit.
This is your original shapefile loaded:
This is it cleaned using GRASS (notice the little yellow polygon that was dissolved originally but is now ...
This can be easily accomplished using PostGIS. Preview the results using a modified version of the query below:
SELECT a.id, b.id, ST_Area(a.shape), ST_Area(b.shape)
, 100*(ST_Area(ST_Intersection(a.shape, b.shape))/LEAST(ST_Area(a.shape), ST_Area(b.shape)))::numeric(5,2)
, ST_Union(a.shape, b.shape) as new_shape
ST_Collect function is an "aggregate" function in the terminology of PostgreSQL
"SELECT ST_Collect(GEOM) FROM GEOMTABLE GROUP BY ATTRCOLUMN" will return a separate GEOMETRYCOLLECTION for each distinct value of ATTRCOLUM
ST_Collect is much faster than ST_Union
You say that need to "... form one large polygon from the single outer ring that contains all the polys...". The ST_ExteriorRing do this,
FROM GEOMTABLE GROUP BY ATTRCOLUMN
You can use ST_Union(), as suggested, or test with ST_Collection().
NOTES: to avoid little lops or "broken geometries" you can ...
Use GRASS GIS command v.dissolve (in Sextante plugin -> GRASS Commands -> Vector)
If I quickly reproduce you example:
The result with v.dissolve:
The problem is easy to understand. A shapefile has no topology, if two areas shared a common border that border would be digitized two times and also stored in duplicate.
You see this clearly when ...
I had the same issue. I solved it by saving the post-join shape file down and then dissolving after that. Make sure you have the correct vector layer selected in the dissolve prompt to get your new fields.
Dissolve may or may not create multi-part features. Features which share common geometry (such as two separate lines with a common endpoint, or two adjacent polygons with a common edge) will be combined regardless of whether multi-part creation is allowed. Multi-parts (if allowed) will result from any non-connected geometry. You will probably still end up ...