Spatial

How to save 100 SpatialLines objects in the list?

橙三吉。 提交于 2019-12-06 06:09:40
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 } Initialize xySpatialLines not as NULL but as a list, e.g. by xySpatialLines <- list() or better, pre-allocate the space you need to avoid incremental growth: xySpatialLines <- vector(mode = "list",

How to count the number of elements in all Oracle varrays from table?

微笑、不失礼 提交于 2019-12-06 05:30:12
问题 I have a table like this: CREATE TABLE spatial_data ( id NUMBER PRIMARY KEY, geometry SDO_GEOMETRY); SDO_GEOMETRY has a field sdo_ordinates with the following type: TYPE SDO_ORDINATE_ARRAY AS VARRAY(1048576) OF NUMBER I can get the number of points for specified object: select count(*) from table( select s.geometry.sdo_ordinates from spatial_data s where s.id = 12345 ); How can I get count for several objects? It's not possible to use where s.id in (1, 2, 3, 4, 5) And I really care about

Create Spatial Data in R

…衆ロ難τιáo~ 提交于 2019-12-06 04:05:11
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), (0,0), and (0,10), that B is just north of A and has corners (0,10), (0,20), (10,10), and (10,20), and K

Dapper Spatial Geography Type

梦想与她 提交于 2019-12-06 03:28:01
I'm cooking up some spatial examples and have decided to give Dapper a go, although EF has spatial support, and I'm loving having control over my SQL again (Thanks Sam & Marc). However, I need to be able to have POCO's that support the DbGeography class. For example : public class BuriedTreasure { public int PirateId { get; set; } public DbGeography MarksTheSpot { get; set; } } My Google foo has been letting me down and the closest match I can find is this question, though it only caters for adding spatial support as a parameter (so it's 50% there). Now as far as I can see I'm limited to the

Spatial data/Geography in SQL Server 2008, OR mappers and C#

℡╲_俬逩灬. 提交于 2019-12-06 01:59:04
问题 I'm developing an application in C# that will use and store geographic locations using the data type "Geography" in SQL Server 2008. I was planning to use the Entity Framework but soon discovered it lacks support for spatial data. Does anyone have experience with or know of other OR mappers with spatial support? The system will have few writes and many reads of geographical data. What is a good/preffered way to read/write spatial/Geography data from C#? 回答1: You may want to check out the

extract() data from raster with small polygons - rounded weights too small

╄→尐↘猪︶ㄣ 提交于 2019-12-05 23:23:46
问题 Using R, I am trying to extract data from a raster layer using a polygon layer. The polygons are much smaller than the raster cells: Now I call extract() from raster library: a <- extract(raster, polygons, weights = TRUE, small = TRUE) a # ... # [[1551]] # value weight # 209 0.03 # top left cell - more than 50% of the polygon area There are two problems - the weight is the proportion of the cell area covered by the polygon, and the weights are rounded to 1/100. In my case, only the top left

What are some recommended frameworks for manipulating spatial data in C++? [closed]

徘徊边缘 提交于 2019-12-05 22:45:42
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . What are some recommended frameworks for manipulating spatial data in C++? I'm looking for a polygon object, point object, and some

directional testing of spatial clustering by distance from source

别来无恙 提交于 2019-12-05 21:57:33
I have a spatial dataset of animal locations, as (x,y) points around a source (circular pattern with 5 km radius). I need to test whether the points are clustered (or repulsed) around the source relative to farther from the source, while accounting for directionality. Things I tried: checked out nearest neighbour and Ripley's K - could not figure out how to incorporate distance from source or directionality (plus, it looks like Ripley's is expecting a rectangular window, whereas mine is circular) divided data into cardinal directions (N, E, S, W) and distance bins and calculated density of

Drawing equidistant points from the sides of a polygon

时光总嘲笑我的痴心妄想 提交于 2019-12-05 21:02:37
I am drawing a polygon with the following vertices x y -0.02208709 -0.039161304 0.01184081 -0.020268029 0.04578401 -0.001351904 0.02210236 0.039176396 -0.01185226 0.020252146 -0.04578784 0.001352696 using the following code plot(x,y) polygon(x,y) points(mean(x),mean(y),col="red") Now I want to plot 50 equally-spaced points along the sides of polygon. Any suggestion how to do it? You can do this with spsample from the sp package. First we'll load the library and read in your vertices. library(sp) xy <- read.table(text='x y -0.02208709 -0.039161304 0.01184081 -0.020268029 0.04578401 -0.001351904

Bring rasters to same extent by filling with NA - in R

故事扮演 提交于 2019-12-05 20:29:58
I have several cropped rasters with different geometry/outlines. Specifically spatial yield maps from several years of the same field, but the extent varies - the measurements were not always overall the whole field, but in some years only part of it. I want to calculate a mean value of those maps and combine them into one mean-value-raster. That does mean however, that not for every pixel in let's say 5 layers/rasters there is a value. I could accept these missing values to be NA, so the final mean value would only be calculated by let's say 3 rasters for parts of the field, where the maps