All Questions
53
questions
0
votes
2
answers
130
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
0
answers
351
views
How do I find references to maptools, rgdal, or rgeos, in my R-package? sf is the only spatial analysis package in the namespace
In my R package I replaced calls to other spatial analysis packages with sf functions, but still get a message: "The legacy packages maptools, rgdal, and rgeos, underpinning this package will ...
0
votes
0
answers
236
views
Issues with st_intersection or st_difference to cut polygons spread outside USA
I have a following use case to cut/diff the polygons that spread outside the boundary. I am trying to migrate from rgdal package to sf packages as they are expiring. The code below works fine.
...
0
votes
1
answer
261
views
How to create a spatial gridlines using Latitude and Longitude in R
How to create a gridline of 7*7 sqkm using Latitude and Longitude values. These values should be the centroid value of a single square in the grid. I am not sure if I am doing it in the right way. I ...
0
votes
0
answers
187
views
How can I use write_sf in R to limit the number of decimal places in the DBF?
I have had issues with writing new shapefiles and limiting the number of decimal places in the DBF file. My code is rather simple :
write_sf(temp_points, "temp_points.shp")
and even though ...
1
vote
0
answers
394
views
How to optimize speed in spatial thinning in r
The problem
I am embarking on a project were I will need to build more or less
30,000 species distribution models (SDM), and I have been testing several ideas. Right now my bottleneck is to speed up ...
0
votes
0
answers
41
views
Skewed geography plotting census shapefiles in R
I've pulled US census data by block and merged the block shapefile on it manually with the sf and rgdal packages. When I plot the resulting sf object it's showing a skewed map despite the crs ...
0
votes
2
answers
480
views
Converting WSG84 to UTM, rgdal alternatives
I have numerous existing scripts in which I used project() from the rgdal package to convert WSG84 Latitude/Longitude coordinates into UTM. rgdal has intermittently been giving me headaches by ...
0
votes
1
answer
1k
views
r - readOGR(), terra::vect and sf::st_read : cannot open shapefile while file.exists = TRUE and .shp, .dbf and .shx files in the same folder
I don't understand why I get the error : "Cannot open data source" while my path should have been at least once correct and that the .shp, .dbf and .shx files are in the same folder.
I've ...
0
votes
0
answers
71
views
st_extract in stars with bilinear = TRUE crashes R on mac with M1 chip
Apparently the bilinear extraction in st_extract from the stars package causes problems on a mac with the M1 chip. Does anybody found the problem and/or has a workaround? The function st_extract works ...
0
votes
0
answers
174
views
Longitude and Latitude of a shape file
I created a data frame (projects) by merging a shape file (US Zip codes) and a dataset. The below line of code returns the X and Y coordinates of my data frame (project)! I Would like to include ...
0
votes
1
answer
385
views
Dissolving polygons by distance - R
I'm quite new to geospatial analysis in R and need help with dissolving polygons based on their location.
I have a shapefile with about 1500 polygons. Each polygon has a property code. There are a ...
0
votes
1
answer
2k
views
Trouble installing package "sf" in R (Big Sur)
I tried to install the sf package because it is a dependency for tidycensus, which is the package I'd like to use.
I am using a Mac with Big Sur. Per the Github for r-spatial, I tried following the ...
2
votes
1
answer
864
views
Extracting Long/Lat from a shapefile and calculating nearest distance between two sets of coordinates
I have two sets of data that I'm working with. The first is a list of addresses and their respective Longitude and Latitude coordinates:
First is the list of addresses and their long/lat coorindates:
...
1
vote
1
answer
254
views
How to extract random coordinates from some place keeping its own geometric form?
I'd like to get random coordinates into the red bounded area:
The code below is what I've tried so far but I'm not sure if this does what it is supposed to do since this is a mix of a few codes and I'...