[R-sig-Geo] question for LMC
Dear all lists, I am xiaoji. I am interested in your ‘gstat’ package in r for fitting Linear Model of Coregionalization (LMC). But I have some questions and I really need your kind help. Could you please give me a favor? here is some of my data: SA2X_CENP SA2Y_CENP crash YP_rate 320428.917 5818141.198 117 0.1063 321879.5695 5817899.382 22 0.1092 318771.7939 5818451.477 11 0.1379 320635.3233 5820539.97 48 0.1649 318364.0546 5820648.928 1 0.2003 326033.2365 5817370.864 23 0.1649 323867.7281 5817573.52 60 0.1655 324383.5969 5819145.236 22 0.1632 316263.0477 5816879.653 17 0.184 315660.7089 5819792.038 27 0.1656 317796.8316 5816153.109 27 0.1578 316917.6342 5818154.401 14 0.1624 321086.4921 5814372.89 85 0.0598 318970.2645 5812389.57 22 0.0732 322330.8284 5812552.395 46 0.0608 316193.3299 5815654.364 2 0.1446 317484.9642 5814980.071 30 0.1473 320657.3469 5812907.924 236 0.0322 319195.0085814256.7 86 0.0969 319621.6781 5815829.549 53 0.0625 322418.9406 5810079.992 30 0.0778 321120.9463 5811505.149 63 0.0493 317081.5135 5813218.024 10 0 320865.432 5809358.484 79 0.1423 322840.6266 5805484.066 33 0.1397 318295.2402 5810141.976 18 0.14 316698.2992 5810889.514 5 0. 320230.4663 5810705.071 44 0.115 322323.3428 5807529.089 77 0.0754 323920.1083 5807043.912 40 0.1312 325877.0663 5808231.436 6 0.1408 323874.6983 5808622.809 57 0.0862 323631.454 5810052.96 73 0.0707 325570.0793 5809906.47 11 0.1161 Here is the code I run : library(sp) library(gstat) CD=read.csv("C:\\Users\\xiaoj\\Documents\\crash_standard_sd.csv") coordinates (CD) = ~SA2X_CENP+SA2Y_CENP g <- gstat(formula=crash~1, data = CD) g <- gstat(g,formula=YP_rate~1, data = CD) a_range=4 b_range=59000 v= variogram(crash~SA2X_CENP+SA2Y_CENP, CD) model<-vgm(NA,"Gau",a_range,NA,add.to = vgm(NA,"Per",b_range)) test<-fit.lmc(v, g, model) test The following is my questions. 1. I have some explanation of the data: variable “crash” is a count data and variable “YP_rate” is continuous, how should I run the correct code to fit LMC? 2. How do I to determine the values of a_range and b_range? I am looking forward to your kindly reply. Thanks for your time. Xiaoji _ Sent from http://r-sig-geo.2731867.n2.nabble.com ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Help with spTimer or spTDyn to estimate the Bayesian Gaussian Process Model
I am getting the following error when running the below script for the Bayesian Gaussian Process (GP) Model using spTimer or spTDyn #Error Output: GP models Error in spGP.Gibbs(formula = formula, data = data, time.data = time.data, : Error: Years, Months, and Days are misspecified, i.e., total number of observations in the data set should be equal to N : N = n * r * T where, N = total number of observations in the data, n = total number of sites, r = total number of years, T = total number of days. ###Script library(spTimer) library(spTDyn) library(tidyverse) library(ggmap) register_google(key="your key") getOption("ggmap") #Data to be analyzed is from plm package #It is a US States Production, which is a panel of 48 observations from 1970 to 1986 #A data frame containing : #state: the state #year : the year #region : the region #pcap : public capital stock #hwy : highway and streets #water : water and sewer facilities #util : other public buildings and structures #pc : private capital stock #gsp : gross state product #emp :labor input measured by the employment in non–agricultural payrolls #unemp : state unemployment rates #Get data data("Produc", package = "plm") glimpse(Produc) #Estimate Geolocation of states to account for spill over effects states_df <- data.frame(as.character(unique(Produc$state))) names(states_df)<- c("state") state_geo_df <- mutate_geocode(states_df, state) #from ggmap #Join the data Product_geo <- full_join(state_geo_df, Produc) glimpse(Product_geo) #Create the time series variable #number of state ns <- length(unique(Product_geo$state)) #number of year ny <- length(unique(Product_geo$year)) # I want to do Spatio-Temporal Bayesian Modeling Using spTimer or spTDyn #defines the time series in the Spatio-temporal framework ts_STD <- def.time(t.series=ns, segments=ny) ##Estimate the model using spTDyn package #Note spT.Gibbs in spTimer gives the same error GibbsDyn(gsp ~ pcap + hwy + water + util + pc , data=Product_geo, model="GP", time.data=ts_STD, coords=~lon + lat, nItr=5000, nBurn=1000, report=1, tol.dist=0.05, distance.method="geodetic:km", cov.fnc="exponential", spatial.decay=decay(distribution="FIXED"),truncation.para=list(at=0,lambda=2)) #Also how to deal with unbalanced panel #Delete some of the rows Product_geo$cond = with(Product_geo, if_else(state=="ALABAMA" & year==1971, 0, if_else(state=="COLORADO" & year==1971 | year==1973 , 0, if_else(state=="TEXAS" & year==1971 | year==1973 | year==1985, 0, 1 Product_geo_unb <- Product_geo %>% filter(cond==1) %>% select(-cond) glimpse(Product_geo_unb) #How to use GibbsDyn or spT.Gibbs for such unbalanced panel data to estimate the Bayesian Gaussian Process (GP) Model? ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Spatial joins between sf and stars objects
Although if I use bind_cols the result is not an sf object Julian M. Burgos writes: > Thanks Edzer, I should have checked if st_extract kept the order of the rows. > In this case, a way to do it more generally is: > > sf1 <- bind_cols(st_drop_geometry(sf1), > st_extract(st1, sf1)) > > > > Edzer Pebesma writes: > >> st_join does a spatial join, which comes at a cost; since st_extract >> doesn't change the row order of the sf object, you could as well use >> >> st_extract(st1, sf1) %>% mutate(nums = sf1$nums) >> >> On 03/02/2021 17:10, Julian M. Burgos wrote: >>> Dear list, >>> >>> What would be the best way to do a spatial join between a sf object (of >>> POINT geometry) and a star object, so the sf object gets the values of the >>> corresponding pixels in the star object? I have done using a combination >>> of st_join and st_extract, but it feels a bit clunky. Is there a better >>> way? >>> >>> Here is what I have done: >>> >>> ## -- >>> ## Load a stars object >>> st1 <- read_stars(system.file("tif/L7_ETMs.tif", package = "stars")) %>% >>>slice(band, 1) >>> >>> ## Create an sf object >>> >>> set.seed(100) >>> bb <- st_bbox(st1) >>> >>> sf1 <- tibble(lon = runif(n = 10, min = bb[1], max = bb[3]), >>>lat = runif(n = 10, min = bb[2], max = bb[4]), >>>nums = 1:10) %>% >>>st_as_sf(coords = c("lon", "lat"), crs = st_crs(st1)) >>> >>> ## Do the spatial join >>> >>> sf1 <- st_extract(st1, sf1) %>% >>> st_join(sf1) >>> ## -- >>> >>> Thanks, >>> >>> Julian >>> >>> -- >>> Julian Mariano Burgos, PhD >>> Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ >>> Marine and Freshwater Research Institute >>> Botnsjávarsviðs / Demersal Division >>>Fornubúðir 5, IS-220 Hafnarfjörður, Iceland >>> http://www.hafogvatn.is/ >>> Sími/Telephone : +354-5752037 >>> Netfang/Email: julian.bur...@hafogvatn.is >>> >>> ___ >>> R-sig-Geo mailing list >>> R-sig-Geo@r-project.org >>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-geo&data=04%7C01%7C%7C7b9230c283dd4883458a08d8c876e7d1%7C8e105b94435e4303a61063620dbe162b%7C0%7C0%7C637479760450605041%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=d%2FY%2FuSVIou5juUoKgSwCZc4EZ5OdEJRCg1YZHH%2FEYGc%3D&reserved=0 >>> >> >> ___ >> R-sig-Geo mailing list >> R-sig-Geo@r-project.org >> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-geo&data=04%7C01%7C%7C7b9230c283dd4883458a08d8c876e7d1%7C8e105b94435e4303a61063620dbe162b%7C0%7C0%7C637479760450605041%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=d%2FY%2FuSVIou5juUoKgSwCZc4EZ5OdEJRCg1YZHH%2FEYGc%3D&reserved=0 -- Julian Mariano Burgos, PhD Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ Marine and Freshwater Research Institute Botnsjávarsviðs / Demersal Division Fornubúðir 5, IS-220 Hafnarfjörður, Iceland www.hafogvatn.is Sími/Telephone : +354-5752037 Netfang/Email: julian.bur...@hafogvatn.is ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Spatial joins between sf and stars objects
Thanks Edzer, I should have checked if st_extract kept the order of the rows. In this case, a way to do it more generally is: sf1 <- bind_cols(st_drop_geometry(sf1), st_extract(st1, sf1)) Edzer Pebesma writes: > st_join does a spatial join, which comes at a cost; since st_extract > doesn't change the row order of the sf object, you could as well use > > st_extract(st1, sf1) %>% mutate(nums = sf1$nums) > > On 03/02/2021 17:10, Julian M. Burgos wrote: >> Dear list, >> >> What would be the best way to do a spatial join between a sf object (of >> POINT geometry) and a star object, so the sf object gets the values of the >> corresponding pixels in the star object? I have done using a combination of >> st_join and st_extract, but it feels a bit clunky. Is there a better way? >> >> Here is what I have done: >> >> ## -- >> ## Load a stars object >> st1 <- read_stars(system.file("tif/L7_ETMs.tif", package = "stars")) %>% >>slice(band, 1) >> >> ## Create an sf object >> >> set.seed(100) >> bb <- st_bbox(st1) >> >> sf1 <- tibble(lon = runif(n = 10, min = bb[1], max = bb[3]), >>lat = runif(n = 10, min = bb[2], max = bb[4]), >>nums = 1:10) %>% >>st_as_sf(coords = c("lon", "lat"), crs = st_crs(st1)) >> >> ## Do the spatial join >> >> sf1 <- st_extract(st1, sf1) %>% >> st_join(sf1) >> ## -- >> >> Thanks, >> >> Julian >> >> -- >> Julian Mariano Burgos, PhD >> Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ >> Marine and Freshwater Research Institute >> Botnsjávarsviðs / Demersal Division >>Fornubúðir 5, IS-220 Hafnarfjörður, Iceland >> http://www.hafogvatn.is/ >> Sími/Telephone : +354-5752037 >> Netfang/Email: julian.bur...@hafogvatn.is >> >> ___ >> R-sig-Geo mailing list >> R-sig-Geo@r-project.org >> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-geo&data=04%7C01%7C%7C38c8e24fcf1d4b6fa70308d8c86923d7%7C8e105b94435e4303a61063620dbe162b%7C0%7C0%7C637479701198004036%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Z7hRM4MwCwNdegSavTXPJIAlRGJ1DqUNAsm%2Fp9lPgeE%3D&reserved=0 >> > > ___ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-geo&data=04%7C01%7C%7C38c8e24fcf1d4b6fa70308d8c86923d7%7C8e105b94435e4303a61063620dbe162b%7C0%7C0%7C637479701198004036%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Z7hRM4MwCwNdegSavTXPJIAlRGJ1DqUNAsm%2Fp9lPgeE%3D&reserved=0 -- Julian Mariano Burgos, PhD Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ Marine and Freshwater Research Institute Botnsjávarsviðs / Demersal Division Fornubúðir 5, IS-220 Hafnarfjörður, Iceland www.hafogvatn.is Sími/Telephone : +354-5752037 Netfang/Email: julian.bur...@hafogvatn.is ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Spatial joins between sf and stars objects
st_join does a spatial join, which comes at a cost; since st_extract doesn't change the row order of the sf object, you could as well use st_extract(st1, sf1) %>% mutate(nums = sf1$nums) On 03/02/2021 17:10, Julian M. Burgos wrote: Dear list, What would be the best way to do a spatial join between a sf object (of POINT geometry) and a star object, so the sf object gets the values of the corresponding pixels in the star object? I have done using a combination of st_join and st_extract, but it feels a bit clunky. Is there a better way? Here is what I have done: ## -- ## Load a stars object st1 <- read_stars(system.file("tif/L7_ETMs.tif", package = "stars")) %>% slice(band, 1) ## Create an sf object set.seed(100) bb <- st_bbox(st1) sf1 <- tibble(lon = runif(n = 10, min = bb[1], max = bb[3]), lat = runif(n = 10, min = bb[2], max = bb[4]), nums = 1:10) %>% st_as_sf(coords = c("lon", "lat"), crs = st_crs(st1)) ## Do the spatial join sf1 <- st_extract(st1, sf1) %>% st_join(sf1) ## -- Thanks, Julian -- Julian Mariano Burgos, PhD Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ Marine and Freshwater Research Institute Botnsjávarsviðs / Demersal Division Fornubúðir 5, IS-220 Hafnarfjörður, Iceland www.hafogvatn.is Sími/Telephone : +354-5752037 Netfang/Email: julian.bur...@hafogvatn.is ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R-sig-Geo] Spatial joins between sf and stars objects
Dear list, What would be the best way to do a spatial join between a sf object (of POINT geometry) and a star object, so the sf object gets the values of the corresponding pixels in the star object? I have done using a combination of st_join and st_extract, but it feels a bit clunky. Is there a better way? Here is what I have done: ## -- ## Load a stars object st1 <- read_stars(system.file("tif/L7_ETMs.tif", package = "stars")) %>% slice(band, 1) ## Create an sf object set.seed(100) bb <- st_bbox(st1) sf1 <- tibble(lon = runif(n = 10, min = bb[1], max = bb[3]), lat = runif(n = 10, min = bb[2], max = bb[4]), nums = 1:10) %>% st_as_sf(coords = c("lon", "lat"), crs = st_crs(st1)) ## Do the spatial join sf1 <- st_extract(st1, sf1) %>% st_join(sf1) ## -- Thanks, Julian -- Julian Mariano Burgos, PhD Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ Marine and Freshwater Research Institute Botnsjávarsviðs / Demersal Division Fornubúðir 5, IS-220 Hafnarfjörður, Iceland www.hafogvatn.is Sími/Telephone : +354-5752037 Netfang/Email: julian.bur...@hafogvatn.is ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R-sig-Geo] merge ggplots into one with pipeline commands
Hi, I want to make one only ggplot by merging/joining a base ggplot and a ggplot resulting from a pipeline command (ddplyr). Here it is the reproducible example: # my base plot, for example: # https://rpubs.com/MRufino/Portugal p1 <- ggplot() + borders("world", fill="antiquewhite1", colour="antiquewhite4")+ coord_fixed(ylim=c(36.6, 42.0), xlim=c(-10 ,-7))+ theme_minimal()+ theme(panel.background = element_rect(fill = 'powderblue'), panel.grid.major = element_blank(), panel.grid.minor = element_blank())+ xlab("Longitude")+ ylab("Latitude") p1 # now, if I want to add this plot to another ggplot resulting from a pipeline command, how can I do it? dat <- data.frame(lat=c(40.3,38.4,39), lon = c(-10,-8,-9), fac = c(1,2,1)) # pipeline ggplot dat %>% filter(fac==1) %>% ggplot()+ geom_point(aes(x=lon, y=lat)) # I want to obtain this, but just using the pipeline command (because in my case both plots are complex and long and need to be repeated). p1 + geom_point(data=dat[dat$fac==1,], aes(x=lon, y=lat)) # ideally something like this (which does not work) dat %>% filter(fac==1) %>% ggplot()+ geom_point(aes(x=lon, y=lat))+ p1 # OR like this... dat %>% filter(fac==1) %>% p1+ geom_point(aes(x=lon, y=lat)) I am sure I am missing something and should be simple, but although I searched I could not find any post about it. Any help will be much apretiated, Thank you very much in advance, Cheers, M. -- Marta M. Rufino (junior researcher) *_**Portuguese Institute for the Sea and the Atmosphere (IPMA)* Division of Modelling and Management of Fisheries Resources Av. Dr. Alfredo Magalhães Ramalho, 6, 1495-165 Lisboa *Centre of Statistics and its Applications (CEAUL) * Faculty of Sciences, Univ. of Lisbon, Portugal http://rpubs.com/MRufino/ [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Using sf package to calculate line midpoints from Spatial Line data (both LINESTRING and MULTILINESTRING)
On Wed, 3 Feb 2021, a...@elrick.de wrote: Dear Julian, To get the midpoint of a line data just use st_centroid(). Here is a brief example: Not quite, but checking why not and in which cases would be interesting - please do run the code, the ouput is what is interesting: library(maptools) xx <- readShapeLines(system.file("shapes/fylk-val.shp", package="maptools")[1], proj4string=CRS("+proj=utm +zone=33 +datum=WGS84")) spdf <- SpatialLinesMidPoints(xx) oo <- sf::st_centroid(sf::st_as_sf(xx)) all.equal(sf::st_coordinates(oo), coordinates(spdf), check.attributes=FALSE, scale=1) df <- sf::st_coordinates(oo) - coordinates(spdf) df[apply(df, 1, function(x) any(abs(x) > 1)),] geos <- rgeos::gCentroid(xx, byid=TRUE) all.equal(sf::st_coordinates(oo), coordinates(geos), check.attributes=FALSE, scale=1) # same as st_centroid() And: lr <- t(sapply(1:length(xx), function(i) coordinates(rgeos::gInterpolate(xx[i,], d=0.5, normalized=TRUE all.equal(coordinates(spdf), lr, check.attributes=FALSE, scale=1) So rgeos::gInterpolate() and SpatialLinesMidPoints() appear to be interpolating along the line segments, that is using linear reference. res <- gDistance(geos, xx, byid=TRUE) summary(c(res)) res1 <- gDistance(spdf, xx, byid=TRUE) summary(diag(res1)) So the linear reference measures give points on the lines, but centroids do not necessarily do so. Neither of GEOSInterpolateNormalized_r() nor GEOSInterpolate_r() appear in code in sf/src, so maptools or rgeos are at present the only alternatives; maybe one of the spatstat packages also provides linear reference. Hope this clarifies, Roger library(sf) # example with two lines ds <- data.frame(id = 1:2, geom = c('LINESTRING(0 0, 2 2)', 'LINESTRING(3 2, 4 5)')) ds <- st_as_sf(ds, wkt = "geom") st_centroid(ds) # example with a multi line string ds <- data.frame(id = 1:1, geom = c('MULTILINESTRING ((0 0, 2 2),(3 2, 4 5))')) ds <- st_as_sf(ds, wkt = "geom") st_centroid(ds) Hope that helps, Tim Zitat von Julian Parnelle : Dear list, My question is straightforward: how could one use the sf package to calculate the Longitude and Latitude of the line midpoints in spatial line data, in a way that works both for LINESTRING and MULTILINESTRING sf data.frames? (one per spatial line, in case the spatial line is composed of multiple line segments). After searching online for quite a bit, the only direct reference I found was this GIS Stack Exchange question from three years ago: https://gis.stackexchange.com/questions/277219/sf-equivalent-of-r-maptools-packages-spatiallinesmidpoints. However, the solution proposed there is only more or less reliable for LINESTRING data and I lack sufficient knowledge of sf objects and MULTILINESTRING representation to update that and make it more reliable. I was used to doing that with the SpatialLinesMidPoints command, but I am finding it quite difficult to accomplish the same with the sf package. I do know that this task could perhaps be achieved by interpolating across the lines up to 50% of its extension, using for example ST_Line_Interpolate_Point. However, I don't see to be able to achieve exactly the same with either st_line_sample or st_segmentize. Any suggestions would be very welcome. Julian [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no https://orcid.org/-0003-2392-6140 https://scholar.google.no/citations?user=AWeghB0J&hl=en ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Using sf package to calculate line midpoints from Spatial Line data (both LINESTRING and MULTILINESTRING)
Dear Julian, To get the midpoint of a line data just use st_centroid(). Here is a brief example: library(sf) # example with two lines ds <- data.frame(id = 1:2, geom = c('LINESTRING(0 0, 2 2)', 'LINESTRING(3 2, 4 5)')) ds <- st_as_sf(ds, wkt = "geom") st_centroid(ds) # example with a multi line string ds <- data.frame(id = 1:1, geom = c('MULTILINESTRING ((0 0, 2 2),(3 2, 4 5))')) ds <- st_as_sf(ds, wkt = "geom") st_centroid(ds) Hope that helps, Tim Zitat von Julian Parnelle : Dear list, My question is straightforward: how could one use the sf package to calculate the Longitude and Latitude of the line midpoints in spatial line data, in a way that works both for LINESTRING and MULTILINESTRING sf data.frames? (one per spatial line, in case the spatial line is composed of multiple line segments). After searching online for quite a bit, the only direct reference I found was this GIS Stack Exchange question from three years ago: https://gis.stackexchange.com/questions/277219/sf-equivalent-of-r-maptools-packages-spatiallinesmidpoints. However, the solution proposed there is only more or less reliable for LINESTRING data and I lack sufficient knowledge of sf objects and MULTILINESTRING representation to update that and make it more reliable. I was used to doing that with the SpatialLinesMidPoints command, but I am finding it quite difficult to accomplish the same with the sf package. I do know that this task could perhaps be achieved by interpolating across the lines up to 50% of its extension, using for example ST_Line_Interpolate_Point. However, I don't see to be able to achieve exactly the same with either st_line_sample or st_segmentize. Any suggestions would be very welcome. Julian [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Consolidate data
On Wed, 3 Feb 2021, Bede-Fazekas Ákos wrote: Hello Oulhaci, How your question is related to R statistical software? This mailing list is for R users/developers. If you do not want to solve the problem with/from R (e.g. RPyGeo) but with Python integrated into ArcGIS, you should ask your question in gis.stackexchange.com or in a Python- or ArcGIS-specific mailing list. While this is correct, perhaps Oulhaci thought that everone knows about the R-ArcGIS bridge: https://www.esri.com/en-us/arcgis/products/r-arcgis-bridge/overview https://github.com/R-ArcGIS/r-bridge-install ESRI is a member of the R Consortium, and has been trying to offer ways of writing user-facing modules using R internally. Anyway, it would be useful to clarify whether R is involved or not. Roger Have a nice week, Ákos Bede-Fazekas 2021.02.03. 9:34 keltezéssel, Oulhaci Yasmine via R-sig-Geo írta: Dear list, I want to build two scripts with python ArcGIS Pro, the first one will consolidate (Roll-up) data just like aggregation of spatial data.The second one is the opposite of consolidating (drilling down into data), For example, i have three hierarchy levels are country, state and district. These fields are geographic fields and I am able to plot them on three separate maps. The requirement is to create a top-down analysis such that when the user clicks on the country, the top-down analysis should take the user to the states and show all the states. Then when the user clicks on a state, the drilldown should bring the user to see the districts and show all the sub-districts. Any suggestions would be very welcome. [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no https://orcid.org/-0003-2392-6140 https://scholar.google.no/citations?user=AWeghB0J&hl=en___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Re: [R-sig-Geo] Consolidate data
Hello Oulhaci, How your question is related to R statistical software? This mailing list is for R users/developers. If you do not want to solve the problem with/from R (e.g. RPyGeo) but with Python integrated into ArcGIS, you should ask your question in gis.stackexchange.com or in a Python- or ArcGIS-specific mailing list. Have a nice week, Ákos Bede-Fazekas 2021.02.03. 9:34 keltezéssel, Oulhaci Yasmine via R-sig-Geo írta: Dear list, I want to build two scripts with python ArcGIS Pro, the first one will consolidate (Roll-up) data just like aggregation of spatial data.The second one is the opposite of consolidating (drilling down into data), For example, i have three hierarchy levels are country, state and district. These fields are geographic fields and I am able to plot them on three separate maps. The requirement is to create a top-down analysis such that when the user clicks on the country, the top-down analysis should take the user to the states and show all the states. Then when the user clicks on a state, the drilldown should bring the user to see the districts and show all the sub-districts. Any suggestions would be very welcome. [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[R-sig-Geo] Consolidate data
Dear list, I want to build two scripts with python ArcGIS Pro, the first one will consolidate (Roll-up) data just like aggregation of spatial data.The second one is the opposite of consolidating (drilling down into data), For example, i have three hierarchy levels are country, state and district. These fields are geographic fields and I am able to plot them on three separate maps. The requirement is to create a top-down analysis such that when the user clicks on the country, the top-down analysis should take the user to the states and show all the states. Then when the user clicks on a state, the drilldown should bring the user to see the districts and show all the sub-districts. Any suggestions would be very welcome. [[alternative HTML version deleted]] ___ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo