spatial-query

Mysql: ST_Contains with borders to detect if multipolygon contains point

穿精又带淫゛_ 提交于 2019-12-07 10:55:02
问题 I use mysql spatial functions. I have to understand if points lies withing multipolygon. Initially I used MBRContains but it works in a strange way, so I faced the following error: Mysql function MBRContains is not accurate My next step was switching to the functions ST_Contains . But I found out that if I use polygon(from multipolygon) vertex as argument - function returns false but I want to unclude all multipolygon borders. P.S. I found that where are function: ST_Touches(g1, g2) Two

Using STCrosses() with a Spatial Index in SQL Server

醉酒当歌 提交于 2019-12-06 20:16:35
Does The Microsoft StCrosses() function for Geography data support Spatial Index? When I try to execute this function with Spatial Index I get this error message: "The query processor could not produce a query plan for a query with a spatial index hint. Reason: Spatial indexes do not support the method name supplied in the predicate. Try removing the index hints or removing SET FORCEPLAN" No. Indexing spatial data is nontrivial, and the class you are discussing can contain arbitrarily complex figures, not just simple geometric shapes. The specific way shapes and indexing is implemented can

Mysql select where polygon contains point always false

女生的网名这么多〃 提交于 2019-12-05 11:55:34
I have tried various functions like MBRWithin, MBRContains, Intersects, Contains (all of them found in a plenty of posts around here) but no luck yet. This is the simplified query: SELECT * FROM users WHERE Intersects( GeomFromText( 'POINT(50 50)' ), GeomFromText( 'POLYGON(0 0, 100 0, 100 100, 0 100, 0 0)' ) ); I expected it to evaluate that condition as true (like 1=1) and return all users, however this did not happen. Please tell me, what am I doing wrong? I am running MySql 5.5 This worked for me: SELECT * FROM users WHERE MBRContains( GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))'),

how do I cluster a list of geographic points by distance?

扶醉桌前 提交于 2019-12-04 14:03:37
I have a list of points P=[p1,...pN] where pi=(latitudeI,longitudeI). Using Python 3, I would like to find a smallest set of clusters (disjoint subsets of P) such that every member of a cluster is within 20km of every other member in the cluster. Distance between two points is computed using the Vincenty method . To make this a little more concrete, suppose I have a set of points such as from numpy import * points = array([[33. , 41. ], [33.9693, 41.3923], [33.6074, 41.277 ], [34.4823, 41.919 ], [34.3702, 41.1424], [34.3931, 41.078 ], [34.2377, 41.0576], [34.2395, 41.0211], [34.4443, 41.3499],

how do i create a circle Geometry with a radius and co-ordinates of center, using MySQL Spatial Extensions?

爷,独闯天下 提交于 2019-12-04 11:18:33
问题 I am trying to create a Circle Geometry in MySQL using the co-ordinates of the center and a radius. I searched everywhere...all i could find in the MySQL doc on the site were for polygons. May be i am looking in the wrong place. can anybody help me with an appropriate SQL that can help me create a table that stores this Circle geometry as one of the columns in the table? Also, i am not even sure if there is a way to do so in MySQL?..The version i am using is MySQL 5.6. Thanks in advance. 回答1:

Spatial index/query (finding k nearest points)

孤人 提交于 2019-12-03 09:02:58
I have +10k points (latitude, longitude) and I'm building an app that shows you the k nearest points to a user's location. I think this is a very common problem and I don't want to reinvent the wheel. I'm learning about Quadtrees. It seems to be a good approach to solve this spatial problem. I'm using these tools: Python 2.5 MySQL MongoDb Building the Quadtree is not that hard: http://donar.umiacs.umd.edu/quadtree/points/pointquad.html But once I've created the tree and saved it to a db (MySQL or MongoDb), how I run the query? I need to run queries like these: Find all points within 10 km of

SQL Geometry find all points in a radius

浪子不回头ぞ 提交于 2019-12-03 07:46:24
问题 I am fluent in SQL but new to using the SQL Geometry features. I have what is probably a very basic problem to solve, but I haven't found any good resources online that explain how to use geometry objects. (Technet is a lousy way to learn new things...) I have a collection of 2d points on a Cartesian plane, and I am trying to find all points that are within a collection of radii. I created and populated a table using syntax like: Update [Things] set [Location] = geometry::Point(@X, @Y, 0) (@X

SQL Geometry find all points in a radius

这一生的挚爱 提交于 2019-12-02 21:13:49
I am fluent in SQL but new to using the SQL Geometry features. I have what is probably a very basic problem to solve, but I haven't found any good resources online that explain how to use geometry objects. (Technet is a lousy way to learn new things...) I have a collection of 2d points on a Cartesian plane, and I am trying to find all points that are within a collection of radii. I created and populated a table using syntax like: Update [Things] set [Location] = geometry::Point(@X, @Y, 0) (@X,@Y are just the x and y values, 0 is an arbitrary number shared by all objects that allows set

Linq & unsupported data types (Geography)

牧云@^-^@ 提交于 2019-12-01 03:10:34
问题 So, Linq does not support the Geography data type, which throws a major spanner in the works in the lovely 'drag table onto the Linq design surface' developemnt model. Is there any way that I can extend Linq to work with the Geography datatype? Or will I need to build a whole new datalayer and set of queries for whenever I need to use Geography columns? I've been stuck on this for a few days and can't work out if it's possible. 回答1: Cast the column to a varbinary(max), which Linq to SQL can

Find points in cells through pandas dataframes of coordinates

邮差的信 提交于 2019-12-01 01:53:22
I have to find which points are inside a grid of square cells, given the points coordinates and the coordinates of the bounds of the cells, through two pandas dataframes. I'm calling dfc the dataframe containing the code and the boundary coordinates of the cells (I simplify the problem, in the real analysis I have a big grid with geographical points and tons of points to check): Code,minx,miny,maxx,maxy 01,0.0,0.0,2.0,2.0 02,2.0,2.0,3.0,3.0 and dfp the dataframe containing an Id and the coordinates of the points: Id,x,y 0,1.5,1.5 1,1.1,1.1 2,2.2,2.2 3,1.3,1.3 4,3.4,1.4 5,2.0,1.5 Now I would