Spatial

SQL基础-DDL数据定义语言

泪湿孤枕 提交于 2019-11-29 01:44:37
SQL数据定义语言-DDL语句 DDL语句部分使我们有能力创建或删除表格。我们也可以定义索引(键),规定表之间的链接,以及施加表间的约束。 语句 释义 CREATE DATABASE 创建新数据库 ALTER DATABASE 修改数据库 CREATE TABLE 创建新表 ALTER TABLE 变更(改变)数据库表 DROP TABLE 删除表 DELIMITER 分隔符 CREATE INDEX 创建索引(搜索键) DROP INDEX 删除索引 1. 设置root账户 其一: mysql -u root -p 回车即可,因为还没有root密码。下来根据提示输入y表示新建root。然后是连续输入两次root密码。接下来就是一路输入y后回车就可以了。 其二: mysql > mysql -u root -p 所要设置的密码 需要修改密码的话: mysql > mysql -u root -p 已经设置的旧密码 password 所要设置的新密码 2. 使用数据库: 登录数据库 #mysql -u root -p 切换数据库 mysql > use 数据库名称; 更新数据库使之改动生效 mysql > flush privileges; 3. 创建数据库信息 新建数据库 mysql > create database 数据库名字 default character set

MySQL - selecting near a spatial point

こ雲淡風輕ζ 提交于 2019-11-29 00:37:42
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)) , ' ' , %F + 0.0005 / 111.1 , ',' , %F - 0.0005 / ( 111.1 / cos(%F)) , ' ' , %F - 0.0005 / 111.1 , ')' )

Convert geography to geometry SQL Server 2008R2

一世执手 提交于 2019-11-29 00:34:52
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(); DECLARE @geog geography; SET @geog = geography::STGeomFromText('POLYGON ((-99.213546752929688 19

Know of any C# spatial data libraries?

ぐ巨炮叔叔 提交于 2019-11-28 23:50:29
I'm looking at implementing spatial queries in .NET without using SQL2008. The first requirement is to be able to create a (BTree styled) spatial index and be able to query it. Although SQL 2008 ships with .NET libraries for the types, you need to use SQL for the spatial indexes. HAs anybody used any .NET libraries for spatial data (OS or commercial)? I am looking at NetTopologySuite but it looks quiet and I don't want a dead library. SharpMap is a (well known and used) OpenSource collection of spatial libraries for .NET http://www.codeplex.com/SharpMap Commercial libraries from ESRI would be

Combine Voronoi polygons and maps

杀马特。学长 韩版系。学妹 提交于 2019-11-28 20:43:40
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.3836,52.3959,52.4496,52.3924,52.4012,52.3924,52.3777,52.4368,52.4574,52.3945,52.4572,52.3962,52.3816

How can I speed up this Sql Server Spatial query? [closed]

删除回忆录丶 提交于 2019-11-28 20:38:40
问题 I have (what I think) is a simple Sql Server spatial query: Grab all the USA States that exist inside some 4 sided polygon (ie. the viewport/bounding box of a web page's google/bing map) SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName, StateId, a.Name, Boundary.STAsText() AS Boundary, CentrePoint.STAsText() AS CentrePoint FROM [dbo].[States] a WHERE @BoundingBox.STIntersects(a.Boundary) = 1 It takes 6 seconds to run :( Here's the execution plan.... Removed And the stats on the

Query points within a given radius in MySQL

痞子三分冷 提交于 2019-11-28 19:52:10
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 the examples I have found refer to using a minimum bounding rectangle (MBR) rather than a radius. The

Spatial data types support in Linq2Sql or EF4

▼魔方 西西 提交于 2019-11-28 17:13:23
问题 Does anyone know (ideally, with a reference), whether the VS2010 release of LinqToSQL or EntityFramework v4 will support queries over the SQL 2008 spatial data types? 回答1: In EF 4.0 you might be able to hack something together using a combination of custom functions and pretending the spatial types are really Binary types. This is something that I am thinking of mucking around with and trying out and adding to my tips series. But as yet even the hack is unproven. :( And as for direct support,

NoSQL and spatial data

丶灬走出姿态 提交于 2019-11-28 16:14:49
问题 Has any of you had any experience with using NoSQL (non-relational) databases to store spatial data? Are there any potential benefits (speed, space, ...) of using such databases to hold data for, say, a desktop application (compared to using SpatiaLite or PostGIS)? I've seen posts about using MongoDB for spatial data, but I'm interested in some performance comparison. 回答1: graphs databases like Neo4j are a very good fit, especially as you can add different indexing schemes dynamically as you

Closest point to a path

旧城冷巷雨未停 提交于 2019-11-28 12:36:27
I have two sets of points, called path and centers . For each point in path , I would like an efficient method for finding the ID of the closest point in centers . I would like to do this in R. Below is a simple reproducible example. set.seed(1) n <- 10000 x <- 100*cumprod(1 + rnorm(n, 0.0001, 0.002)) y <- 50*cumprod(1 + rnorm(n, 0.0001, 0.002)) path <- data.frame(cbind(x=x, y=y)) centers <- expand.grid(x=seq(0, 500,by=0.5) + rnorm(1001), y=seq(0, 500, by=0.2) + rnorm(2501)) centers$id <- seq(nrow(centers)) x and y are coordinates. I would like to add a column to the path data.frame that has