Hot answers tagged

13

Since your symbol are quiet simple, you can use a simple marker and set the blending mode to lighten


13

This is typically a result of the the borders not fitting perfectly one next to another (and this is very easy to get with floating point coordinates). As an example, I use the world dataset available in geopandas, and take the unary union of the Africa continent: import geopandas gdf = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))...


11

Using GDAL >= 1.10.0 and its OGR Virtual Format, we can write a VRT file named, for example, merge.vrt (see Example: Union layer (GDAL >= 1.10.0)): <OGRVRTDataSource> <OGRVRTUnionLayer name="unionLayer"> <OGRVRTLayer name="source1"> <SrcDataSource>source1.shp</SrcDataSource> </OGRVRTLayer> ...


11

QGIS 3.2 Thanks to new Union tool in QGIS 3.2, this has become quite easy!!! What we do, is just use Union and Aggregate tools. (1) Union (Processing Toolbox | Vetor Overlay | Union) (2) We obtain Union layer (now broken into 12 parts...sorry mostly hidden...) (3) Aggregate (Processing Toolbox | Vector geometry | Aggregate) Note: Group by expression ...


10

I believe the AreaOnAreaOverlayer is the transformer that performs the equivalent of an ArcGIS Union. Performs an area-on-area overlay so that all input areas are intersected against each other and resultant area features are created and output. The resultant areas have all the attributes of all the original features in which they are contained. ...


9

This is a very simplistic test, but I think it shows conclusively that Merge+Dissolve is about 3 times quicker than Union+Dissolve on this dataset, and I believe that as more complex data is thrown at it, the difference will only widen. import arcpy,time if arcpy.Exists("C:/temp/test.gdb"): arcpy.Delete_management("C:/temp/test.gdb") arcpy....


9

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 ...


9

I would look into using ST_ClusterDBSCAN. I have had tremendous success using this function to solve many cluster like geometric problems. WITH clusters AS(select st_clusterdbscan(geom, 0, 2) over() cluster_id, geom from table ) select st_union(geom) geom from clusters where cluster_id is not null group by cluster_id union select geom from clusters ...


8

St_Union comes in two flavors, aggregate and simple. In your query you are using the simple one that is creating the union of two single geometries. What you are doing is cross joining your two tables, and make union of every combination of the geometries of your two tables, resulting in n*m multipolygons, where n is the row count of your first table and m ...


7

SQL: UPDATE coverage SET the_geom = ST_Union( (SELECT the_geom FROM coverage WHERE id = :polygon_id), (SELECT the_geom FROM coverage WHERE id = :sliver_id) ) WHERE id = :polygon_id; Is that what You meant?


6

An index is used to filter a query using the "WHERE" part of the statement. A GiST index is not used by ST_Union. Without a "WHERE" part, then no filtering (or index) is required to return the result, and the query just chugs through all the rows in the query. As described in the manual, not all functions make use of indicies, for example ST_Distance and ...


6

You can do this in QGIS, there is a Merge shapefiles to one function. This, compared to Union which only combines 2 layers, combines multiple shapefiles (selected either individually or by a directory) into one, contains additional results if there are any overlaps and no attribute fields are lost in the final layer. First install the fTools plugin: Once ...


6

You can group points using either the recursive query or PL/PLGSQL procedure described in the answers to this question. Just substitute ST_DWithin for ST_Intersects/ST_Touches, as appropriate. If you're comfortable trying something experimental, you could build PostGIS with purpose-built functions to solve this problem: see the ticket on trac (code ...


6

Assuming you have Postgis 2.2, you can use ST_ClusterWithin for this purpose. ST_ClusterWithin takes a geometry and a tolerance and returns GeometryCollections of all the geometries that are within a certain distance. You can use the tolerance as a proxy for the percentage overlap, assuming your buffers are all the same size. Once you have returned the ...


6

Your file "25015_f_padus" is a multipart shapefile, you need to convert the file to a single part shapefile before running the union tool. Go to Vector -> Geometry tool -> Multipart to Singleparts to create single part file. Then use union tool. Here is the final output:


6

Here's a function that takes an sf polygons object and clusters all features within a threshold distance, then merges the features. So starting with N features you end up with M<=N features: library(sf) library(sp) library(rgeos) clusterSF <- function(sfpolys, thresh){ dmat = st_distance(sfpolys) hc = hclust(as.dist(dmat>thresh), method="...


