Spatial

Create Grid in R for kriging in gstat

守給你的承諾、 提交于 2019-11-27 20:55:19
lat long 7.16 124.21 8.6 123.35 8.43 124.28 8.15 125.08 Consider these coordinates, these coordinates correspond to weather stations that measure rainfall data. The intro to the gstat package in R uses the meuse dataset. At some point in this tutorial: https://rpubs.com/nabilabd/118172 , the guys makes use of a "meuse.grid" in this line of code: data("meuse.grid") I do not have such a file and I do not know how to create it, can I create one using these coordinates? Or at least point me to material that discusses how to create a custom grid for a custom area (i.e not using administrative

How to create thiessen polygons from points using R packages?

泪湿孤枕 提交于 2019-11-27 20:52:38
I have multiple sets of points (for different years ~20) I want to generate thiessen polygons for each set of points using r spatial packages. I know this can be done using GIS but as i want a batch process something in R would be helpful. You haven't given us access to your data, but here's an example for points representing cities of the world, using an approach described by Carson Farmer on his blog . Hopefully it'll get you started... # Carson's Voronoi polygons function voronoipolygons <- function(x) { require(deldir) require(sp) if (.hasSlot(x, 'coords')) { crds <- x@coords } else crds <

MySQL - Find points within radius from database

蓝咒 提交于 2019-11-27 18:31:21
问题 I have a table which has a POINT column containing the latitude and longitude of various locations. I then also have a users location from geo-location in the browser. What I need to be able to do is find all records from the table where the POINT value in the is within a 10 km radius (or X km radius), ordered by distance with the closest first. My table has a SPATIAL index on the POINT column. 回答1: I'm currently working on a project where I'm calculating distances between multiple locations.

Simple way to subset SpatialPolygonsDataFrame (i.e. delete polygons) by attribute in R

假如想象 提交于 2019-11-27 17:47:47
I would like simply delete some polygons from a SpatialPolygonsDataFrame object based on corresponding attribute values in the @data data frame so that I can plot a simplified/subsetted shapefile. So far I haven't found a way to do this. For example, let's say I want to delete all polygons from this world shapefile that have an area of less than 30000. How would I go about doing this? Or, similarly, how can I delete Antartica? require(maptools) getinfo.shape("TM_WORLD_BORDERS_SIMPL-0.3.shp") # Shapefile type: Polygon, (5), # of Shapes: 246 world.map <- readShapeSpatial("TM_WORLD_BORDERS_SIMPL

Comparison of the runtime of Nearest Neighbor queries on different data structures

给你一囗甜甜゛ 提交于 2019-11-27 16:23:34
Given n points in d-dimensional space, there are several data structures, such as Kd-Trees, Quadtrees, etc. to index the points. On these data structures it is possible to implement straight-forward algorithm for nearest neighbor queries around a given input point. Is there a book, paper, survey, ... that compares the theoretical (mostly expected) runtime of the nearest neighbor query on different data structures? The data I am looking at is composed of fairly small point clouds, so it can all be processed in main memory. For the sake of simplicity, I assume the data to be uniformly

Convert geography to geometry SQL Server 2008R2

本秂侑毒 提交于 2019-11-27 15:21:51
问题 Hello, i have the following code in SQL Server, why if i want to calculate the sTArea of @geog fails and with @geom succeed?, how can i convert this polygon from geometry to geography datatype in order to get the STArea?, thank you. DECLARE @geom geometry; SET @geom = geometry::STGeomFromText('POLYGON ((-99.213546752929688 19.448402404785156, -99.2157974243164 19.449802398681641, -99.2127456665039 19.450002670288086, -99.213546752929688 19.448402404785156))', 4326); select @geom.STArea();

MySQL - selecting near a spatial point

限于喜欢 提交于 2019-11-27 15:21:02
问题 I've based my query below to select points near a spatial point called point on the other SO solution, but I've not been able to get it to return any results, for the past few hours, and I'm a bit edgy now... My table lastcrawl has a simple schema: id (primary int, autoinc) point (spatial POINT) (Added the spatial key via ALTER TABLE lastcrawl ADD SPATIAL INDEX(point); ) $query = sprintf("SELECT * FROM lastcrawl WHERE MBRContains(LineFromText(CONCAT( '(' , %F + 0.0005 * ( 111.1 / cos(%F)) , '

.NET 4.5 Beta DbGeography NotImplementedException

烈酒焚心 提交于 2019-11-27 15:14:10
I have a brand new server which I installed the .NET 4.5 Beta redistributable on. I am getting a NotImplemented exception when trying to use the spatial features. This code... var x = DbGeography.PointFromText(string.Format("POINT({0} {1})", -45, 45), 4326); Throws this exception... System.NotImplementedException: The method or operation is not implemented. at System.Data.Spatial.DefaultSpatialServices.GeographyPointFromText(String geographyText, Int32 spatialReferenceSystemId) If I install the full VS.NET 11 Beta then the code works fine. Any ideas why? What is missing? UPDATE FOR ANSWER

MySQL latitude and Longitude table setup

这一生的挚爱 提交于 2019-11-27 14:27:30
I want to store latitude and longitude values of places in a mysql database table. With the future in mind I will want to be able to find these places within a certain radius of a specific location. Having said that, what datatypes should I store the latitude and longitude values in? Please could you provide me with a create table script for columns like so: place_id | lat | long Is there perhaps a column I am missing in the above table that will provide me with additional information that I may not see I need at the current time? Thanks for any help. You should store the points in a singe

Getting a slot's value of S4 objects?

隐身守侯 提交于 2019-11-27 14:02:46
问题 So I have a spatialpolygons object in R; but I am not sure why I am unable to retrieve the "area" slot from it. Here's my R session: > spatialpolygons An object of class "SpatialPolygons" Slot "polygons": [[1]] An object of class "Polygons" Slot "Polygons": [[1]] An object of class "Polygon" Slot "labpt": [1] 20.50516 57.72918 Slot "area": [1] 36.85484 Slot "hole": [1] FALSE Slot "ringDir": [1] 1 Slot "coords": [,1] [,2] [1,] 16.48438 59.73633 [2,] 22.59277 61.14258 [3,] 24.74609 55.03418 [4,