We’re rewarding the question askers & reputations are being recalculated! Read more.
16

You can cast an sf object to sp, for packages that don't yet support sf - I do this a fair bit for raster/polygon interactions. So you could do: simplepolys <- rmapshaper::ms_simplify(input = as(sfobj, 'Spatial')) %>% st_as_sf()


14

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


11

QGIS uses the Douglas-Peucker algorithm (slightly modified to handle closed loop like polygons, I think) and the unit of the tolerance parameter is the same as the unit of the reference system. Points are removed if the distance with the tentative simplified line is smaller than the tolerance.


10

Both ArcGIS and PostGIS use the Douglas-Peucker algorithm for simplification. This performs what ESRI calls point-remove simplification. ESRI also does a bend simplify which uses shape recognition (Wang) and not Douglas-Peucker. Therefore, assuming you are using point-remove for your simplification in Arc, there are two options to explain the differences ...


10

In traditional cartography, marker clustering is called aggregation or sometimes amalgamation. It is part of model generalization: When zooming out, some detailed concepts (e.g. the tree) disappear to be replaced by less detailed aggregated forms (e.g. the forest). Many good examples can be found in good cartography books. Here are two examples from this ...


8

For a non-ArcGIS method, you could try QGIS - the "Simplify Geometries" tool under the Vector menu should do what you want!


8

Coerce your object to the appropriate Spatial*DataFrame-class (Points/Lines/Polygons), e.g. for SpatialPolygons using as(x, "SpatialPolygonsDataFrame" ): R> l <- readWKT("LINESTRING(0 7,1 6,2 1,3 4,4 1,5 7,6 6,7 4,8 6,9 4)") R> x1 <- gSimplify(p, tol=10) R> class(x1) [1] "SpatialPolygons" attr(,"package") [1] "sp" R> x2 <- as(x, "...


7

There's a lot of options and in fact I struggled through the same question a while back on some of my applications. And for our different products we ended up with different solutions. So you have to ask yourself Are all of the singleton icons on the map of the same "kind" - same shape and color? If they're not, do they all live on 1 layer, or multiple ...


7

Current manual text at http://gdal.org/ogr2ogr.html is -simplify tolerance: (starting with GDAL 1.9.0) distance tolerance for simplification. Note: the algorithm used preserves topology per feature, in particular for polygon geometries, but not for a whole layer. Topology preserving means in practice that parts of the multilinestring meet after ...


7

Take a look at these tools: Generalize (Editing) or Simplify Polygon (Cartography) Input your features, and an optional tolerance.


6

You could simply union with the original polygon after simplification.


6

If you look at the link you provided, you will see that Simplify is a method of the OGRGeometry class. In Python, Simplify is a method (member-function) of ogr.Geometry. OGRGeometry * OGRGeometry::Simplify ( double dTolerance ) const #! /usr/bin/python import ogr shp = ogr.Open('input.shp', 0) lyr = shp.GetLayer() feat = lyr.GetFeature(0) geom = feat....


6

From the Processing Toolbox, search for and run the "Keep n biggest parts" algorithm. If you set "To keep" as 1, you'll only get the largest part in the output.


5

This is a really interesting question, especially in the context of today where the quest is usually for more detail, higher resolution, etc. To directly answer your question, I think you are performing the exact correct operation. As I see it, the reason for generalizing a layer is to reduce the size and complexity, for performance reasons. This might be ...


5

You might obtain some inspiration from sunflower plots. This method, which has been in use for decades to represent clusters of points on scatterplots, capitalizes on research in visual cognition to produce markers that are rapidly and correctly discriminated as well as clearly related to the sizes of the clusters they represent. Here's an example done in ...


5

One technique you could use to remove noise from a binary raster is to use Expand and then Shrink from the Spatial Analyst toolbox. By expanding by n you will fill any holes of less than n * 2 cells wide (holes are filled from every edge), and then the shrink will return your boundaries to (mostly) original values (you'll lose noise around the edge of the ...


5

That would be a huge dissolve. You could try first simplifying on the raster version, then converting that to vector and doing further simplification. http://docs.qgis.org/2.6/en/docs/training_manual/rasters/terrain_analysis.html#moderate-fa-simplifying-the-raster A couple ways to simplify the vectors via gdal: in ogr2ogr you can use the -simplify # command ...


5

Update I'd just like to expand on my solution a bit here for anyone who may be having a similar issue. @neuhausr was dead on. I realized that setting the threshold to a low number, say 10 or 50 wasn't quite enough, while a higher number would compress it too much while leaving some areas untouched. Strangely enough, I found that if you compress it with the ...


5

The tolerance is a threshold that will usually determine the distance in which multiple nodes may be reduced into a single node or more. The documentation says the input for tolerance is a number and FWIW it represents map units from the coordinate reference system (ie, metres).


5

You need to convert your SpatialPolygons class to a SpatialPolygonsDataFrame class. For example: require(rgdal) require(rgeos) # Read shapefile shp = 'C:/temp/myshp.shp' myshp = readOGR(shp, layer = basename(strsplit(shp, "\\.")[[1]])[1]) # Read shapefile attributes df = data.frame(myshp) # Simplify geometry using rgeos simplified = gSimplify(myshp, tol ...


5

For an FME solution, the most useful transformer would probably be the Generalizer. It has several algorithms grouped into four types. Here's a list of algorithms: From the documentation: Generalizing algorithms: Reduce the density of coordinates by removing vertices. Smoothing algorithms: Determine a new location for each vertex. Measuring ...


5

I'm working with our local cycling group to anonymise GPX files on two criteria (primarily for security). I've never come across a standard way of anonymising data but this satisfies two concerns of our members, while preserving accuracy along roads and speed information: Personal locations, removing 'private' areas for individuals; Obscuring timestamps so ...


5

You can simplify your polygons using two ways: Without topology support: just transform polygones to lines, simplify, rebuild the polygons and reattach attributes with Point in Polygon. You will find a first recipe on the PostGIS wiki With topology support. There is another recipe available on the PostGIS wiki. IMO, it's the recommended way. In both case, ...


5

Simplifying and smoothing operations are related to the QgsGeometry() Class: this means that you can run them when dealing with the geometry of the current feature. As far as I know, the Simplify geometries algorithm literally simplifies the current geometry by reducing the number of vertices on the basis of a tolerance value (so, there isn't any particular ...


4

In PostGIS 2.2 with SFCGAL, this can be done with ST_StraightSkeleton or ST_ApproximateMedialAxis, depending on your criteria.


4

You should certainly apply a ramer-douglass-peucker filter to your lines. It is available in PostGIS as the ST_Simplify function. The version with topology preservation may be of interest for your case. Good luck!


4

You can digitize the border of the polygon. Just make sure of a) Set the proper snapping options at settings/snapping options for this case I will snap on the vertex of the existing polygons with a tolerance of 15 pixels. More important, I set that I do not want intersection of new polygons (avoid intersections) Once you have set that, select your layer, ...


4

As the Douglas Peucker algorithm works by iteratively removing those points that are within a given tolerance from some line between two other points in some given input unit, you can assume that if you have a geometry covering a large north-south distance, you will get greater amounts of simplification for a given tolerance in degrees as you move further ...


4

The best approach I guess is using real topology data. Then you can share the edges between data sets and simplify as much as you want. Here is an example from the man behind the topology implimentation in PostGIS. http://strk.keybit.net/blog/2013/03/08/on-the-fly-simplification-of-topologically-defined-geometries/


4

Try simplifying your polygon before running the smooth operation. Polygons with many nodes don't respond well to the Chaiken algorithm.


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