Hot answers tagged

27

I've analysed the geometry issues in the attached data, and it seems it does not ONLY have orphaned holes but also geometry validity issues. It's true that an orphaned hole is somehow a geometry validity issue, but rgeos does not handle it in the same way, as for orphaned holes, an error is raised, instead of a simple warning. As you indicate, they are hints ...


26

use vector ->geoprocessing tools --> dissolve: select shapefile and field (LEP_NAME in your case), choose name for new shapefile and you are done


23

Why don't you: Select the two polygons you want to intesect Enable Editing Edit-> Merge Selected Features Save edits


21

There's a couple of ways of going about this but you probably want to dissolve the features (Vector->Geoprocessing Tools->Dissolve). With dissolve you don't need to select anything first as it is all done from the attributes. So, let's say you have a field called 'Type' (for example). Then in your example your polygons would all be type 'A' (and you ...


21

If you do not need to merge topology, but just add new polygons, you can simply use: ab <- rbind(a,b) If you get a "non-unique Polygons ID slot values" error it means that the rownames of the objects are the same. To fix this you can use spChFIDs to change the rownames and associated slot relationships. Since the slots in the object use the rownames to ...


20

Start by converting them to raster formats (assuming they are in DEM format to start with): then use the 'Mosaic to New Raster' tool to combine the different rasters into a single one: Make sure that they are in the same units before mosaicing them or they will look really odd when you stitch them together. That's the basic approach I use, I'm assuming ...


20

Super easy solution provided by @mdsumner: library(sp) library(raster) library(rgeos) library(spatstat) library(rgdal) library(maptools) setwd("C:/...") a<-readOGR(dsn=getwd(), layer="pol.a") b<- readOGR(dsn=getwd(), layer="pol.b") # use union in {raster} package ?raster::union ab<-union(a, b) resulted in : class(ab) [1] "...


19

For GDAL there are datastores which contain layers. Some datastores, like the database ones or GML, can hold several layers but some others like shapefiles can only contain one layer. You can test with for example GeoPackage driver what happens if you do not use the -nln switch with a datastore that can contain many layers. ogr2ogr -f gpkg merged.gpkg a....


14

For images of the same location but different dates, I would rather talk about compositing than mosaicing (which combines images from different extents into a larger image). You will find a lot of details if you search "compositing" keyword, but here is a short summary: There are two main approaches for the compositing of time series: Best available pixel ...


14

You can create a vrt file with gdalbuildvrt or gdal_merge.py -of VRT and then run gdal_translate -of GTiff on that VRT. Like this, I had much faster results compared to gdal_merge with huge files. See this answer to a similar question: gdal_merge.py loads all files into memory before processing them. therefore it is not able to process large files if ...


13

You can use Mapshaper for this, and then dissolve from the command line: mapshaper --dissolve -i your_data.geojson


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

I would go for the Integrate tool which finds features that are within the given x,y tolerance. Afterwards use the Dissolve tool which should work fine for the adjacent polygons.


11

You could use the arcpy.Geometry() object's .union() method: >>> g1, g2 = [f[0] for f in arcpy.da.SearchCursor("BufferedPoints","SHAPE@")] >>> g1 <Polygon object at 0x1929f830[0x1929f920]> >>> g2 <Polygon object at 0x1929f730[0x1929f440]> >>> g3 = g1.union(g2) >>> arcpy.CopyFeatures_management(g3,"...


11

You could use this approach Then to: Ensure the correct shapefile type is selected (points, lines, or polygons). Select the folder where the two (or more) shapefiles you want to merge are located using the Browse button. Click browse next to Output shapefile, find your working folder, and name the output shapefile. Click OK.


10

You can also use the v.patch module under GRASS GIS commands. It's available in the processing toolbox. You can search for it when the dropdown at the bottom of the Processing Toolbox window is switched from "Simplified interface" to "Advanced interface".


10

One possible approach consists in the following steps: draw a buffer of 5m around points; dissolve the buffers which overlap; calculate the centroids of dissolved buffers. You can choose the tools with which you're more comfortable. Example For instance, using GDAL >= 1.10.0 compiled with SQLite and SpatiaLite you can calculate the buffer around your ...


10

According to the shapefile specification (page 4): All the non-Null shapes in a shapefile are required to be of the same shape type. The values for shape type are as follows: Value Shape Type 0 Null Shape 1 Point 3 PolyLine 5 Polygon 8 MultiPoint 11 PointZ 13 PolyLineZ 15 PolygonZ 18 MultiPointZ 21 PointM 23 PolyLineM 25 PolygonM 28 ...


10

The problem is with the dash (-) in the shapefile name. This restriction is from geoprocessing tool and not the shapefile name since you can have dashes in your shapefile name. Some Geoprocessing methods allow you to validate table (feature class) and field names. Consider using either the ValidateTableName or ValidateFieldName function to ensure your names ...


10

Have you already tested the 'Singleparts to multipart' tool in the processing toolbox? This should do the job.


10

Intersect the buildings with themselves Select By Location to only select buildings with overlaps: Dissolve the selected features Start editing on building and delete all selected features. Stop editing Append the dissolved features back to the buildings.


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

OK here's the answer. I have discovered the processing toolbox from which there was a simple solution: As per http://qgis.org/de/docs/user_manual/processing/console.html From the console you can get a list of all the algorithms available which contain the word "merge" by typing: import processing processing.alglist("merge") Then you could find out how to ...


9

I advise merging your shapefiles into a single folder (using a program or search/copy/paste or a small script such as the one Mark C recommends in the comments). Then use this rather elegant bit of code from gis-programming.com: as above, use: ogr2ogr merge.shp file1.shp to create a shapefile merge containing the data of file1 then: for %f in (*....


9

Shapefiles can store only single type of geometry (in your case either polygons or lines, not both). So, a shapefile cannot contain both lines and polygons. Another thing is that a single feature should have a discrete geometry type. Certain geometric operations cannot be performed on multiple geometry types without converting one or both of them. ...


8

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


8

It would be easier with arcpy. for i in range(10000): pol_list = [] for j in range(30): pol_list.append("a" + str(i*30 + j + 1) + ".shp") arcpy.Merge_management(pol_list, "b" + str(i+1) + ".shp") EDIT: for a feature class inside a geodatabase, you don't need the + ".shp" anymore, and you can define the workspace using : arcpy.env....


8

You need to first assign the ListFeatureClasses() to a variable so you can call it later for the merge import arcpy, os arcpy.env.workspace = r'W:\S&P\s&p techs\Emily\TownshipsDissolved\FinalDissolved.gdb' fcs = arcpy.ListFeatureClasses() for fc in fcs: arcpy.AddField_management(fc, "Name", "TEXT", field_length = 50) with arcpy.da....


8

This is a pretty long standing problem with the gdal_merge tool accessed through the user interface. The easiest way to get around it is to first build a virtual raster (VRT) file and then (if necessary) convert this to a geotiff. If you have lots of files it is more stable and faster to use the OSGeo4W shell to build the VRT rather than using the tool ...


8

The good news is you can achieve this without 'learning' Python coding. The bad news is, you still need to use Python code! Open a fresh instance of ArcMap, go to the Geoprocessing menu and select Python. This will open the Python window. Since there are so many datasets to be added (and therefore drawn), I recommend pausing the data view before proceeding. ...


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