spatial-index

Optimizing mysql query to select all points with in polygon using spatial indexes

别等时光非礼了梦想. 提交于 2019-12-23 17:23:37
问题 Firstly, I admit that my experience with spatial functions is very minimal. I have a table in MySQL with 20 fields and 23549187 records that contain geographical data. One of the fields is 'point' which is of point data type and has spatial index on it. I have a query that selects all points within a polygon which looks like this, select * from `table_name` where ST_CONTAINS(ST_GEOMFROMTEXT('POLYGON((151.186 -23.497,151.207 -23.505,151.178 -23.496,151.174 -23.49800000000001,151.176 -23.496

Using STCrosses() with a Spatial Index in SQL Server

三世轮回 提交于 2019-12-23 03:22:45
问题 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" 回答1: No. Indexing spatial data is nontrivial, and the class you are discussing can contain arbitrarily

Spatial index slowing down query

…衆ロ難τιáo~ 提交于 2019-12-22 05:15:41
问题 Background I have a table that contains POLYGONS/MULTIPOLYGONS which represent customer territories: The table contains roughly 8,000 rows Approximately 90% of the polygons are circles The remainder of the polygons represent one or more states, provinces, or other geographic regions. The raw polygon data for these shapes was imported from US census data. The table has a spatial index and a clustered index on the primary key. No changes to the default SQL Server 2008 R2 settings were made. 16

Error when using Spatial Index in SQL Server

烈酒焚心 提交于 2019-12-21 14:33:09
问题 I use Spatial Index and when I try to execute WHERE statement: WHERE T.GEOMETRY.STIntersects(O.GEOMETRY) = 1 AND T.GEOMETRY.STTouches(O.GEOMETRY) = 0 It works fine, but when I try to execute with OR: WHERE T.GEOMETRY.STOverlaps(O.GEOMETRY) = 1 OR T.GEOMETRY.STWithin(O.GEOMETRY) = 1 I get this error: The query processor could not produce a query plan for a query with a spatial index hint. Reason: Could not find required binary spatial method in a condition. Try removing the index hints or

What is a SPATIAL INDEX and when should I use it?

浪尽此生 提交于 2019-12-20 09:46:31
问题 Like most of the average PHP web developers I use MySql as a RDBMS. MySql (as other RDBMS also) offers SPATIAL INDEX features, but I'm don't get it very well. I have googled for it but didn't find clear real world examples to clarify my bad knowledge about it. Could someone explain me a little bit what is a SPATIAL INDEX and when should I use it? 回答1: You can use a spatial index for indexing geo-objects - shapes. The spatial index makes it possible to efficiently search for objects that

MySQL: Invalid GIS data provided to function st_geometryfromtext

…衆ロ難τιáo~ 提交于 2019-12-19 09:14:33
问题 Here's my code: SET @poly = 'Polygon((-98.07697478272888 30.123832577126326, -98.07697478272888 30.535734310413392, -97.48302581787107 30.535734310413392, -97.48302581787107 30.123832577126326))'; SELECT name FROM county_shapes WHERE MBRContains(ST_GeomFromText(@poly), SHAPE); Whenever I run that I get a "MySQL: Invalid GIS data provided to function st_geometryfromtext" error. This returns the same error: SELECT name FROM county_shapes WHERE MBRContains(ST_GeomFromText('Polygon((-98

Selecting a good SQL Server 2008 spatial index with large polygons

若如初见. 提交于 2019-12-18 10:55:26
问题 I'm having some fun trying to pick a decent SQL Server 2008 spatial index setup for a data set I am dealing with. The dataset is polygons, representing contours over the whole globe. There are 106,000 rows in the table, the polygons are stored in a geometry field. The issue I have is that many of the polygons cover a large portion of the globe. This seems to make it very hard to get a spatial index that will eliminate many rows in the primary filter. For example, look at the following query:

Know of any C# spatial data libraries?

戏子无情 提交于 2019-12-18 01:21:56
问题 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. 回答1: SharpMap is a (well known and used) OpenSource

Spatial Index not being used for polygon-in-bounding-box search

不羁岁月 提交于 2019-12-12 22:40:23
问题 I have a MyISAM table in MariaDB containing two datetime columns begin and end and would like to create and use a spatial index on the two in a similar fashion to the blog post here. Here is how I create the table: CREATE TABLE `mytable` ( `id` int(11) NOT NULL, `begin` datetime NOT NULL, `end` datetime NOT NULL, ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 After filling the table with data, I then add a polygon column: ALTER TABLE mytable add time_range_int

Using a spatial database to find polygons that contain a point

妖精的绣舞 提交于 2019-12-11 13:54:22
问题 I'm using MongoDB to store spatial records. Some records are polygons, and others are points. Data is being continually inserted. I need to be able to access all records whose polygon contains a point. Mongo's spatial queries allow finding all points within a polygon, but not all polygons that contain a point. Is there a good way to do this in MongoDB another database system? 回答1: Unfortunately, there is no way to run this query at present -- unless you're willing to simplify the application