Spatial

Combine Voronoi polygons and maps

为君一笑 提交于 2019-11-27 13:05:48
问题 I would like to combine Voronoi polygons with map, in order to use this later for spatial analysis. I have number of points and shapefile that i want to combine and then save as shapefile/spatial polygons. To get voronoi polygons i use function from this topic. My code is as follows: coords<-data.frame(LONG=c(16.9252,16.9363,16.9408,16.8720,16.9167,16.9461,16.9093,16.9457,16.9171,16.8506,16.9471,16.8723,16.9444,16.9212,16.8809,16.9191,16.8968,16.8719,16.9669,16.8845), LAT=c(52.4064,52.4266,52

SpatialPolygons - Creating a set of polygons in R from coordinates

最后都变了- 提交于 2019-11-27 12:53:05
I am trying to take create a set of polygons from vertex locations, saved in X,Y format. Here is an example of my data - each row represents the vertices for one polygon. the polygons are squares square <- rbind(c(255842.4, 4111578, 255862.4, 4111578, 255862.4, 4111558, 255842.4, 4111558, 255842.4, 4111578, 255842.4, 4111578), c(257397.0, 4111309, 257417.0, 4111309, 257417.0, 4111289, 257397.0, 4111289, 257397.0, 4111309, 257397.0, 4111309)) ID <- c("SJER1", "SJER2")' I am using SpatialPolygons , thus my data need to be in a list. so i created a loop to attempt to get my data into a list

Query points within a given radius in MySQL

删除回忆录丶 提交于 2019-11-27 12:31:11
问题 I have created the following MySQL table to store latitude/longitude coordinates along with a name for each point: CREATE TABLE `points` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `location` point NOT NULL, PRIMARY KEY (`id`), SPATIAL KEY `location` (`location`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; I am trying to query: all points within an n mile radius of a given point; the distance of each returned point from the given point All of

SQL Server 2008 Spatial: find a point in polygon

南笙酒味 提交于 2019-11-27 12:24:32
I am using SQL Server 2008 spatial data types. I have a table with all States (as polygons) as data type GEOMETRY. Now I want to check if a point's coordinates (latitudes, longitudes) as data type GEOGRAPHY, is inside that State or not. I could not find any example using the new spatial data types. Currently, I have a workaround which was implemented many years ago, but it has some drawbacks. I've both SQL Server 2008 and 2012. If the new version has some enhancements, I can start working in it too. Thanks. UPDATE 1: I am adding a code sample for a bit more clarity. declare @s geometry -

Neo4j Spatial 'WithinDistance' Cypher query returns empty while REST call returns data

别等时光非礼了梦想. 提交于 2019-11-27 08:58:02
I have what appears to be a correctly configured spatial layer and index and can successfully query a node using findGeometriesWithinDistance REST API call. POST /db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance {"layer":"geom","pointX":15.0,"pointY":60.0,"distanceInKm":100.0} However, when querying using cypher, I get no results (I have tried reversing the order of 60.0 and 15.0 without luck): START n=node:geom('withinDistance:[60.0, 15.0, 500.0]') return n; Cyper returns: ==> +---+ ==> | n | ==> +---+ ==> +---+ ==> 0 row ==> ==> 13 ms REST: 200 OK ==> [ { ==> "paged_traverse" :

Crop for SpatialPolygonsDataFrame

断了今生、忘了曾经 提交于 2019-11-27 08:01:41
I have two SpatialPolygonsDataFrame files: dat1, dat2 extent(dat1) class : Extent xmin : -180 xmax : 180 ymin : -90 ymax : 90 extent(dat2) class : Extent xmin : -120.0014 xmax : -109.9997 ymin : 48.99944 ymax : 60 I want to crop the file dat1 using the extent of dat2. I don't know how to do it. I just handle raster files using "crop" function before. When I use this function for my current data, the following error occurs: > r1 <- crop(BiomassCarbon.shp,alberta.shp) Error in function (classes, fdef, mtable) : unable to find an inherited method for function ‘crop’ for signature

Storing objects for locating by x,y coordinates

你离开我真会死。 提交于 2019-11-27 07:53:02
I'm trying to determine a fast way of storing a set of objects, each of which have an x and y coordinate value, such that I can quickly retrieve all objects within a certain rectangle or circle. For small sets of objects (~100) the naive approach of simply storing them in a list, and iterating through it, is relatively quick. However, for much larger groups, that is expectedly slow. I've tried storing them in a pair of TreeMaps as well, one sorted on the x coordinate, and one sorted on the y coordinate, using this code: xSubset = objectsByX.subSet( minX, maxX ); ySubset = objectsByY.subSet(

What's the best way to store co-ordinates (longitude/latitude, from Google Maps) in SQL Server?

亡梦爱人 提交于 2019-11-27 06:17:22
I'm designing a table in SQL Server 2008 that will store a list of users and a Google Maps co-ordinate (longitude & latitude). Will I need two fields, or can it be done with 1? What's the best (or most common) data-type to use for storing this kind of data? Craig Bovis Take a look at the new Spatial data-types that were introduced in SQL Server 2008. They are designed for this kind of task and make indexing and querying much easier and more efficient. More information: MS TechNet: SQL Server 2008 Spatial Data Types , MSDN: Working with Spatial Data (Database Engine) . dan90266 Fair Warning!

Intersecting Points and Polygons in R

旧时模样 提交于 2019-11-27 06:02:50
问题 I am working with shapefiles in R , one is point.shp the other is a polygon.shp. Now, I would like to intersect the points with the polygon, meaning that all the values from the polygon should be attached to the table of the point.shp. I tried overlay() and spRbind in package sp, but nothing did what I expected them to do. Could anyone give me a hint? 回答1: If you do overlay(pts, polys) where pts is a SpatialPointsDataFrame object and polys is a SpatialPolygonsDataFrame object then you get

Bulk insert with text qualifier in SQL Server

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 05:33:12
I am trying to bulk insert few records in a table test from a CSV file , CREATE TABLE Level2_import (wkt varchar(max), area VARCHAR(40), ) BULK INSERT level2_import FROM 'D:\test.csv' WITH ( FIRSTROW = 2, FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) The bulk insert code should rid of the first row and insert the data into the table . it gets rid of first row alright but gets confused in the delimiter section . The first column is wkt and the column value is double quoted and has comma within the value . So I guess I question is if there is a way to tell the BULK INSERT that the double quoted