Questions tagged [r-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.

1940 questions
10
votes
0 answers

How to transform vertical z elevation coordinates in R sf

I have some spatial data recorded by a GPS/GNSS that includes Lat/Lon and Height Above Ellipsoid (HAE, meters) altitude values, all are referenced to NAD83(2011), EPSG:6318. I'm trying to convert the horz. to State Plane NY East (EPSG: 6537, which…
DarwinsBeard
  • 527
  • 4
  • 16
10
votes
1 answer

Plotting sf-type object in leaflet [r]

I would like to ask how to plot sf object in leaflet from leaflet package I am aware about mapview package that can plot it however I prefer using lealfet package. I provided example down…
Petr
  • 1,606
  • 2
  • 14
  • 39
10
votes
4 answers

How to filter an R simple features collection using sf methods like st_intersects()?

SF is the R-Spatial package designed to work with tidy syntax like dyplr and pipes. I would like to do a simple spatial filter on a simple features collection object. Given a simple features collection, I would like to return all features from the…
jmw
  • 443
  • 3
  • 9
10
votes
1 answer

How do you change fill color for different calls of geom_sf?

I'm working on plotting sf objects in ggplot2. I have a set of polygons buffered that have a density value for each polygon density. I want to plot this along with a single sf point GPS_point as a reference point. The problem I am running into is…
David
  • 195
  • 1
  • 1
  • 10
10
votes
1 answer

What unit is the `dist` argument in `st_buffer` set to by default?

I have the following map of Mexico. It shows all of its municipalities and around 400 weather stations. I want to create a 10km buffer around each station and eventually, associate each municipality to a station that is located within each…
Arturo Sbr
  • 5,567
  • 4
  • 38
  • 76
10
votes
2 answers

How to change alpha in geom_sf?

Is there a way to change alpha with geom_sf? This example is from the examples in ?geom_sf. I tried adding alpha=.2 but it seems to ignore that aesthetic, although alpha is an accepted aesthetic for geom_line. It does not ignore alpha for the fill -…
Dambo
  • 3,318
  • 5
  • 30
  • 79
10
votes
2 answers

Format multiple geom_sf legends

I am dealing with multiple sf geometries in ggplot and would like to display legend in the form of a point, a line, and a square (for the polygon). However, geom_sf legend combines my geometry features (i.e. combining line and point) displayed…
Jane
  • 579
  • 5
  • 17
10
votes
1 answer

Efficient way to plot data on an irregular grid

I work with satellite data organized on an irregular two-dimensional grid whose dimensions are scanline (along track dimension) and ground pixel (across track dimension). Latitude and longitude information for each centre pixel are stored in…
stm4tt
  • 755
  • 1
  • 5
  • 22
10
votes
1 answer

polygons from coordinates

I've got a data.frame with lats and lngs that define the boundaries of rectangular boxes, like so geohash north_lat south_lat east_lng west_lng 1 gbsuv 48.69141 48.64746 -4.306641 -4.350586 2 gbsuy 48.69141 48.64746 -4.262695…
RoyalTS
  • 9,545
  • 12
  • 60
  • 101
9
votes
1 answer

Making a diagram map in r?

This is my dataframe: df: Country Total lon lat United Kingdom 5000 -3.43597 55.37805 China 4000 104.1954 35.86166 France 4000 2.213749 46.22764 Australia 4500 …
user19239587
9
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
  • 3,043
  • 21
  • 24
9
votes
1 answer

Plotting lines between two sf POINT features in r

I have two spatial features: library(sf) points1 <- data.frame(foo = seq(15, 75, 15), long = c(-85, -80, -78, -75, -82), lat = c(34, 36, 37, 38, 35)) %>% st_as_sf(coords = c('long', 'lat'), crs =…
Anthony W
  • 1,289
  • 2
  • 15
  • 28
9
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
  • 666
  • 1
  • 6
  • 19
9
votes
2 answers

whole earth polygon for world map in ggplot2 (and sf)

When plotting world maps there is a problem with ggplot2: it colours the whole background with the same colour, including the corners of the plot which aren't actually part of the globe, see the snapshot below produced by the following code (it uses…
espinielli
  • 666
  • 1
  • 6
  • 19
8
votes
3 answers

Improving positioning of map / polygon labels

This is an extension to Improve centering county names ggplot & maps and ggplot centered names on a map. It is not only a theoretical problem, I came across that particular case on answering How merge specific states together by group with one label…
tjebo
  • 21,977
  • 7
  • 58
  • 94