6

I would suggest using the join attribute by location Here is a few images of the dialog you would encounter. Also, you could use the Spatial Query plugin which is now a core plugin in QGIS and the NNJoin plugin as ways to tackle your issue. Spatial Query Plugin The spatialquery Spatial Query Plugin allows you to make a spatial query (i.e., select ...


6

Thanks a lot to @Vince for the hint. Just added rounding (PostGIS: ST_SnapToGrid(geom, 0.000000001)) to my query and now it get's recognized as one polygon. Downside of this is that my accuracy of the borders of the polygons is now 0.1 millimeter instead of 1 nanometer, but that's totally okay.


5

You can prefix all shapefiles with the folder that they are found within. A simple model as shown below can achieve this. So your initial folder file structure may be this: After running this model all shapefile will be prefixed with the folder they they are found within (e.g. T2_myData.shp). Your data then has unique names so they will be valid input for ...


5

You say that you are using a "site license" but not whether your license level of ArcGIS for Desktop is Basic, Standard or Advanced. If it is Advanced then Union will allow you to use more than two input feature classes. If it is Basic or Standard then you will need to do pair-wise Unions and then Union the results instead. To have the original FID for ...


5

Without knowing your column names, this is my best guess. (I have not had a chance to test, so it may not be exactly right.) Hopefully you can suss out the column names I used. Assuming L is a subset of U: SELECT l.id AS l_id, u.ab AS uab, l.abc AS labc, ST_Intersection(u.geom, l.geom) AS geom FROM u, l WHERE ST_Intersects(ST_PointOnSurface(l.geom), u....


5

You are spot on, this is called "tiled processing of large datasets", as explained here To improve the performance and scalability of feature overlay tools such as Union and Intersect, operational logic called adaptive subdivision processing is used. The use of this logic is triggered when data cannot be processed within the available amount of ...


5

Export your table to a text format. Grab the header row and paste it to a new file. Delete irrelevant column headings (could also turn them off prior to export to avoid this step), and then use find/replace functions to change the delimiting characters to proper syntax for the formula (ie quotes around field names, a plus sign in the middle). Copy and paste ...


5

You could avoid the need for a recursive query by taking the following approach: From each input LineString, extract the endpoints into a two-point MultiPoint Run ST_ClusterWithin on the extracted endpoints Spatially join the endpoint clusters to the original geometries. Here's an example: CREATE TABLE test_lines (id serial, geom geometry); INSERT INTO ...


5

As long as you are using PostGIS or the Python shapely module, your union operation is being computed by libgeos. GEOS already optimizes the union operation by taking advantage of the relative locations of geometries, using an algorithm called "cascaded union," which is well described in a blog post by its author. From my experience, your best options for ...


5

def FillInfo(Info,Info_WB,Info_UESG,Info_GB,Info_Moo,Info_HHS,Info_PT,Info_SN,Info_SA): returnItems = [Info_WB,Info_UESG,Info_GB,Info_Moo,Info_HHS,Info_PT,Info_SN,Info_SA] returnItemsClean = [i for i in returnItems if i] return ','.join(returnItemsClean) The explanation of what the join method does from the Python docs: string.join(words[, ...


5

You don't necessarily need to merge your vector layers. Your title actually comes close to what you want, which is to perform a union. Starting with inputs layer a and layer b, both of which have a field value, select Vector > Geoprocessing tools > Union. For example, here are two overlapping layers, A (blue) and B (red), symbolized by their value field. ...


5

For the geometry you can use the unary_union (Shapely unary_union) predicate. The method will split all self-intersection geometries (Planar Graph) # unary union of all the geometries of the GeoDataFrame lines_gdf.geometry.unary_union <shapely.geometry.multilinestring.MultiLineString object at 0x10cc20e10> lines_gdf.geometry.unary_union.wkt '...


5

You are looking for ST_Union; the function will attempt to dissolve the aggregated geometries: SELECT ST_Union(<polygons>) AS geom FROM <table> GROUP BY region ;


4

I think you should use ST_Dump to disaggregate your Multi-part polygon created in your step (1): SELECT ST_Dump( ST_Union(ST_SnapToGrid(the_geom,0.0001)) FROM parishes GROUP BY county_name );


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