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.
r-sf
1,995
questions
0
votes
1
answer
20
views
How to group aggregate data based of latitude and longitude
I have 2 dataframes in R that both have this type of structure:
Lon
Lat
Measurement
5
7
15
5
8
20
The numbers in the actual dataframes are different from this example but I don't think that should ...
2
votes
1
answer
34
views
Coalescing two `POINT` columns gives a list-column instead of another `POINT` column
I have two tibbles, each with a geometry column. I want to merge those and make a sort of coalesce() but if I combine ifelse() with st_is_empty() I end up with a list column instead of a POINT column:
...
1
vote
1
answer
80
views
Issue projecting polygon that crosses dateline R
I have a polygon in a North America equal area projection and I would like to transform to unprojected long/lat. I would like to use it to crop a global raster in unprojected longlat.
The problem is ...
0
votes
1
answer
40
views
Tigris package produces error after R update: GDAL Error 1: PROJ: proj_identify: Cannot find proj.db
I recently updated R from 4.3.x to 4.4.1. I am now getting errors as follows:
mystates <- tigris::states(cb = T)
#> Warning in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, : ...
2
votes
1
answer
64
views
R and ggplot with st_crop: map cropping does not work as wanted
I am trying to plot only a part of the world map, limited by a square with limits lon (-30, 90) and lat (30, 82). When I try to crop the map with sf_crop, it does not return the desired square when ...
-1
votes
1
answer
72
views
Misaligned sf object in ggplot
I have two sf objects, which when plotting are slightly misaligned.
While initially the two objects have different CRS:
the first has: WGS 84
the second has: MGI / Austria GK East
I proceed, as ...
1
vote
1
answer
37
views
I would like to identify the primary administrative unit from the latitude and longitude coded in the dataset
I want to identify the primary administrative unit from the latitude and longitude coded in the dataset, and fill that administrative unit with red
What I tried:
library(rnaturalearth)
library(sf)
...
0
votes
1
answer
37
views
`purrr` mapping of `st_intersects()` using inputs from across two lists
I have a list of geocoded point dataframes that I want to intersect with a corresponding list of polygon geometry dataframes. Below is a reprex to create the data structure:
library(dplyr)
library(...
2
votes
1
answer
35
views
Rotating/angle of ggplot key_glpyh, custom legend key glyph
I am trying to emulate a plot style ive seen online, created by Chris Canipe (https://www.axios.com/2017/12/15/the-flow-of-goods-between-states-1513304375). Looking at trade flows, I've managed to ...
0
votes
0
answers
53
views
How to create a 'count' choropleth map? Large dataframe with many different values overlain on separate geodatabase
I am aiming to plot a choropleth map (plotted using the polygons from a geodatabase) that will count the number of instances per region (wildlife management units) from a separate data frame (...
0
votes
1
answer
68
views
Removing white border plotting maps with geom_sf
I am attempting to remove the white borders around a facet plot that I created with geom_sf(). Previously I was using the now deprecated rgdal package and coord_cartesian(). I am trying to get a ...
0
votes
1
answer
57
views
Transform point into UTM 32N
i am coding with R and RStudio. I have a set of polygons in one in my global environment called buek250_shapefile. I am able to plot them with leaflet.
For the next step I wrote a function which gets ...
0
votes
1
answer
99
views
Merge two shapefiles in R, get a dataframe of variable value in each precinct
I'm not a GIS person, this is driving me nuts. I have a shp file of voting precincts. I have another shp file of radio broadcasts. I want to use R to geolocate the broadcasts into the precincts, so ...
0
votes
1
answer
74
views
I need spatial polygons representing the land and sea in a world map and then convert them to a dataframe
I need a world map in R that can be transformed into polygons of land to be able to calculate distances through sea from one point to another and going around land/polygons. These polygons need to be ...
1
vote
2
answers
79
views
Filter polygons on coordinates
I'm currently working with a shapefile that does not contain explicit latitude and longitude coordinates. My goal is to filter out areas with latitudes above 60 degrees. I want to delete the small ...