All Questions
36
questions
3
votes
2
answers
129
views
R: How to replace values in polygon geometry without a for loop?
I have over 60,000 building polygons footprints in shapefile format (polygonZ) where I need to replace the z values (for each ring) for all the polygon vertices, so that all the Z values for the ...
0
votes
1
answer
195
views
How to create (using R's sf) a spatial data frame whose geometry column is the difference between the geometry columns of other two data frames?
I have two spatial data frames that I've loaded using the sf package in R. In the first data frame I have (61) US counties, while in the second I have a subpart of each of these (61) counties. Both ...
1
vote
1
answer
136
views
How to convert Multipolygon column to sfc column? R
I´m having trouble converting coordinates data to sf format. I exported a csv file from QGIS with attributes of several political units with their respective coordinates. Because I'm working with ...
0
votes
1
answer
157
views
How to Calculate Avg of Metric within Radius on Map
I am working on a problem that uses data that resembles the following snippet:
name = c('A', 'B', 'C', 'D', 'E','F','G','H','I','J')
lat = runif(10,min=37,max=39)
lon = runif(10,min=-91,max=-89)
...
0
votes
1
answer
212
views
Import geometry column using R on PowerBi
I'm trying to import a gdb file into my PowerBi using R as follows:
library(readr, quietly = T)
library(sf, quietly = T)
library(dplyr, quietly = T)
library(tidyr, quietly = T)
...
-1
votes
3
answers
450
views
maps package in R: Where is geometry data stored?
I did quite a lot of research and did not find an answer to the following questions regarding the maps package in R:
(EDIT: I did not notice that it only works with ggplot2, as I still had this ...
1
vote
1
answer
1k
views
How can I combine two `sf` geometry fields into a single geometry field (of type GeometryCollection)?
I have two spatial descriptors for the same real world objects (we can simply call them "sites").
One consists of MultiPolygons (describing the broad frame of the site (areas_sf); the other ...
0
votes
0
answers
2k
views
Trying to export sf dataframe to .csv file in R with st_write
I have a sf dataframe which has geometry column looking like this:
geometry
list(list(c(53252.151421, 421516.3252...
list(list(c(53252.151421, 421516.3252...
list(list(c(53252.151421, 421516....
0
votes
0
answers
810
views
Trying a data frame to an sf object, function used: st_as_sf()
I am trying to execute following code as .R file in Azure batch service:
Data <- st_as_sf(data, coords = c("Longitude", "Latitude")) %>% sf::st_set_crs(4326)
and I am getting ...
2
votes
2
answers
775
views
How summarize points to linestring and keep dataframe columns in r?
I'm working with this code to turn a group of points into lines. But, in addition to the "sub_id" the rows have another "id" (column in input dataframe) that I would like to be ...
1
vote
1
answer
188
views
Tmap: school district map has been masked up with dark grey areas
Concerning my last post, I successfully plotted the school districts on a national map using the library tmap. Below is my attempt to plot the map. As you can see, this is far behind the reference (...
4
votes
1
answer
2k
views
Intersection keeping non-intersecting polygons in sf - R
I'm looking to intersect 2 spatial layers, keeping all the non-intersecting features as well.
My first layer is the SA2 from NSW, Australia, which look like
enter image description here
My second ...
0
votes
1
answer
196
views
Assign an sf geometry for each R row with specific filter creteria: what's wrong with my current code?
Suppose I have a dataframe test. What I want to do is assign a random geometry to the rows that cly == 8. For the other rows, I just leave it as NA
This is a reprex of my current code:
library(dplyr)
...
0
votes
0
answers
253
views
How to create an sf object which combines geometries to create a set of larger units (e.g., states from counties)
I have a shapefile (.shp) where each geographic unit is (the equivalent of) a county. I loaded it and called it gdfc. I would like to combine counties to create an sf object where each observation is ...
1
vote
1
answer
141
views
R SF: SF point automatically transfered to List after IFELSE justification, how should I recover it?
I am new to sf so I am not sure if this is a bug or I have done some unreasonable coding. Basically, I used to have a couple of sf object (which means if I code the class(geometry), R will return me ...