Spatial

Converting point process model intensity predictions to probabilities at specific points spatstat

∥☆過路亽.° 提交于 2020-01-25 10:12:25
问题 I am working on a similar dataset as the chorley dataset in the spatstat package and am following a similar analysis as presented in the sample book chapter, Spatial Point Patterns: Methodology and Applications with R. https://book.spatstat.org/sample-chapters/chapter09.pdf library(spatstat) data("chorley") X <- split(chorley)$larynx D <- split(chorley)$lung Q <- quadscheme.logi(X,D) fit <- ppm(Q ~ x + y) locations = data.frame(x=chorley$x, y=chorley$y) pred <- predict(fit, locations =

Converting point process model intensity predictions to probabilities at specific points spatstat

旧街凉风 提交于 2020-01-25 10:12:07
问题 I am working on a similar dataset as the chorley dataset in the spatstat package and am following a similar analysis as presented in the sample book chapter, Spatial Point Patterns: Methodology and Applications with R. https://book.spatstat.org/sample-chapters/chapter09.pdf library(spatstat) data("chorley") X <- split(chorley)$larynx D <- split(chorley)$lung Q <- quadscheme.logi(X,D) fit <- ppm(Q ~ x + y) locations = data.frame(x=chorley$x, y=chorley$y) pred <- predict(fit, locations =

CakePHP 3.5 Always apply asText() MySQL function to Spatial field

左心房为你撑大大i 提交于 2020-01-24 21:59:08
问题 I have a custom PolygonType which represents a POLYGON() field in a MySQL table. class PolygonType extends BaseType implements ExpressionTypeInterface { public function toPHP($value, Driver $d) { // $value is binary, requires unpack() } } I can use $query->func()->astext() on every find, but I would like to know if it's possible to always apply MySQL's AsText() function when selecting this field instead (similar to how toExpression() can be used when inserting data). 回答1: AFAIK there is no

CakePHP 3.5 Always apply asText() MySQL function to Spatial field

若如初见. 提交于 2020-01-24 21:58:06
问题 I have a custom PolygonType which represents a POLYGON() field in a MySQL table. class PolygonType extends BaseType implements ExpressionTypeInterface { public function toPHP($value, Driver $d) { // $value is binary, requires unpack() } } I can use $query->func()->astext() on every find, but I would like to know if it's possible to always apply MySQL's AsText() function when selecting this field instead (similar to how toExpression() can be used when inserting data). 回答1: AFAIK there is no

Plotting shape files loaded using read.shp with ggplot2

我与影子孤独终老i 提交于 2020-01-24 21:22:10
问题 I would like to plot a shape file loaded using read.shp from the fastshp package. However, the read.shp function returns a list of list and not a data.frame. I'm unsure which part of the list I need to extract to obtain the correctly formatted data.frame object. This exact question has been asked on stack overflow already, however, the solution no longer seems to work (solution was from > 7 years ago). Any help is much appreciated. remotes::install_github("s-u/fastshp") #fastshp not on CRAN

Scipy: how to convert KD-Tree distance from query to kilometers (Python/Pandas)

只愿长相守 提交于 2020-01-23 00:39:12
问题 This post builds upon this one. I got a Pandas dataframe containing cities with their geo-coordinates (geodetic) as longitude and latitude. import pandas as pd df = pd.DataFrame([{'city':"Berlin", 'lat':52.5243700, 'lng':13.4105300}, {'city':"Potsdam", 'lat':52.3988600, 'lng':13.0656600}, {'city':"Hamburg", 'lat':53.5753200, 'lng':10.0153400}]); For each city I'm trying to find two other cities that are closest. Therefore I tried the scipy.spatial.KDTree. To do so, I had to convert the

Create buffer around spatial point data in R and count how many points are in the buffer

。_饼干妹妹 提交于 2020-01-17 07:26:53
问题 I am trying to analyze spatial density of gas station points using R. I need to create a buffer (circle) around the gas stations and count the number of gas stations within the buffer. I'll then need to play around with buffer distances to see what's a reasonable buffer to see something interesting. These are the files I am working with: https://dl.dropboxusercontent.com/u/45095175/sbc_gas.shp; https://dl.dropboxusercontent.com/u/45095175/sbc_gas.shx; https://dl.dropboxusercontent.com/u

How to implement a Quadtree for spatial partitioning

寵の児 提交于 2020-01-17 06:54:53
问题 I'm having trouble with spatial partitioning for my class. The problem I'm having is implementing the Quadtree in C++ using DirectX. I get the concept behind it but the coding to implement it is what I'm having trouble with. Right now I have the environment to test the tree. And the structure for the tree. struct Node { vector3 element; Node* left, right; }; Node root; 来源: https://stackoverflow.com/questions/5994778/how-to-implement-a-quadtree-for-spatial-partitioning

Identifying grids into a map/shapefile

放肆的年华 提交于 2020-01-16 18:50:14
问题 I have some questions about maps/shapefiles. I'm not a expert in R, so, to make it easier do understand what I'm going for, I'll enumerate: 1- Identify each grid on the map, and maybe omit some of these grids. 2- Color each grid by values from a data frame I just made what i'm trying to make using Photoshop to help to illustrate my goal here I made this map using the 'intersect' function with a shapefile I got from internet and a grid i made using 'rastertoPolygons' function, but I'm not sure

spatial panel regression in R: Error with spgm

落爺英雄遲暮 提交于 2020-01-16 12:37:30
问题 I have one problem with the spatial regression code shown below ( Code Example ). After I run the regression I get the following error Error in listw %*% as.matrix(ywithin) : Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90 When I remove the spatial dimension from the regression, the regression runs perfectly, so I guess the error might be in the spatial weight matrix. Could someone please help me address why this error occurs and recommend a