Questions tagged [sf]

The motivation behind the `sf` package is to provide a complete, standardized implementation of simple features in R, with links to GDAL, GEOS and Proj.4. There is a also https://gis.stackexchange.com/ for spatial R questions.

sf is a new R package for handling and analyzing spatial data in R. While various R packages are available that provide classes and methods for spatial data (e.g. sp, rgdal and rgeos), sf, which is developed by Edzer Pebesma and others, is intended to gradually replace the well known sp package. The motivation behind this package is to provide a complete, standardized implementation of simple features in R, with links to GDAL, GEOS and Proj.4.

1040 questions
9
votes
4 answers

R: Detect a "main" Path and remove or filter the GPS trace maybe using a kernel?

Is there a way to filter out those parts which don't belong to the main path? As you can see in the picture i would like to remove the crossed out part while keeping the main path. I already tried using zoo/rolling median but without success. I…
Andreas
  • 417
  • 3
  • 16
  • 32
9
votes
2 answers

How to change the size of an SF icon in a UIButton

Very simple question here. I'd like to change the size of an SF icon in a UIButton. I've tried doing this 20 ways to Wednesday. I tried setting the EdgeInsets - no dice I tried resetting the contentMode of the button's imageView - doesn't…
Rob Norback
  • 5,378
  • 2
  • 29
  • 34
9
votes
2 answers

How to get ride of polygon borders using geom_sf in ggplot2

This question has been asked before in an old thread, but the accepted answer does not currently work anymore in the current version of ggplot2. Here is a minimal example: library(ggplot2) library(rnaturalearth) world = ne_countries(scale =…
Miao Cai
  • 666
  • 4
  • 18
9
votes
2 answers

Using r sf::st_write to non-public schema in PostgreSQL

I'm trying to write a spatial table to a schema that is not the default public schema in a PostgreSQL db. library(sf) library(DBI) library(RPostgreSQL) library(spData) # PostgreSQL DB parameters host <- "myHost" port <- 5432 username <-…
mark
  • 431
  • 5
  • 16
9
votes
3 answers

Removing holes from polygons in R sf

Is there a way to remove holes from a polygon in R with the package sf? I would be interested in solutions that include other packages, too. Here's an example of a polygon with two holes. library(sf) outer = matrix(c(0,0,10,0,10,10,0,10,0,0),ncol=2,…
Duccio A
  • 1,011
  • 8
  • 23
9
votes
1 answer

Dissolving polygon features with the sf package

Dissolve is a common geoproccessing technique discussed as an sf approach here. I'm trying to replicate dissolve as it functions in ArcGIS. Consider counties by two groups in ArcGIS. The ArcGIS dissolve command yields two polygons, regardless of…
ReginaldMilton
  • 199
  • 1
  • 7
8
votes
3 answers

How to fix degree symbol not showing correctly in R on Linux/Fedora 31

Any map I make with: ggplot() + geom_sf() produces the expected map, but does not show the degree sign correctly, as appears from the following picture. The answer given in this answer on SO - degree symbol incorrect in map axis labels - does…
giocomai
  • 1,805
  • 13
  • 21
8
votes
1 answer

why does rbind() work and bind_rows() not work in combining these sf objects?

I've got some sf objects I want to combine. I've stripped them down to a single polygon each (rtmp and rtmp2) for the purposes of this question. rbind() and do.call(rbind,...) seem to work fine, but bind_rows() doesn't. Obviously I can work around…
Ben Bolker
  • 173,430
  • 21
  • 312
  • 389
8
votes
2 answers

Create polygons representing bounding boxes for subgroups using sf

I'm attempting to use the sf package and a piped/tidyverse workflow to generate bounding boxes based on groups defined in another column. I think it should work like below, but it seems like st_bbox is not respecting groups. I expect to receive…
Ben Carlson
  • 837
  • 2
  • 7
  • 16
8
votes
4 answers

r - Create linestring from two points in same row in dataframe

I was wondering if there is a way to create linestring from two points given in the same row in a dataframe in a new geometry column. In other words longitudes and latitudes of the two points are given in a dataframe like the following: df <-…
adl
  • 1,046
  • 6
  • 26
8
votes
1 answer

Setting Boundaries of Leaflet with sf geometry in R

I would like to use the sf package to extract a bounding box (e.g., st_bbox ) and pass these coords to a leaflet using fitBounds. What is the best way to do this? There is a similar post is here: I don't want to take an average of all coordinates…
KennyC
  • 405
  • 1
  • 7
  • 15
8
votes
1 answer

Find nearest features using sf in R

I'm wanting to find the nearest polygons in a simple features data frame in R to a set of points in another simple features data frame using the sf package in R. I've been using 'st_is_within_distance' in 'st_join' statements, but this returns…
mweber
  • 537
  • 1
  • 5
  • 14
8
votes
3 answers

circle around a geographic point with st_buffer

I would like to plot a circle 110 NM (nautical miles) around Dublin airport using sf package. (Later on I will intersect via st_intersect that with flight position reports from ADS-B.) I have defined a new unit for NM as…
espinielli
  • 568
  • 1
  • 4
  • 17
7
votes
1 answer

Reading shape file with sf::st_read fails to capture encoding UTF8

I want to read a shape file which is encoded in UTF8. It works fine when I read it using rgdal::readOGR but sf::st_read fails to get the correct Encode. Any suggestions on how to solve this? For a reproducible example, the shape file I'm trying to…
rafa.pereira
  • 10,729
  • 4
  • 59
  • 88
7
votes
1 answer

Extending ggplot2 with a custom geometry for sf objects

I am trying to create a new geometry for ggplot as described here, while adapting it to deal with Simple Features objects. As an example, let's take the same exercise of plotting the convex hull of a set of points. Thus, I wrote a new…
ƒacu.-
  • 477
  • 3
  • 9
1 2
3
69 70