Spatial

R spdep giant weight matrix

此生再无相见时 提交于 2019-12-23 04:51:11
问题 I'm new to spatial statistics, and I'm trying to create a spatial weight matrix for all Census tracts in the US in R. There are around 74000 tracts. Based on US Census Tiger Files, I created a shapefile of all tracts, and then did (using the spdep package): #Create adjacency matrix am = poly2nb(us) is.symmetric.nb(am) This works fine, though am is pretty large. Next: am = nb2mat(am, style="B",zero.policy=T) Which gives me this error: Error: cannot allocate vector of size 40.9 Gb Obviously my

How to create a Large Distance Matrix?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 03:57:13
问题 How to allocate a huge distance matrix in an appropriate way to avoid " allocation is unable " error. Imagine you have a 100.000 points randomly spreaded over some space. How can one cleverly create a matrix or "dist"-object, which represents the the half of DistMatrix. Maybe it should be another object, which will be able efficiently allocate the large number of distances. You can get the polygonial object from the following link: https://www.dropbox.com/sh/65c3rke0gi4d8pb/LAKJWhwm-l # Load

How to create a Large Distance Matrix?

半世苍凉 提交于 2019-12-23 03:57:06
问题 How to allocate a huge distance matrix in an appropriate way to avoid " allocation is unable " error. Imagine you have a 100.000 points randomly spreaded over some space. How can one cleverly create a matrix or "dist"-object, which represents the the half of DistMatrix. Maybe it should be another object, which will be able efficiently allocate the large number of distances. You can get the polygonial object from the following link: https://www.dropbox.com/sh/65c3rke0gi4d8pb/LAKJWhwm-l # Load

How to save 100 SpatialLines objects in the list?

那年仲夏 提交于 2019-12-22 11:37:24
问题 I need to save 100 SpatialLines objects in the list xySpatialLines . The below given code provides an error: Error in xySpatialLines[i] = spl : invalid type/length (S4/0) in vector allocation library(sp) xySpatialLines <- NULL for(i in 1:100) { x <- c(i,5,4,8) y <- c(1,3,4,i) xy <- cbind(x,y) xy.sp = sp::SpatialPoints(xy) spl <- SpatialLines(list(Lines(Line(xy.sp), ID=i))) xySpatialLines[i] = spl } 回答1: Initialize xySpatialLines not as NULL but as a list, e.g. by xySpatialLines <- list() or

Create Spatial Data in R

本秂侑毒 提交于 2019-12-22 10:54:18
问题 I have a dataset of species and their rough locations in a 100 x 200 meter area. The location part of the data frame is not in a format that I find to be usable. In this 100 x 200 meter rectangle, there are two hundred 10 x 10 meter squares named A through CV. Within each 10 x 10 square there are four 5 x 5 meter squares named 1, 2, 3, and 4, respectively (1 is south of 2 and west of 3. 4 is east of 2 and north of 3). I want to let R know that A is the square with corners at (0 ,0), (10,0),

Mysql select where polygon contains point always false

天涯浪子 提交于 2019-12-22 08:34:24
问题 I have tried various functions like MBRWithin, MBRContains, Intersects, Contains (all of them found in a plenty of posts around here) but no luck yet. This is the simplified query: SELECT * FROM users WHERE Intersects( GeomFromText( 'POINT(50 50)' ), GeomFromText( 'POLYGON(0 0, 100 0, 100 100, 0 100, 0 0)' ) ); I expected it to evaluate that condition as true (like 1=1) and return all users, however this did not happen. Please tell me, what am I doing wrong? I am running MySql 5.5 回答1: This

Voronoi Diagram Edges: How to get edges in the form (point1, point2) from a scipy.spatial.Voronoi object?

Deadly 提交于 2019-12-22 05:21:32
问题 I have spent a great deal of time now trying to obtain edges from the scipy.spatial.Voronoi diagram to no avail. Here is the main documentation: http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.spatial.Voronoi.html If you create a Voronoi Diagram like so: points = np.array([[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) //Or feel free to use any set of points then you have access to the following object properties: vor.regions vor.max_bound vor.ndim vor

Voronoi Diagram Edges: How to get edges in the form (point1, point2) from a scipy.spatial.Voronoi object?

牧云@^-^@ 提交于 2019-12-22 05:21:14
问题 I have spent a great deal of time now trying to obtain edges from the scipy.spatial.Voronoi diagram to no avail. Here is the main documentation: http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.spatial.Voronoi.html If you create a Voronoi Diagram like so: points = np.array([[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]) //Or feel free to use any set of points then you have access to the following object properties: vor.regions vor.max_bound vor.ndim vor

Entity framework 6 and spatial data

☆樱花仙子☆ 提交于 2019-12-22 04:45:27
问题 I have database with spatial data types. I use database first model and entity framework 6.0.2 and .NET 4.5. When I am trying to use the generated classes I get following error: Schema specified is not valid. Errors: The relationship 'Name_FK1' was not loaded because the type 'Model.TypeB' is not available. The following information may be useful in resolving the previous error: The property 'Position' on the type 'Data.TypeB' has a property type of 'System.Data.Spatial.DbGeography' which

Smoothing of “spatial” data

孤街浪徒 提交于 2019-12-21 20:53:25
问题 I have 2 variables x and y which are Cartesian coordinates at [0,1], and z is the value of a (continuous) variable at these coordinates. The z vector has some important outliers x<-sample(seq(0,1,0.001), replace=F) y<-sample(seq(0,1,0.001), replace=F) z<-runif(1001,min=0,max=1) z[100]<-8;z[400]<-16;z[800]<-4 These outliers I would like to emphasize when presenting these data in a filled.contour I have used until now library(akima) a<-interp(x,y,z) filled.contour(a$x,a$y,a$z) But I am not