Skip to main content
The 2024 Developer Survey results are live! See the results

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 vote
3 answers
67 views

Customize malaria atlas project autoplots

I am trying to plot some data from the Malaria Atlas Project. Therefore, I looked in the vignette and used an example for getting started: if (!require("malariaAtlas")) install.packages(&...
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 ...
0 votes
1 answer
200 views

Is there a way to provide a relationship between many variables displayed in facets in tmap? E.g. showing multiple variables on one interactive map

I am trying to show the population of all different age groups in a map. Is there a way to show this information NOT in facets. But instead group together on a single interactive map? Below is a ...
1 vote
1 answer
144 views

How to subsample a file of type SpatialPolygonsDataFrame in R without losing the properties of the shp file

I'm new to programming in R and I want to make an interactive map from two files, one is a .shp that you can download from here: https://www.ine.es/ss/Satellite?L=es_ES&c=Page&cid=...
0 votes
2 answers
270 views

Reproject Canary Islands sf data to the same projection of Spain boundary map using mapSpain

I have a sf object with some drought data of Spain, and I want to project this data into a leaflet map. The data source is: https://www.miteco.gob.es/es/biodiversidad/temas/desertificacion-...
0 votes
1 answer
182 views

Object Temp_Map not found while trying to render a Leaflet Map

I know this question has been asked a lot of time, but every question varies according to the code/purpose. That being said I am creating shiny app that: Allows the user to upload a shapefile (...
0 votes
1 answer
228 views

Shiny Leaflet not being able to pick user uploaded shapefile(sf_object) data path

I am creating a shiny app that: Allows the user to upload a shapefile (sf_object) "filemap" (I am assuming sf wants all the files associated with a shapefile exported from ArcPro). Based on ...
2 votes
1 answer
312 views

Issue plotting generated polygon grid to leaflet

I am trying to create a polygon grid to plot in leaflet, but am running into an error that I cannot seem to figure out: library(leaflet) library(raster) library(sf) library(rgdal) r <- raster(ext =...
0 votes
1 answer
771 views

How to visualize sfc_Multipolygon in Leaflet R?

I am trying to visualize countries as members of international organizations (EU and Commonwealth) in leaflet. I managed to plot them with base function plot() but in leaflet, technically, this should ...
1 vote
1 answer
604 views

Calculate average distance between all points in radius and reference point

I have spatial data and would like to create a new column in my dataframe that calculates the average distance to neighboring coordinates within a radius of my choice. I found this code that gets me ...
0 votes
1 answer
139 views

Click on a polygon of a leaflet map and subset the same dataset which is displayed in table

I have the shiny app below with this sf object and I want to use the leaflet package to create an interactive map with clickable polygons. When a user clicks on a polygon, the app will save and ...
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
2 answers
105 views

Cannot write shapefile to working directory from sp object using rgdal package in R 4.2.3

The rgdal package is not working anymore. I used writeOGR: writeOGR(occ_sp, species_set[i], driver = "ESRI Shapefile", dsn = dsn, overwrite = TRUE) but got this error: Error in writeOGR(...
0 votes
1 answer
39 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, : ...

15 30 50 per page
1
2 3 4 5
133