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')) %>%
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 ...
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.
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 ...
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 ...
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 ...
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
Topology preserving means in practice that parts of the multilinestring meet after ...
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
shp = ogr.Open('input.shp', 0)
lyr = shp.GetLayer()
feat = lyr.GetFeature(0)
geom = feat....
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 ...
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 ...
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 ...
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 ...
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 ...
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).
You need to convert your SpatialPolygons class to a SpatialPolygonsDataFrame class. For example:
# Read shapefile
shp = 'C:/temp/myshp.shp'
myshp = readOGR(shp, layer = basename(strsplit(shp, "\\.")[]))
# Read shapefile attributes
df = data.frame(myshp)
# Simplify geometry using rgeos
simplified = gSimplify(myshp, tol ...
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.
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 ...
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, ...
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 ...
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!
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, ...
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 ...
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.