All Questions
108
questions
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 ...
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
78
views
How to match the coordinates of 2 shapefiles in R
I have 2 shapefiles, one of them has the coordinates of administrative units as a multipolygon, and the other has the coordinates of various sections of a border wall as a multilinestring. I am trying ...
1
vote
1
answer
104
views
Incorrect results when intersecting point and polygon data with sf in R
I’m getting bizarre results when I intersect some point data with polygons using the sf package in R, and while I think I’ve found a solution, I’m so baffled by the issue that I’d really appreciate it ...
0
votes
1
answer
99
views
sf error: OGR error: cannot export to WKT
I'm having issues running sf on my computer (R version 4.3.3, linux ubuntu 22.04.4). When trying to import a shapefile using st_read(), I am faced with the following error and warning messages:
> ...
-1
votes
1
answer
63
views
Count shapefile length (line) in each polygon of another shapefile (grid)
I am trying to quantify the length of a road network, on each cell of a lattice grid. Both my road network and my lattice grid are shapefiles, a polyline and a polygon respectively.
I would like to ...
2
votes
1
answer
117
views
R Shapefile not plotting lat/lon correctly
I'm having trouble plotting a shapefile correctly, it seems to have the geometry and projection recognised and I can see appropriate values in geometry$num (lat ~-34, lon ~153) but when plotted it is ...
1
vote
1
answer
92
views
Finding Subset of Polygon centroids Which Are Within A Certain Distance of the Centroids of Other Polygons in R
I am attempting to calculate summary statistics for the the administrative units within 5km of every administrative in a shapefile of Jamaica. I use dnearneigh() to find which administrative units ...
1
vote
1
answer
62
views
How to use CAST package for a shapefile (polygons) in R?
any help with the following is really appreciated!!
My goal: I need to run a lasso model for variable selection for my data (which is in sf polygon format).
My data: As said above, is a sf object. ...
0
votes
2
answers
370
views
How to merge two polygon elements into one?
I have the shapefile below containing information on Moroccan provinces. The shapefile looks as follows:
> library(sf)
> library(ggplot2)
> morocco_shp <- read_sf("decoupage/...
0
votes
1
answer
767
views
Merging some of the polygon boundaries using sf in R
I am trying to plot the boundaries from this geojson file.
I am able to plot all the boundaries using sf in R. However, I would like to merge some polygons together - e.g., POL_STN_NM = PS RAJ PARK, ...
2
votes
1
answer
432
views
How define the cell size from a hexagonal grid?
I'm trying to create a hexagonal grid from a biome boundaries (cerrado, but it could be able to apply to any other political boundaries). In sf documentation I saw that it is possible to do it with ...
2
votes
3
answers
637
views
Overlaying two geom_sf with same data sources but differents variables types in ggplot
I want to overlay the plot 1 and 2 on the same plot.
They come from the same source and I want in the backgroung the plot 1 and add plot 2 with some transparency on top.
plot1= ggplot() +
geom_sf(...
1
vote
1
answer
507
views
Interactive map plotly from shapefile
I would like to create an interactive map, using the plotly package in R.
However, I face the issue now that my geodata is contained in a shx shapefile, which the plot_ly() function seems to have ...
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 ...